commit:     4e3c7e96cb7b2e93c1a2c2fc1a62b82036879603
Author:     Huang Rui <vowstar <AT> gmail <DOT> com>
AuthorDate: Tue Jan  5 21:52:57 2021 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Tue Jan  5 21:52:57 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4e3c7e96

sci-electronics/bsc: add special wrapper patch for gentoo

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Huang Rui <vowstar <AT> gmail.com>

 sci-electronics/bsc/bsc-9999.ebuild                  |  1 +
 sci-electronics/bsc/files/bsc-9999-fix-libdir.patch  | 17 ++++++++++-------
 sci-electronics/bsc/files/bsc-9999-fix-wrapper.patch | 13 +++++++++++++
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/sci-electronics/bsc/bsc-9999.ebuild 
b/sci-electronics/bsc/bsc-9999.ebuild
index 6feedbbe..163f49ec 100644
--- a/sci-electronics/bsc/bsc-9999.ebuild
+++ b/sci-electronics/bsc/bsc-9999.ebuild
@@ -42,6 +42,7 @@ BDEPEND="
 
 PATCHES=(
        "${FILESDIR}"/${PN}-9999-fix-libdir.patch
+       "${FILESDIR}"/${PN}-9999-fix-wrapper.patch
 )
 
 DOCS=( "README.md" "COPYING" )

diff --git a/sci-electronics/bsc/files/bsc-9999-fix-libdir.patch 
b/sci-electronics/bsc/files/bsc-9999-fix-libdir.patch
index 4bf42184..e0afdb4c 100644
--- a/sci-electronics/bsc/files/bsc-9999-fix-libdir.patch
+++ b/sci-electronics/bsc/files/bsc-9999-fix-libdir.patch
@@ -130,7 +130,7 @@ index 4ee8e86..e243531 100644
  if { [catch Bluetcl::initBluespec err] } {
      puts "Error in initialization file bluespec.tcl: $err" 
 diff --git a/src/comp/Makefile b/src/comp/Makefile
-index 58b81d7..dda30ac 100644
+index 58b81d7..6f113a2 100644
 --- a/src/comp/Makefile
 +++ b/src/comp/Makefile
 @@ -14,6 +14,7 @@ RM = rm -f
@@ -149,26 +149,29 @@ index 58b81d7..dda30ac 100644
  BINDIR=$(PREFIX)/bin
  
  # Top-level of where intermediate GHC files are stored
-@@ -390,6 +392,7 @@ $(BINDIR)/core/%: %
+@@ -389,7 +391,8 @@ $(BINDIR)/core/%: %
+ 
  $(BINDIR)/%: wrapper.sh $(BINDIR)/core/%
        mkdir -p -m 755 $(BINDIR)
-       $(INSTALL) -m 755 wrapper.sh $(BINDIR)/$(@F)
-+      cat $(BINDIR)/$(@F) | $(SED) -e "s:^LIBDIR=.*$$:LIBDIR=\"$(abspath 
$(LIBDIR))\":g" > $(BINDIR)/$(@F)
+-      $(INSTALL) -m 755 wrapper.sh $(BINDIR)/$(@F)
++      $(SED) "s:^LIBDIR=.*$$:LIBDIR=\"$(abspath $(LIBDIR))\":g" wrapper.sh > 
$(BUILDDIR)/$(@F)
++      $(INSTALL) -m 755 $(BUILDDIR)/$(@F) $(BINDIR)/$(@F)
  
  .PHONY: install-bsc
  install-bsc: $(addprefix $(BINDIR)/,$(BSCEXES))
 diff --git a/src/comp/wrapper.sh b/src/comp/wrapper.sh
-index 656e9a0..fa1a052 100755
+index 656e9a0..1d5cf47 100755
 --- a/src/comp/wrapper.sh
 +++ b/src/comp/wrapper.sh
-@@ -5,9 +5,22 @@
+@@ -5,9 +5,23 @@
  ABSNAME="$(cd "${0%/*}"; echo $PWD)/${0##*/}"
  SCRIPTNAME="${ABSNAME##*/}"
  BINDIR="${ABSNAME%/*}"
 +# LIBDIR will be replaced to user defined path after build
 +LIBDIR="${BINDIR}/../lib"
 +
-+# If missing LIBDIR, search one
++# If missing LIBDIR, search one.
++# This is unlikely to happen unless the user moves the file after 
installation.
 +if [ ! -d ${LIBDIR} ]; then
 +    LIBDIR="$(find ${BINDIR}/.. -maxdepth 10 -type d -name 'SAT' -print 
-quit)"
 +    if [ ! "x${LIBDIR}" = "x"  ]; then

diff --git a/sci-electronics/bsc/files/bsc-9999-fix-wrapper.patch 
b/sci-electronics/bsc/files/bsc-9999-fix-wrapper.patch
new file mode 100644
index 00000000..974e4289
--- /dev/null
+++ b/sci-electronics/bsc/files/bsc-9999-fix-wrapper.patch
@@ -0,0 +1,13 @@
+diff --git a/src/comp/Makefile b/src/comp/Makefile
+index 6f113a2..5220c30 100644
+--- a/src/comp/Makefile
++++ b/src/comp/Makefile
+@@ -391,7 +391,7 @@ $(BINDIR)/core/%: %
+ 
+ $(BINDIR)/%: wrapper.sh $(BINDIR)/core/%
+       mkdir -p -m 755 $(BINDIR)
+-      $(SED) "s:^LIBDIR=.*$$:LIBDIR=\"$(abspath $(LIBDIR))\":g" wrapper.sh > 
$(BUILDDIR)/$(@F)
++      $(SED) "s:^LIBDIR=.*$$:LIBDIR=\"$$\{BINDIR\}/$(shell realpath 
--relative-to $(BINDIR) $(LIBDIR))\":g" wrapper.sh > $(BUILDDIR)/$(@F)
+       $(INSTALL) -m 755 $(BUILDDIR)/$(@F) $(BINDIR)/$(@F)
+ 
+ .PHONY: install-bsc

Reply via email to