configure: added '--with-static' option (disabled by default).

This commit is contained in:
Juan RP 2012-07-19 16:01:12 +02:00
parent 9c05e4b0c9
commit ef5743dfe5
3 changed files with 33 additions and 6 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.16.6 (???):
* configure: added "--with-static" and if enabled, the static executables
will also be built and installed. By default it's disabled.
* xbps-repo(8): the 'genindex' target has been replaced by the 'index-add' and
'index-clean' targets. The 'index-add' expects a list of binary packages to
be added to repository's index:

24
configure vendored
View File

@ -15,6 +15,7 @@ DEBUG=
BUILD_TESTS=
BUILD_API_DOCS=
BUILD_PIE=
BUILD_STATIC=
SILENT=yes
HAVE_VISIBILITY=no
@ -41,8 +42,9 @@ for instance \`--prefix=\$HOME'.
--debug Build with debugging code and symbols
--verbose Disable silent build to see compilation details
--with-pie Build XBPS programs as PIE (default disabled)
--with-api-docs Install XBPS API Library documentation (default disabled)
--with-pie Build XBPS programs as PIE (default disabled)
--with-static Build XBPS static utils (default disabled)
--with-tests Build and install Kyua tests (default disabled)
Needs atf >= 0.15 (http://code.google.com/p/kyua)
_EOF
@ -71,6 +73,7 @@ for x; do
--with-pie) BUILD_PIE=$var;;
--pkgconfigdir) PKGCONFIGDIR=$var;;
--with-tests) BUILD_TESTS=yes;;
--with-static) BUILD_STATIC=yes;;
--testsdir) TESTSDIR=$var;;
--help) usage;;
*) echo "$0: WARNING: unknown option $opt" >&2;;
@ -156,7 +159,7 @@ ETCDIR="${ETCDIR}/xbps"
echo "ETCDIR ?= $ETCDIR" >>$CONFIG_MK
[ -z "$DEBUG" ] && DEBUG=no
[ -z "$BUILD_PIE" ] && BUILD_PIE_VAL=no
[ -z "$BUILD_PIE" ] && BUILD_PIE_VALUE=no
if [ -z "$CC" ]; then
printf "Looking for compiler ... "
@ -299,9 +302,9 @@ if [ -n "$BUILD_PIE" ]; then
fi
if [ $? -eq 0 ]; then
echo "Building programs as PIE (Position Independent Executable)."
BUILD_PIE_VAL=yes
BUILD_PIE_VALUE=yes
else
BUILD_PIE_VAL=no
BUILD_PIE_VALUE=no
fi
fi
@ -598,6 +601,16 @@ else
>>$CONFIG_MK
fi
#
# If --with-static enabled, build static binaries.
#
if [ "$BUILD_STATIC" = "yes" ]; then
echo "BUILD_STATIC = yes" >>$CONFIG_MK
BUILD_STATIC_VALUE=yes
else
BUILD_STATIC_VALUE=no
fi
#
# If --with-tests enabled, check for ATF >= 0.15 via pkg-config.
#
@ -643,7 +656,8 @@ fi
echo
echo " Build API documentation = $BUILD_API_DOCS_VALUE"
echo " Build Kyua test suite = $BUILD_TESTS_VALUE"
echo " Build programs as PIE = $BUILD_PIE_VAL"
echo " Build programs as PIE = $BUILD_PIE_VALUE"
echo " Build static programs = $BUILD_STATIC_VALUE"
echo " Build with debug = $DEBUG"
echo " Use external proplib = $PROPLIB"
echo " Use external libfetch = $LIBFETCH"

View File

@ -2,8 +2,14 @@
OBJS ?= main.o
BINS = $(BIN)
ifdef BUILD_STATIC
BINS += $(BIN).static
endif
.PHONY: all
all: $(BIN) $(BIN).static
all: $(BINS)
.PHONY: clean
clean:
@ -14,7 +20,9 @@ clean:
install: all
install -d $(DESTDIR)$(SBINDIR)
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(DESTDIR)$(SBINDIR)
ifdef BUILD_STATIC
install $(INSTALL_STRIPPED) -m 755 $(BIN).static $(DESTDIR)$(SBINDIR)
endif
ifdef MAN
install -d $(DESTDIR)$(MANDIR)/man8
install -m 644 $(MAN) $(DESTDIR)$(MANDIR)/man8
@ -23,7 +31,9 @@ endif
.PHONY: uninstall
uninstall:
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN)
ifdef BUILD_STATIC
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN).static
endif
ifdef MAN
-rm -f $(DESTDIR)$(MANDIR)/man8/$(MAN)
endif