Skip to content

Commit

Permalink
Introduce placeholder option to STP
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Vekhir committed Aug 16, 2023
1 parent cf03829 commit aed005b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/vendor/stp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aed005b

Please sign in to comment.