summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Sandoval2022-08-10 10:42:23 -0700
committerOmar Sandoval2022-08-10 10:42:23 -0700
commit1d6f6239697f10379dc6b96840dfa8fa4324c87f (patch)
tree15db420f6a3543e2de2c8d08fae4360800641b30
parent8139813733e1495aef30d739c7e87729ac9740be (diff)
downloadaur-coccinelle.tar.gz
Fix OCaml scripting support
Apply the fix from https://gitlab.inria.fr/coccinelle/coccinelle/-/commit/540888ff426e0b1f7907b63ce26e712d1fc172cc, which hasn't made it into a release yet.
-rw-r--r--.SRCINFO4
-rw-r--r--0001-Fix-263-wrong-default-path-for-COCCINELLE_HOME.patch66
-rw-r--r--PKGBUILD13
3 files changed, 79 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a09e985cabfb..a8f4f180b096 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = coccinelle
pkgdesc = Provides spatch program used to apply semantic patches
pkgver = 1.1.1
- pkgrel = 1
+ pkgrel = 2
url = http://coccinelle.lip6.fr/
arch = i686
arch = x86_64
@@ -15,6 +15,8 @@ pkgbase = coccinelle
optdepends = ocaml-findlib: OCaml scripting feature
options = !strip
source = https://github.com/coccinelle/coccinelle/archive/1.1.1.tar.gz
+ source = 0001-Fix-263-wrong-default-path-for-COCCINELLE_HOME.patch
sha256sums = 095919e129ac563586d880ebbc5aac829fec224177090aebe34dc34ed5f142bf
+ sha256sums = 9c52674ba49f9789d1a88df54a453835aa1f4b4645a9b770d3231a05bc3b22c7
pkgname = coccinelle
diff --git a/0001-Fix-263-wrong-default-path-for-COCCINELLE_HOME.patch b/0001-Fix-263-wrong-default-path-for-COCCINELLE_HOME.patch
new file mode 100644
index 000000000000..098ac1583b51
--- /dev/null
+++ b/0001-Fix-263-wrong-default-path-for-COCCINELLE_HOME.patch
@@ -0,0 +1,66 @@
+From 540888ff426e0b1f7907b63ce26e712d1fc172cc Mon Sep 17 00:00:00 2001
+Message-Id: <540888ff426e0b1f7907b63ce26e712d1fc172cc.1660153142.git.osandov@osandov.com>
+From: Thierry Martinez <Thierry.Martinez@inria.fr>
+Date: Mon, 7 Feb 2022 11:24:49 +0100
+Subject: [PATCH] Fix 263: wrong default path for COCCINELLE_HOME
+
+COCCINELLE_HOME is the directory where standard.iso is looked for.
+If COCCINELLE_HOME is not defined, we consider the directory $bindir
+where the current executable is. If $bindir/standard.iso exists,
+we use COCCINELLE_HOME=$bindir (this is a usual case during
+development, where we run spatch.opt from the working directory of the
+repository).
+
+Otherwise, we suppose that coccinelle has been installed (make
+install), and that standard.iso is installed in $libdir, where
+$libdir is $exec_prefix/lib.
+
+Before this commit, we considered wrongly that $exec_prefix was equal
+to $bindir, whereas the default value for $bindir is
+$exec_prefix/bin. Therefore, we should take for $exec_prefix the
+parent directory of $bindir.
+---
+ globals/config.ml.in | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/globals/config.ml.in b/globals/config.ml.in
+index da1e9da4..6505a911 100644
+--- a/globals/config.ml.in
++++ b/globals/config.ml.in
+@@ -26,15 +26,29 @@ let rec realpath path =
+ end
+
+ let path =
++ (* COCCINELLE_HOME is the directory where standard.iso is looked for. *)
+ try (Sys.getenv "COCCINELLE_HOME")
+ with Not_found->
++ (* If COCCINELLE_HOME is not defined, we consider the directory $bindir
++ where the current executable is. *)
+ let exec_realpath = realpath Sys.executable_name in
+- let exec_dir = Filename.dirname exec_realpath in
+- if Sys.file_exists (Filename.concat exec_dir "standard.iso") then
+- exec_dir
++ let bin_dir = Filename.dirname exec_realpath in
++ if Sys.file_exists (Filename.concat bin_dir "standard.iso") then
++ (* If $bindir/standard.iso exists,
++ we use COCCINELLE_HOME=$bindir (this is a usual case during
++ development, where we run spatch.opt from the working directory
++ of the repository). *)
++ bin_dir
+ else
++ (* Otherwise, we suppose that coccinelle has been installed (make
++ install), and that standard.iso is installed in $libdir, where
++ $libdir is $exec_prefix/lib.
++ The default value for $bindir is $exec_prefix/bin.
++ Therefore, we should take for $exec_prefix the parent directory
++ of $bindir.*)
+ let libdir =
+- Str.global_replace (Str.regexp "[$]{exec_prefix}") exec_dir "@libdir@"
++ Str.global_replace (Str.regexp "[$]{exec_prefix}")
++ (Filename.dirname bin_dir) "@libdir@"
+ in
+ Filename.concat libdir "coccinelle"
+
+--
+2.37.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 798fdbf3fdfa..6f7cf1d3bc0c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,7 +9,7 @@
pkgname=coccinelle
pkgver=1.1.1
-pkgrel=1
+pkgrel=2
pkgdesc="Provides spatch program used to apply semantic patches"
arch=('i686' 'x86_64')
url="http://coccinelle.lip6.fr/"
@@ -19,8 +19,15 @@ depends=('pcre' 'python')
optdepends=('ocaml: OCaml scripting feature'
'ocaml-findlib: OCaml scripting feature')
options=('!strip')
-source=(https://github.com/coccinelle/${pkgname}/archive/${pkgver}.tar.gz)
-sha256sums=('095919e129ac563586d880ebbc5aac829fec224177090aebe34dc34ed5f142bf')
+source=(https://github.com/coccinelle/${pkgname}/archive/${pkgver}.tar.gz
+ 0001-Fix-263-wrong-default-path-for-COCCINELLE_HOME.patch)
+sha256sums=('095919e129ac563586d880ebbc5aac829fec224177090aebe34dc34ed5f142bf'
+ '9c52674ba49f9789d1a88df54a453835aa1f4b4645a9b770d3231a05bc3b22c7')
+
+prepare() {
+ cd "$pkgname-$pkgver"
+ patch -p1 < "$srcdir/0001-Fix-263-wrong-default-path-for-COCCINELLE_HOME.patch"
+}
build() {
cd "$pkgname-$pkgver"