From aed005b0414800e488cc1aaab7bbb1d0ba4500ae Mon Sep 17 00:00:00 2001 From: Vekhir Date: Wed, 16 Aug 2023 14:23:30 +0200 Subject: [PATCH] Introduce placeholder option to STP Using STP_USE_LIB=placeholder means that the stub is compiled with a generic name and copied to the installation, but is supposed to be replaced at a later date. To make the intentions clear, the library is renamed to *_placeholder with a symlink created with the original name pointing to the library. --- src/vendor/stp/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vendor/stp/Makefile b/src/vendor/stp/Makefile index ee54458a5..a2b62e95d 100644 --- a/src/vendor/stp/Makefile +++ b/src/vendor/stp/Makefile @@ -33,6 +33,9 @@ ifeq ($(STP_USE_LIB),included) # compile from provided source else ifeq ($(STP_USE_LIB),disable) # disable STP SRC = src_stub SNAME=libstp_disabled.$(SO) +else ifeq ($(STP_USE_LIB),placeholder) # use stub to be replaced by real library later + SRC = src_stub + SNAME=libstp.$(SO) else ifeq ($(STP_USE_LIB),system) # use system STP SRC = src_sys ifeq ($(OSTYPE), Darwin) @@ -62,12 +65,17 @@ install: $(MAKE) -C $(SRC) install ln -fsn HaskellIfc include_hs @# necessary for bsc linker (src/comp/Makefile:51) - ln -s "$(SNAME)" lib/libstp.$(SO) + ln -s "$(SNAME)" lib/libstp.$(SO) || true # put self-compiled library in path where it can be found at runtime -ifeq ($(SRC), $(findstring $(SRC), src src_stub)) +ifeq ($(STP_USE_LIB), $(findstring $(STP_USE_LIB), included disable placeholder)) install -m 755 -d $(PREFIX)/lib/SAT install -m 644 "lib/$(SNAME)" $(PREFIX)/lib/SAT endif +# make it obvious that the library is a placeholder +ifeq ($(STP_USE_LIB), $(findstring $(STP_USE_LIB), placeholder)) + mv "$(PREFIX)/lib/SAT/$(SNAME)" libstp_placeholder.$(SO) + ln -s libstp_placeholder.$(SO) "$(PREFIX)/lib/SAT/$(SNAME)" +endif clean: $(MAKE) -C $(SRC) clean