configure: added --enable-rpath option.

If set, binaries will have rpath set to $ORIGIN/../lib. That means
that even using defaults (--prefix=/usr), you can install
it via DESTDIR anywhere in your system and binaries will work.

This is in preparation for BSD support.

Closes: #87 [via git-merge-pr]
This commit is contained in:
Juan RP 2019-04-24 07:16:42 +02:00 committed by Duncaen
parent 77ae94e6a1
commit 2e469aaabf
3 changed files with 15 additions and 3 deletions

14
configure vendored
View File

@ -14,6 +14,7 @@ BUILD_API_DOCS=
BUILD_STATIC= BUILD_STATIC=
SILENT=yes SILENT=yes
HAVE_VISIBILITY=no HAVE_VISIBILITY=no
SET_RPATH=
usage() usage()
{ {
@ -39,12 +40,14 @@ for instance \`--prefix=\$HOME'.
--dbdir=DIR Path to the pkgdb directory [LOCALSTATEDIR/db/xbps] --dbdir=DIR Path to the pkgdb directory [LOCALSTATEDIR/db/xbps]
--verbose Disable silent build to see compilation details --verbose Disable silent build to see compilation details
--enable-rpath Link binaries with rpath '\$ORIGIN/../lib'
--enable-api-docs Install XBPS API Library documentation (default disabled) --enable-api-docs Install XBPS API Library documentation (default disabled)
--enable-debug Build with debugging code and symbols (default disabled) --enable-debug Build with debugging code and symbols (default disabled)
--enable-fulldebug Enables extra debugging code (default disabled) --enable-fulldebug Enables extra debugging code (default disabled)
--enable-static Build XBPS static utils (default disabled) --enable-static Build XBPS static utils (default disabled)
--enable-tests Build and install Kyua tests (default disabled) --enable-tests Build and install Kyua tests (default disabled)
Needs atf >= 0.15 (https://code.google.com/p/kyua) Needs atf >= 0.15 (https://github.com/jmmv/atf)
Needs kyua to run the test suite (https://github.com/jmmv/kyua)
_EOF _EOF
exit 1 exit 1
} }
@ -55,6 +58,7 @@ for x; do
case "$opt" in case "$opt" in
--enable-debug) DEBUG=yes;; --enable-debug) DEBUG=yes;;
--enable-fulldebug) FULL_DEBUG=yes;; --enable-fulldebug) FULL_DEBUG=yes;;
--enable-rpath) SET_RPATH=yes;;
--prefix) PREFIX=$var;; --prefix) PREFIX=$var;;
--exec-prefix) EPREFIX=$var;; --exec-prefix) EPREFIX=$var;;
--bindir) BINDIR=$var;; --bindir) BINDIR=$var;;
@ -726,6 +730,11 @@ else
echo "SILENT =" >>$CONFIG_MK echo "SILENT =" >>$CONFIG_MK
fi fi
if [ "$SET_RPATH" ]; then
echo "PROG_LDFLAGS = -Wl,-rpath='XORIGIN/../lib'" >>$CONFIG_MK
sed -i 's,XORIGIN,$$ORIGIN,' $CONFIG_MK
fi
echo echo
echo " XBPS has been configured with the following options:" echo " XBPS has been configured with the following options:"
echo echo
@ -754,6 +763,9 @@ echo " Build with debug = $DEBUG"
if [ -n "$HAVE_VISIBILITY" ]; then if [ -n "$HAVE_VISIBILITY" ]; then
echo " Symbol visibility = $HAVE_VISIBILITY" echo " Symbol visibility = $HAVE_VISIBILITY"
fi fi
if [ -n "$SET_RPATH" ]; then
echo " Build with rpath = $SET_RPATH"
fi
echo echo
echo " You can now run make && make install clean." echo " You can now run make && make install clean."
echo echo

View File

@ -49,7 +49,7 @@ endif
$(BIN).static: $(OBJS) $(STATIC_LIBS) $(BIN).static: $(OBJS) $(STATIC_LIBS)
@printf " [CCLD]\t\t$@\n" @printf " [CCLD]\t\t$@\n"
${SILENT}$(CC) -static $(OBJS) $(CPPFLAGS) -L$(TOPDIR)/lib \ ${SILENT}$(CC) -static $(OBJS) $(CPPFLAGS) -L$(TOPDIR)/lib \
$(CFLAGS) $(LDFLAGS) $(STATIC_LIBS) -o $@ $(CFLAGS) $(LDFLAGS) $(PROG_LDFLAGS) $(STATIC_LIBS) -o $@
$(BIN): $(OBJS) $(BIN): $(OBJS)
@printf " [CCLD]\t\t$@\n" @printf " [CCLD]\t\t$@\n"

View File

@ -36,5 +36,5 @@ uninstall:
$(TEST): $(OBJS) $(TEST): $(OBJS)
@printf " [CCLD]\t\t$@\n" @printf " [CCLD]\t\t$@\n"
${SILENT}$(CC) $^ $(CPPFLAGS) -L$(TOPDIR)/lib $(CFLAGS) \ ${SILENT}$(CC) $^ $(CPPFLAGS) -L$(TOPDIR)/lib $(CFLAGS) \
$(PROG_CFLAGS) $(LDFLAGS) -lxbps -latf-c -o $@ $(PROG_CFLAGS) $(LDFLAGS) $(PROG_LDFLAGS) -lxbps -latf-c -o $@