aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sci-electronics/bsc/bsc-9999.ebuild16
-rw-r--r--sci-electronics/bsc/files/bsc-9999-fix-libdir.patch247
2 files changed, 261 insertions, 2 deletions
diff --git a/sci-electronics/bsc/bsc-9999.ebuild b/sci-electronics/bsc/bsc-9999.ebuild
index d76b4f5f5..6feedbbed 100644
--- a/sci-electronics/bsc/bsc-9999.ebuild
+++ b/sci-electronics/bsc/bsc-9999.ebuild
@@ -3,7 +3,7 @@
EAPI=7
-DESCRIPTION="Bluespec High Level Hardware Design Language"
+DESCRIPTION="Bluespec high level hardware design language compiler"
HOMEPAGE="https://github.com/B-Lang-org/bsc"
if [[ ${PV} == "9999" ]] ; then
@@ -16,6 +16,8 @@ fi
LICENSE="BSD GPL-3+ MIT"
SLOT="0"
+IUSE="test"
+RESTRICT="!test? ( test )"
RDEPEND="
dev-haskell/old-time:0=
@@ -38,6 +40,16 @@ BDEPEND="
sys-devel/flex
"
+PATCHES=(
+ "${FILESDIR}"/${PN}-9999-fix-libdir.patch
+)
+
+DOCS=( "README.md" "COPYING" )
+
+# We don't want to run it because it will do install by default.
+src_compile() { :; }
+
src_install() {
- emake PREFIX="${D}" install
+ emake PREFIX="${ED%/}"/usr LIBDIR="${ED%/}"/usr/$(get_libdir) install
+ einstalldocs
}
diff --git a/sci-electronics/bsc/files/bsc-9999-fix-libdir.patch b/sci-electronics/bsc/files/bsc-9999-fix-libdir.patch
new file mode 100644
index 000000000..4bf421845
--- /dev/null
+++ b/sci-electronics/bsc/files/bsc-9999-fix-libdir.patch
@@ -0,0 +1,247 @@
+diff --git a/Makefile b/Makefile
+index 4938b24..51e265b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -3,6 +3,7 @@ TOP := $(PWD)
+
+ PREFIX ?= $(TOP)/inst
+ BUILDDIR ?= $(TOP)/build
++LIBDIR ?= $(PREFIX)/lib
+
+ .PHONY: all
+ all: install
+@@ -21,7 +22,7 @@ rem_build:
+
+ .PHONY: install
+ install:
+- $(MAKE) -C src PREFIX=$(PREFIX) install
++ $(MAKE) -C src PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) install
+
+ # In the future, this will be much more expansive, and run the actual test
+ # suite once it's open sourced.
+diff --git a/src/Makefile b/src/Makefile
+index 1daeb3a..b5a1146 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -4,6 +4,7 @@ TOP := $(PWD)/..
+ include $(TOP)/platform.mk
+
+ PREFIX?=$(TOP)/inst
++LIBDIR?=$(PREFIX)/lib
+
+ ifndef NO_DEPS_CHECKS
+ CC_TOOLS=$(CC) $(CXX) $(LD)
+@@ -45,17 +46,17 @@ all: install
+
+ .PHONY: install clean full_clean
+ install clean full_clean:
+- $(MAKE) -C vendor/stp PREFIX=$(PREFIX) $@
+- $(MAKE) -C vendor/yices PREFIX=$(PREFIX) $@
+- $(MAKE) -C vendor/htcl PREFIX=$(PREFIX) $@
++ $(MAKE) -C vendor/stp PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C vendor/yices PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C vendor/htcl PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
+ # we need to build targets from here sequentially, as they operate in the same workspace
+- $(MAKE) -C comp -j1 PREFIX=$(PREFIX) $@
+- $(MAKE) -C Libraries PREFIX=$(PREFIX) $@
+- $(MAKE) -C exec PREFIX=$(PREFIX) $@
+- $(MAKE) -C VPI PREFIX=$(PREFIX) $@
+- $(MAKE) -C Verilog PREFIX=$(PREFIX) $@
+- $(MAKE) -C Verilog.Quartus PREFIX=$(PREFIX) $@
+- $(MAKE) -C Verilog.Vivado PREFIX=$(PREFIX) $@
+- $(MAKE) -C bluetcl PREFIX=$(PREFIX) $@
+- $(MAKE) -C bluesim PREFIX=$(PREFIX) $@
++ $(MAKE) -C comp -j1 PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C Libraries PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C exec PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C VPI PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C Verilog PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C Verilog.Quartus PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C Verilog.Vivado PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C bluetcl PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
++ $(MAKE) -C bluesim PREFIX=$(PREFIX) LIBDIR=$(LIBDIR) $@
+
+diff --git a/src/VPI/Makefile b/src/VPI/Makefile
+index 698037b..0070714 100644
+--- a/src/VPI/Makefile
++++ b/src/VPI/Makefile
+@@ -6,7 +6,8 @@ include $(TOP)/platform.mk
+ INSTALL ?= install
+
+ PREFIX?=$(TOP)/inst
+-INSTALLDIR=$(PREFIX)/lib/VPI
++LIBDIR?=$(PREFIX)/lib
++INSTALLDIR=$(LIBDIR)/VPI
+
+ .PHONY: all
+ all: install
+diff --git a/src/Verilog/common.mk b/src/Verilog/common.mk
+index ef29190..06b3553 100644
+--- a/src/Verilog/common.mk
++++ b/src/Verilog/common.mk
+@@ -14,7 +14,8 @@ INSTALL?=install -c
+ RM = rm -f
+
+ PREFIX?=$(TOP)/inst
+-INSTALLDIR=$(PREFIX)/lib/$(INSTALL_NAME)
++LIBDIR?=$(PREFIX)/lib
++INSTALLDIR=$(LIBDIR)/$(INSTALL_NAME)
+
+ .PHONY: all
+ all: test
+diff --git a/src/bluesim/Makefile b/src/bluesim/Makefile
+index 60f2fd9..3e66e5a 100644
+--- a/src/bluesim/Makefile
++++ b/src/bluesim/Makefile
+@@ -4,7 +4,8 @@ TOP:=$(PWD)/../..
+ INSTALL ?= install
+
+ PREFIX?=$(TOP)/inst
+-INSTALLDIR=$(PREFIX)/lib/Bluesim
++LIBDIR?=$(PREFIX)/lib
++INSTALLDIR=$(LIBDIR)/Bluesim
+
+ COMPDIR=$(TOP)/src/comp
+
+diff --git a/src/bluetcl/Makefile b/src/bluetcl/Makefile
+index 80d6050..34d877b 100644
+--- a/src/bluetcl/Makefile
++++ b/src/bluetcl/Makefile
+@@ -2,7 +2,8 @@ PWD:=$(shell pwd)
+ TOP:=$(PWD)/../..
+
+ PREFIX?=$(TOP)/inst
+-INSTALLDIR = $(PREFIX)/lib/tcllib/bluespec
++LIBDIR?=$(PREFIX)/lib
++INSTALLDIR = $(LIBDIR)/tcllib/bluespec
+
+ FILES = \
+ tclIndex \
+diff --git a/src/bluetcl/bluespec.tcl b/src/bluetcl/bluespec.tcl
+index 4ee8e86..e243531 100644
+--- a/src/bluetcl/bluespec.tcl
++++ b/src/bluetcl/bluespec.tcl
+@@ -129,6 +129,7 @@ proc Bluetcl::initBluespec {} {
+ utils::donothing
+ lappend auto_path /usr/share
+ lappend auto_path /usr/lib
++lappend auto_path /usr/lib64
+
+ 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
+--- a/src/comp/Makefile
++++ b/src/comp/Makefile
+@@ -14,6 +14,7 @@ RM = rm -f
+ LN = ln -sf
+
+ FIND = find
++SED = sed
+
+ # -----
+ # Options
+@@ -37,6 +38,7 @@ export NOUPDATEBUILDVERSION
+
+ # PREFIX is where things are installed
+ PREFIX?=$(TOP)/inst
++LIBDIR=$(PREFIX)/lib
+ BINDIR=$(PREFIX)/bin
+
+ # Top-level of where intermediate GHC files are stored
+@@ -390,6 +392,7 @@ $(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)
+
+ .PHONY: install-bsc
+ install-bsc: $(addprefix $(BINDIR)/,$(BSCEXES))
+diff --git a/src/comp/wrapper.sh b/src/comp/wrapper.sh
+index 656e9a0..fa1a052 100755
+--- a/src/comp/wrapper.sh
++++ b/src/comp/wrapper.sh
+@@ -5,9 +5,22 @@
+ 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 [ ! -d ${LIBDIR} ]; then
++ LIBDIR="$(find ${BINDIR}/.. -maxdepth 10 -type d -name 'SAT' -print -quit)"
++ if [ ! "x${LIBDIR}" = "x" ]; then
++ LIBDIR="${LIBDIR}/.."
++ else
++ echo "Error Bluespec library path not found."
++ exit 1;
++ fi
++fi
+
+ # Set BLUESPECDIR based on the location
+-BLUESPECDIR="$(cd ${BINDIR}/../lib; echo $PWD)"
++BLUESPECDIR="$(cd ${LIBDIR}; echo $PWD)"
+ export BLUESPECDIR
+
+ # Add the dynamically-linked SAT libraries to the load path
+diff --git a/src/exec/Makefile b/src/exec/Makefile
+index 9a16e22..02536cc 100644
+--- a/src/exec/Makefile
++++ b/src/exec/Makefile
+@@ -4,7 +4,8 @@ TOP:=$(PWD)/../..
+ INSTALL?= install
+
+ PREFIX?=$(TOP)/inst
+-INSTALLDIR=$(PREFIX)/lib/exec
++LIBDIR?=$(PREFIX)/lib
++INSTALLDIR=$(LIBDIR)/exec
+
+ .PHONY: install
+ install:
+diff --git a/src/vendor/stp/Makefile b/src/vendor/stp/Makefile
+index 092995d..a520184 100644
+--- a/src/vendor/stp/Makefile
++++ b/src/vendor/stp/Makefile
+@@ -2,6 +2,7 @@ TOP=../../..
+ include $(TOP)/platform.mk
+
+ PREFIX?=$(TOP)/inst
++LIBDIR?=$(PREFIX)/lib
+
+ .PHONY: all install clean full_clean
+
+@@ -22,8 +23,8 @@ all: install
+ install:
+ $(MAKE) -C $(SRC) install
+ ln -fsn HaskellIfc include_hs
+- install -m 755 -d $(PREFIX)/lib/SAT
+- install -m 644 lib/$(SNAME) $(PREFIX)/lib/SAT
++ install -m 755 -d $(LIBDIR)/SAT
++ install -m 644 lib/$(SNAME) $(LIBDIR)/SAT
+
+ clean:
+ $(MAKE) -C $(SRC) clean
+diff --git a/src/vendor/yices/Makefile b/src/vendor/yices/Makefile
+index b8dbdea..8d4776c 100644
+--- a/src/vendor/yices/Makefile
++++ b/src/vendor/yices/Makefile
+@@ -2,6 +2,7 @@ TOP:=../../..
+ include $(TOP)/platform.mk
+
+ PREFIX?=$(TOP)/inst
++LIBDIR?=$(PREFIX)/lib
+
+ .PHONY: all clean full_clean install
+
+@@ -22,8 +23,8 @@ install:
+ ln -fsn $(VERSION)/include
+ ln -fsn $(VERSION)/lib
+ ln -fsn $(VERSION)/include_hs
+- install -m 755 -d $(PREFIX)/lib/SAT
+- install -m 644 lib/$(SNAME) $(PREFIX)/lib/SAT
++ install -m 755 -d $(LIBDIR)/SAT
++ install -m 644 lib/$(SNAME) $(LIBDIR)/SAT
+
+ clean:
+ $(MAKE) -C $(VERSION) clean