2010-05-20 02:08:27 +05:30
|
|
|
#!/bin/sh
|
|
|
|
# Try and be like autotools configure, but without autotools
|
|
|
|
|
2020-04-23 10:56:30 +05:30
|
|
|
VERSION=0.60
|
2012-10-03 13:40:20 +05:30
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
# Ensure that we do not inherit these from env
|
|
|
|
OS=
|
|
|
|
BUILD=
|
|
|
|
HOST=
|
|
|
|
TARGET=
|
2012-03-12 19:53:04 +05:30
|
|
|
BUILD_TESTS=
|
2010-05-20 02:08:27 +05:30
|
|
|
BUILD_API_DOCS=
|
2012-07-19 19:31:12 +05:30
|
|
|
BUILD_STATIC=
|
2011-07-29 16:17:34 +05:30
|
|
|
SILENT=yes
|
2011-01-15 16:51:38 +05:30
|
|
|
HAVE_VISIBILITY=no
|
2019-04-24 10:46:42 +05:30
|
|
|
SET_RPATH=
|
2020-01-06 16:39:28 +05:30
|
|
|
DEBUG=
|
2019-06-12 23:11:40 +05:30
|
|
|
FULL_DEBUG=
|
2020-01-06 17:17:50 +05:30
|
|
|
BUILD_LTO=
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<_EOF
|
|
|
|
\`configure' configures XBPS to adapt to many kinds of systems.
|
|
|
|
|
|
|
|
By default, \`make install' will install all the files in
|
|
|
|
\`/usr/local/sbin', \`/usr/local/lib' etc. You can specify
|
|
|
|
an installation prefix other than \`/usr/local' using \`--prefix',
|
|
|
|
for instance \`--prefix=\$HOME'.
|
|
|
|
|
2012-12-29 12:14:10 +05:30
|
|
|
--prefix=DIR Install architecture-independent files in PREFIX
|
|
|
|
--exec-prefix=DIR Install architecture-dependent files in EPREFIX
|
2015-05-16 12:57:34 +05:30
|
|
|
--bindir=DIR Executables [PREFIX/bin]
|
2012-12-29 12:14:10 +05:30
|
|
|
--libdir=DIR Object code libraries [PREFIX/lib]
|
|
|
|
--includedir=DIR C header files [EPREFIX/include]
|
|
|
|
--mandir=DIR Man documentation [EPREFIX/share/man]
|
|
|
|
--datadir=DIR Read-only architecture-independent data [EPREFIX/share]
|
2013-06-28 12:25:50 +05:30
|
|
|
--sysconfdir=DIR Configuration files directory [PREFIX/etc]
|
2012-12-29 12:14:10 +05:30
|
|
|
--pkgconfigdir=DIR pkg-config directory [EPREFIX/lib/pkgconfig]
|
|
|
|
--testsdir=DIR Test suite directory [EPREFIX/tests]
|
2013-11-25 17:04:03 +05:30
|
|
|
--localstatedir=DIR Local state directory to store XBPS db files [/var]
|
2015-05-05 19:30:04 +05:30
|
|
|
--dbdir=DIR Path to the pkgdb directory [LOCALSTATEDIR/db/xbps]
|
2012-12-29 12:14:10 +05:30
|
|
|
|
|
|
|
--verbose Disable silent build to see compilation details
|
2019-04-24 10:46:42 +05:30
|
|
|
--enable-rpath Link binaries with rpath '\$ORIGIN/../lib'
|
2012-12-29 12:14:10 +05:30
|
|
|
--enable-api-docs Install XBPS API Library documentation (default disabled)
|
2020-01-06 16:39:28 +05:30
|
|
|
--enable-debug Enables debugging (assertions and -g, default enabled)
|
2015-05-28 14:32:40 +05:30
|
|
|
--enable-fulldebug Enables extra debugging code (default disabled)
|
2012-12-29 12:14:10 +05:30
|
|
|
--enable-static Build XBPS static utils (default disabled)
|
2020-01-06 17:17:50 +05:30
|
|
|
--enable-lto Build with Link Time Optimization (default disabled)
|
2012-12-29 12:14:10 +05:30
|
|
|
--enable-tests Build and install Kyua tests (default disabled)
|
2019-04-24 10:46:42 +05:30
|
|
|
Needs atf >= 0.15 (https://github.com/jmmv/atf)
|
|
|
|
Needs kyua to run the test suite (https://github.com/jmmv/kyua)
|
2010-05-20 02:08:27 +05:30
|
|
|
_EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
for x; do
|
|
|
|
opt=${x%%=*}
|
|
|
|
var=${x#*=}
|
|
|
|
case "$opt" in
|
2020-01-06 16:39:28 +05:30
|
|
|
--enable-debug) DEBUG=yes;;
|
2015-05-28 14:32:40 +05:30
|
|
|
--enable-fulldebug) FULL_DEBUG=yes;;
|
2019-04-24 10:46:42 +05:30
|
|
|
--enable-rpath) SET_RPATH=yes;;
|
2010-05-20 02:08:27 +05:30
|
|
|
--prefix) PREFIX=$var;;
|
2012-01-18 15:58:55 +05:30
|
|
|
--exec-prefix) EPREFIX=$var;;
|
2015-05-16 12:57:34 +05:30
|
|
|
--bindir) BINDIR=$var;;
|
2010-05-20 02:08:27 +05:30
|
|
|
--mandir) MANDIR=$var;;
|
|
|
|
--datadir) SHAREDIR=$var;;
|
|
|
|
--build) BUILD=$var;;
|
|
|
|
--host) HOST=$var;;
|
|
|
|
--target) TARGET=$var;;
|
|
|
|
--includedir) INCLUDEDIR=$var;;
|
2014-11-06 14:28:04 +05:30
|
|
|
--sysconfdir) SYSCONFDIR=$var;;
|
2013-11-25 17:04:03 +05:30
|
|
|
--localstatedir) LOCALSTATEDIR=$var;;
|
2010-05-20 02:08:27 +05:30
|
|
|
--libdir) LIBDIR=$var;;
|
|
|
|
--datadir|--infodir) ;; # ignore autotools
|
2015-05-05 19:30:04 +05:30
|
|
|
--dbdir) DBDIR=$var;;
|
2012-12-29 12:14:10 +05:30
|
|
|
--enable-api-docs) BUILD_API_DOCS=$var;;
|
2011-07-29 16:17:34 +05:30
|
|
|
--verbose) unset SILENT;;
|
2012-01-17 22:04:36 +05:30
|
|
|
--pkgconfigdir) PKGCONFIGDIR=$var;;
|
2012-12-29 12:14:10 +05:30
|
|
|
--enable-tests) BUILD_TESTS=yes;;
|
|
|
|
--enable-static) BUILD_STATIC=yes;;
|
2020-01-06 17:17:50 +05:30
|
|
|
--enable-lto) BUILD_LTO=yes;;
|
2012-03-12 19:58:54 +05:30
|
|
|
--testsdir) TESTSDIR=$var;;
|
2010-05-20 02:08:27 +05:30
|
|
|
--help) usage;;
|
|
|
|
*) echo "$0: WARNING: unknown option $opt" >&2;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
: ${SED:=sed}
|
|
|
|
|
|
|
|
: ${PREFIX:=/usr/local}
|
2012-01-18 15:58:55 +05:30
|
|
|
: ${EPREFIX:=${PREFIX}}
|
2010-05-20 02:08:27 +05:30
|
|
|
: ${SYSCONFDIR:=${PREFIX}/etc}
|
2015-05-16 12:57:34 +05:30
|
|
|
: ${BINDIR:=${PREFIX}/bin}
|
2012-01-18 15:58:55 +05:30
|
|
|
: ${LIBDIR:=${EPREFIX}/lib}
|
|
|
|
: ${SHAREDIR:=${EPREFIX}/share}
|
|
|
|
: ${MANDIR:=${EPREFIX}/share/man}
|
|
|
|
: ${INCLUDEDIR:=${EPREFIX}/include}
|
2012-01-17 21:56:18 +05:30
|
|
|
: ${PKGCONFIGDIR:=${LIBDIR}/pkgconfig}
|
2012-03-12 19:53:04 +05:30
|
|
|
: ${TESTSDIR:=${EPREFIX}/tests}
|
2013-11-25 17:04:03 +05:30
|
|
|
: ${LOCALSTATEDIR:=/var}
|
|
|
|
: ${DBDIR:=${LOCALSTATEDIR}/db/xbps}
|
2010-05-20 02:08:27 +05:30
|
|
|
: ${TOPDIR:=..}
|
|
|
|
|
|
|
|
_which()
|
|
|
|
{
|
2021-02-01 19:30:34 +05:30
|
|
|
x="$(command -v "$1" 2>/dev/null)"
|
2010-05-20 02:08:27 +05:30
|
|
|
if [ -n "$x" ]; then
|
|
|
|
echo "$x"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
for x in /sbin/"$1" /usr/sbin/"$1" \
|
|
|
|
/usr/pkg/sbin/"$1" /usr/local/sbin/"$1"
|
|
|
|
do
|
|
|
|
if [ -e "$x" ]; then
|
|
|
|
echo "$x"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
CONFIG_MK=config.mk
|
|
|
|
|
|
|
|
if [ -z "$BUILD" ]; then
|
|
|
|
BUILD=`uname -m`-unknown-`uname -s | tr '[:upper:]' '[:lower:]'`
|
|
|
|
fi
|
|
|
|
if [ -z "$HOST" ]; then
|
|
|
|
[ -z "$TARGET" ] && TARGET=$BUILD
|
|
|
|
HOST=$TARGET
|
|
|
|
fi
|
|
|
|
if [ -z "$TARGET" ]; then
|
|
|
|
[ -z "$HOST" ] && HOST=$BUILD
|
|
|
|
TARGET=$HOST
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$OS" ]; then
|
|
|
|
# Derive OS from cpu-manufacturer-os-kernel
|
|
|
|
CPU=${TARGET%%-*}
|
|
|
|
REST=${TARGET#*-}
|
|
|
|
MANU=${REST%%-*}
|
|
|
|
REST=${REST#*-}
|
|
|
|
OS=${REST%%-*}
|
|
|
|
REST=${REST#*-}
|
|
|
|
KERNEL=${REST%%-*}
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Configuring xbps for ... $OS"
|
2014-01-20 23:20:33 +05:30
|
|
|
rm -f $CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "# Common vars used by XBPS on $OS." >$CONFIG_MK
|
|
|
|
|
2014-08-23 12:36:46 +05:30
|
|
|
echo "XBPS_OS = $OS" >>$CONFIG_MK
|
2012-10-03 13:40:20 +05:30
|
|
|
echo "VERSION = $VERSION" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "TOPDIR ?= $TOPDIR" >>$CONFIG_MK
|
|
|
|
echo "PREFIX ?= $PREFIX" >>$CONFIG_MK
|
2012-01-18 15:58:55 +05:30
|
|
|
echo "EPREFIX ?= $EPREFIX" >>$CONFIG_MK
|
2015-05-16 12:57:34 +05:30
|
|
|
echo "SBINDIR ?= $BINDIR" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "INCLUDEDIR ?= $INCLUDEDIR" >>$CONFIG_MK
|
|
|
|
echo "LIBDIR ?= $LIBDIR" >>$CONFIG_MK
|
|
|
|
echo "MANDIR ?= $MANDIR" >>$CONFIG_MK
|
|
|
|
echo "SHAREDIR ?= $SHAREDIR" >>$CONFIG_MK
|
2012-01-17 21:56:18 +05:30
|
|
|
echo "PKGCONFIGDIR ?= $PKGCONFIGDIR" >>$CONFIG_MK
|
2012-03-12 19:53:04 +05:30
|
|
|
echo "TESTSDIR ?= $TESTSDIR" >>$CONFIG_MK
|
2013-11-25 17:04:03 +05:30
|
|
|
echo "DBDIR ?= $DBDIR" >>$CONFIG_MK
|
2011-10-17 16:07:15 +05:30
|
|
|
|
2014-11-06 14:28:04 +05:30
|
|
|
ETCDIR="${SYSCONFDIR}/xbps.d"
|
2011-06-04 17:07:53 +05:30
|
|
|
echo "ETCDIR ?= $ETCDIR" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
if [ -z "$CC" ]; then
|
|
|
|
printf "Looking for compiler ... "
|
|
|
|
for b in $TARGET- ""; do
|
2019-04-22 19:48:41 +05:30
|
|
|
for cc in gcc icc clang tcc pcc cc; do
|
2010-05-20 02:08:27 +05:30
|
|
|
if type $b$cc >/dev/null 2>&1; then
|
|
|
|
CC=$b$cc
|
|
|
|
echo "$CC"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
[ -n "$CC" ] && break
|
|
|
|
done
|
|
|
|
if [ -z "$CC" ]; then
|
|
|
|
echo
|
|
|
|
echo "no suitable compiler found - aborting" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Using compiler $CC"
|
|
|
|
fi
|
2013-02-06 23:11:44 +05:30
|
|
|
|
2020-01-06 16:39:28 +05:30
|
|
|
|
2019-04-22 19:48:41 +05:30
|
|
|
echo "CC = $CC" >>$CONFIG_MK
|
2023-07-27 03:12:28 +05:30
|
|
|
echo "CFLAGS = -Oz" >>$CONFIG_MK
|
2013-02-06 23:11:44 +05:30
|
|
|
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "LDFLAGS = -L\$(TOPDIR)/lib" >>$CONFIG_MK
|
|
|
|
echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
|
2011-10-17 16:07:15 +05:30
|
|
|
echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK
|
2014-11-06 14:28:04 +05:30
|
|
|
echo "CPPFLAGS += -DXBPS_SYSDEFCONF_PATH=\\\"${SHAREDIR}/xbps.d\\\"" >>$CONFIG_MK
|
2012-10-03 13:40:20 +05:30
|
|
|
echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK
|
2015-05-05 19:30:04 +05:30
|
|
|
echo "CPPFLAGS += -DXBPS_META_PATH=\\\"${DBDIR}\\\"" >>$CONFIG_MK
|
2018-07-18 07:54:26 +05:30
|
|
|
echo "CPPFLAGS += -DUNUSED=\"__attribute__((__unused__))\"" >>$CONFIG_MK
|
2013-08-29 14:15:30 +05:30
|
|
|
|
2020-12-13 10:23:42 +05:30
|
|
|
if [ -d .git ] && command -v git >/dev/null; then
|
2013-09-26 15:03:07 +05:30
|
|
|
_gitrev=$(git rev-parse --short HEAD)
|
2012-11-20 05:08:23 +05:30
|
|
|
echo "CPPFLAGS += -DXBPS_GIT=\\\"${_gitrev}\\\"" >>$CONFIG_MK
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
if [ -n "$DEBUG" -a "$DEBUG" != no -a "$DEBUG" != false ]; then
|
|
|
|
echo "Building with debugging symbols."
|
2013-11-08 13:41:47 +05:30
|
|
|
echo "CPPFLAGS += -DDEBUG" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "CFLAGS += -g" >>$CONFIG_MK
|
2020-01-06 16:39:28 +05:30
|
|
|
echo "LIBXBPS_LDFLAGS += -g" >>$CONFIG_MK
|
2013-12-06 16:25:08 +05:30
|
|
|
else
|
|
|
|
echo "CPPFLAGS+= -DNDEBUG" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
2015-05-28 14:32:40 +05:30
|
|
|
if [ -n "$FULL_DEBUG" ]; then
|
|
|
|
echo "Enabling extra debugging code."
|
|
|
|
echo "CPPFLAGS+= -DFULL_DEBUG" >>$CONFIG_MK
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
case "$OS" in
|
|
|
|
linux)
|
2014-01-20 23:20:33 +05:30
|
|
|
echo "CPPFLAGS += -D_XOPEN_SOURCE=700" >>$CONFIG_MK
|
2011-01-25 17:30:23 +05:30
|
|
|
echo "CPPFLAGS += -D_FILE_OFFSET_BITS=64" >> $CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-07-19 21:20:29 +05:30
|
|
|
# Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features
|
2013-03-03 12:42:09 +05:30
|
|
|
XCC="$CC $CFLAGS $CPPFLAGS $LDFLAGS"
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
check_compiler_flag()
|
|
|
|
{
|
|
|
|
local flag="$1"
|
|
|
|
local mode="$2"
|
|
|
|
local var="$3"
|
|
|
|
local rv=0
|
|
|
|
|
2011-01-19 21:22:55 +05:30
|
|
|
[ -z "$var" ] && var="CFLAGS"
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
printf "Checking if $CC supports -${mode}${flag} ... "
|
|
|
|
cat <<EOF >_ccflag.c
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(void) { return 0; }
|
|
|
|
EOF
|
|
|
|
if $XCC -${mode}${flag} _ccflag.c -o _ccflag 2>_ccflag.err; then
|
|
|
|
if ! test -s _ccflag.err; then
|
2011-01-14 05:00:49 +05:30
|
|
|
if [ "$mode" = "W" -a -z "$var" ]; then
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "CPPFLAGS += -${mode}${flag}" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo "$var += -${mode}${flag}" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
echo "yes."
|
|
|
|
else
|
|
|
|
rv=1
|
|
|
|
echo "no."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
rv=1
|
|
|
|
echo "no."
|
|
|
|
fi
|
2023-02-12 00:46:08 +05:30
|
|
|
[ -z "$SILENT" ] && cat _ccflag.err
|
2010-05-20 02:08:27 +05:30
|
|
|
rm -f _ccflag.c _ccflag _ccflag.err
|
|
|
|
return $rv
|
|
|
|
}
|
|
|
|
|
2016-11-04 12:19:48 +05:30
|
|
|
# If supported, make sure to disable --as-needed for CC tests.
|
|
|
|
check_compiler_flag "l,--no-as-needed" W LDFLAGS
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
XCC="$XCC -Wl,--no-as-needed"
|
|
|
|
fi
|
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
#
|
|
|
|
# Check for some compiler warning flags.
|
|
|
|
#
|
|
|
|
for f in all extra error shadow "format=2" missing-prototypes \
|
2020-02-21 15:25:17 +05:30
|
|
|
missing-declarations nested-externs vla overlength-strings \
|
2011-01-15 18:32:34 +05:30
|
|
|
unsafe-loop-optimizations undef sign-compare \
|
|
|
|
missing-include-dirs old-style-definition \
|
2011-01-15 16:29:44 +05:30
|
|
|
init-self redundant-decls float-equal missing-noreturn \
|
2011-11-06 14:29:25 +05:30
|
|
|
cast-align cast-qual pointer-arith comment \
|
2011-01-15 16:29:44 +05:30
|
|
|
declaration-after-statement write-strings stack-protector; do
|
2010-05-20 02:08:27 +05:30
|
|
|
check_compiler_flag ${f} W
|
|
|
|
done
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for some compiler flags.
|
|
|
|
#
|
2011-02-24 20:52:09 +05:30
|
|
|
check_compiler_flag PIC f CFLAGS
|
2014-08-27 12:30:14 +05:30
|
|
|
check_compiler_flag "inline-functions" f CFLAGS
|
2011-02-24 20:52:09 +05:30
|
|
|
|
2014-12-28 08:06:40 +05:30
|
|
|
check_compiler_flag stack-protector-strong f CFLAGS
|
|
|
|
if [ $? -ne 0 ]; then
|
2014-12-31 13:25:09 +05:30
|
|
|
check_compiler_flag stack-protector f CFLAGS
|
2014-12-28 08:06:40 +05:30
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
if [ "$CC" = "gcc" ]; then
|
|
|
|
check_compiler_flag "param ssp-buffer-size=1" - CFLAGS
|
|
|
|
fi
|
2010-10-27 03:49:02 +05:30
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
|
|
|
check_compiler_flag "visibility=default" f SHAREDLIB_CFLAGS
|
2011-01-15 16:51:38 +05:30
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
HAVE_VISIBILITY=yes
|
|
|
|
echo "CPPFLAGS += -DHAVE_VISIBILITY=1" >>$CONFIG_MK
|
2013-06-19 15:27:25 +05:30
|
|
|
echo "HAVE_VISIBILITY = 1" >>$CONFIG_MK
|
2011-01-15 16:51:38 +05:30
|
|
|
fi
|
2011-02-24 20:52:09 +05:30
|
|
|
|
2011-02-24 20:03:53 +05:30
|
|
|
#
|
|
|
|
# Check for -Wl,--export-dynamic and if it fails, try -rdynamic.
|
|
|
|
#
|
|
|
|
check_compiler_flag "l,--export-dynamic" W LIBXBPS_LDFLAGS
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
check_compiler_flag dynamic r LIBXBPS_LDFLAGS
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
|
2012-09-04 15:01:48 +05:30
|
|
|
#
|
|
|
|
# Check for -Wl,-z,relro,-z,now
|
|
|
|
check_compiler_flag "l,-z,relro,-z,now" W LDFLAGS
|
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
#
|
2020-02-06 14:18:30 +05:30
|
|
|
# Check if PIE is supported.
|
2010-05-20 02:08:27 +05:30
|
|
|
#
|
2012-09-04 15:01:48 +05:30
|
|
|
check_compiler_flag PIE f PROG_CFLAGS
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
check_compiler_flag pie "" PROG_LDFLAGS
|
|
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
BUILD_PIE_VALUE=yes
|
|
|
|
else
|
|
|
|
BUILD_PIE_VALUE=no
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
|
|
|
|
2013-09-15 13:36:49 +05:30
|
|
|
#
|
|
|
|
# A C99 compiler is required to build xbps.
|
|
|
|
#
|
|
|
|
check_compiler_flag "std=c99" "" CFLAGS
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "ERRROR: A compatible C99 compiler is required, exiting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-06-27 20:39:43 +05:30
|
|
|
#
|
|
|
|
# Enable LTO if supported (clang and gcc)
|
|
|
|
#
|
2020-01-06 17:17:50 +05:30
|
|
|
if [ "$BUILD_LTO" = "yes" ]; then
|
|
|
|
check_compiler_flag lto f CFLAGS
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "LDFLAGS += -flto" >> $CONFIG_MK
|
|
|
|
if [ "$CC" = "gcc" ]; then
|
|
|
|
echo "AR = gcc-ar" >> $CONFIG_MK
|
|
|
|
echo "RANLIB = gcc-ranlib" >>$CONFIG_MK
|
|
|
|
fi
|
2019-06-27 20:39:43 +05:30
|
|
|
fi
|
|
|
|
fi
|
2013-09-15 13:36:49 +05:30
|
|
|
|
2013-11-19 00:24:38 +05:30
|
|
|
if [ -n "$CFLAGS" ]; then
|
|
|
|
echo "CFLAGS += $CFLAGS" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
if [ -n "$LDFLAGS" ]; then
|
|
|
|
echo "LDFLAGS += $LDFLAGS" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
if [ -n "$CPPFLAGS" ]; then
|
|
|
|
echo "CPPFLAGS += $CPPFLAGS" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2019-06-26 19:18:46 +05:30
|
|
|
if [ "$CC" = "tcc" ]; then
|
|
|
|
echo "CFLAGS += -Wno-error" >>$CONFIG_MK
|
|
|
|
fi
|
2023-08-08 11:02:17 +05:30
|
|
|
# openssl 3 compatibility
|
|
|
|
echo "CFLAGS += -Wno-error=deprecated-declarations">>$CONFIG_MK
|
2019-06-26 19:18:46 +05:30
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
# libfetch
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "CPPFLAGS += -I\$(TOPDIR)/lib/fetch" >>$CONFIG_MK
|
2013-06-20 13:56:12 +05:30
|
|
|
echo "LDFLAGS += -lssl" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS = \$(TOPDIR)/lib/libxbps.a" >>$CONFIG_MK
|
|
|
|
|
|
|
|
# proplib
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "CPPFLAGS += -I\$(TOPDIR)/lib/portableproplib" >>$CONFIG_MK
|
|
|
|
echo "CPPFLAGS += -I\$(TOPDIR)/lib/portableproplib/prop" >>$CONFIG_MK
|
2020-02-06 14:18:30 +05:30
|
|
|
echo "CFLAGS += -pthread" >>$CONFIG_MK
|
2014-01-31 16:05:31 +05:30
|
|
|
|
2014-10-09 18:11:43 +05:30
|
|
|
#
|
|
|
|
# Check for GCC atomic builtins.
|
|
|
|
#
|
|
|
|
func=atomic
|
|
|
|
printf "Checking for GCC atomic builtins ... "
|
|
|
|
cat <<EOF >_$func.c
|
|
|
|
int main() {
|
|
|
|
volatile unsigned long val = 1;
|
|
|
|
__sync_fetch_and_add(&val, 1);
|
|
|
|
__sync_fetch_and_sub(&val, 1);
|
|
|
|
__sync_add_and_fetch(&val, 1);
|
|
|
|
__sync_sub_and_fetch(&val, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
|
|
|
echo yes.
|
|
|
|
HAVE_ATOMICS=1
|
|
|
|
else
|
|
|
|
echo no.
|
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
if test -n "$HAVE_ATOMICS"; then
|
|
|
|
echo "CPPFLAGS += -DHAVE_ATOMICS" >> $CONFIG_MK
|
|
|
|
fi
|
2011-01-25 17:09:05 +05:30
|
|
|
#
|
|
|
|
# Check for vasprintf().
|
|
|
|
#
|
2011-01-25 17:12:34 +05:30
|
|
|
func=vasprintf
|
|
|
|
printf "Checking for $func() ... "
|
2014-01-20 23:20:33 +05:30
|
|
|
if test -n "$HAVE_VASPRINTF"; then
|
|
|
|
echo "yes (cached)."
|
|
|
|
else
|
|
|
|
cat <<EOF >_$func.c
|
|
|
|
#define _GNU_SOURCE
|
2011-01-25 17:09:05 +05:30
|
|
|
#include <stdio.h>
|
2019-04-22 19:00:02 +05:30
|
|
|
#include <stdarg.h>
|
2011-01-25 17:09:05 +05:30
|
|
|
int main(void) {
|
2017-10-25 12:43:07 +05:30
|
|
|
va_list ap;
|
|
|
|
vasprintf(NULL, NULL, ap);
|
2011-01-25 17:09:05 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2014-01-20 23:20:33 +05:30
|
|
|
|
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
|
|
|
echo yes.
|
|
|
|
HAVE_VASPRINTF=1
|
|
|
|
else
|
|
|
|
echo no.
|
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
fi
|
|
|
|
if test -n "$HAVE_VASPRINTF"; then
|
2011-07-29 16:17:34 +05:30
|
|
|
echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK
|
2011-01-25 17:09:05 +05:30
|
|
|
else
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "COMPAT_OBJS+= compat/vasprintf.o" >>$CONFIG_MK
|
2011-01-25 17:09:05 +05:30
|
|
|
fi
|
|
|
|
|
2011-07-09 14:20:44 +05:30
|
|
|
#
|
|
|
|
# Check for strcasestr().
|
|
|
|
#
|
|
|
|
func=strcasestr
|
2012-12-15 15:17:30 +05:30
|
|
|
printf "Checking for $func() ... "
|
2011-07-09 14:20:44 +05:30
|
|
|
cat <<EOF >_$func.c
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <string.h>
|
|
|
|
int main(void) {
|
|
|
|
const char *h = "NEEDCOFEE";
|
|
|
|
const char *n = "IneedCoffee";
|
|
|
|
strcasestr(n, h);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
2012-12-15 15:17:30 +05:30
|
|
|
echo yes.
|
2011-07-29 16:17:34 +05:30
|
|
|
echo "CPPFLAGS += -DHAVE_STRCASESTR" >>$CONFIG_MK
|
2011-07-09 14:20:44 +05:30
|
|
|
else
|
2012-12-15 15:17:30 +05:30
|
|
|
echo no.
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "COMPAT_OBJS += compat/strcasestr.o" >>$CONFIG_MK
|
2011-07-09 14:20:44 +05:30
|
|
|
fi
|
2011-07-29 16:17:34 +05:30
|
|
|
rm -f _$func _$func.c
|
2011-07-09 14:20:44 +05:30
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
#
|
|
|
|
# Check for strlcpy().
|
|
|
|
#
|
2011-01-25 17:12:34 +05:30
|
|
|
func=strlcpy
|
|
|
|
printf "Checking for $func() ... "
|
|
|
|
cat <<EOF >_$func.c
|
2010-05-20 02:08:27 +05:30
|
|
|
#include <string.h>
|
|
|
|
int main(void) {
|
|
|
|
const char s1[] = "foo";
|
|
|
|
char s2[10];
|
|
|
|
strlcpy(s2, s1, sizeof(s2));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2011-01-25 17:12:34 +05:30
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
2012-12-15 15:17:30 +05:30
|
|
|
echo yes.
|
2011-07-29 16:17:34 +05:30
|
|
|
echo "CPPFLAGS += -DHAVE_STRLCPY" >> $CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
else
|
2012-12-15 15:17:30 +05:30
|
|
|
echo no.
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "COMPAT_OBJS += compat/strlcpy.o" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
2011-07-29 16:17:34 +05:30
|
|
|
rm -f _$func.c _$func
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
#
|
|
|
|
# Check for strlcat().
|
2011-01-25 17:12:34 +05:30
|
|
|
func=strlcat
|
|
|
|
printf "Checking for $func() ... "
|
2011-07-29 16:17:34 +05:30
|
|
|
cat <<EOF > _$func.c
|
2010-05-20 02:08:27 +05:30
|
|
|
#include <string.h>
|
|
|
|
int main(void) {
|
2010-12-10 20:55:28 +05:30
|
|
|
const char src[] = "foo";
|
2010-05-20 02:08:27 +05:30
|
|
|
char dst[10];
|
|
|
|
strlcat(dst, src, sizeof(dst));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2011-01-25 17:12:34 +05:30
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
2012-12-15 15:17:30 +05:30
|
|
|
echo yes.
|
2011-07-29 16:17:34 +05:30
|
|
|
echo "CPPFLAGS += -DHAVE_STRLCAT" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
else
|
2012-12-15 15:17:30 +05:30
|
|
|
echo no.
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "COMPAT_OBJS += compat/strlcat.o" >>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
2011-01-25 17:12:34 +05:30
|
|
|
rm -f _$func.c _$func
|
2011-07-29 16:17:34 +05:30
|
|
|
|
2016-01-26 18:41:10 +05:30
|
|
|
#
|
|
|
|
# Check for strnstr().
|
|
|
|
func=strnstr
|
|
|
|
printf "Checking for $func() ... "
|
|
|
|
cat <<EOF > _$func.c
|
|
|
|
#include <string.h>
|
|
|
|
int main(void) {
|
|
|
|
const char big[] = "foo";
|
|
|
|
const char little[] = "f";
|
|
|
|
strnstr(big, little, 3);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
|
|
|
echo yes.
|
|
|
|
echo "CPPFLAGS += -DHAVE_STRNSTR" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo no.
|
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
|
2012-12-06 17:28:17 +05:30
|
|
|
#
|
|
|
|
# Check for humanize_number().
|
|
|
|
func=humanize_number
|
|
|
|
printf "Checking for $func() ... "
|
|
|
|
cat <<EOF > _$func.c
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <util.h>
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
humanize_number(NULL, 0, 0, NULL, 0, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2017-01-02 21:18:08 +05:30
|
|
|
if $XCC _$func.c -lutil -o _$func 2>/dev/null; then
|
2012-12-15 15:17:30 +05:30
|
|
|
echo yes.
|
2012-12-06 17:28:17 +05:30
|
|
|
echo "CPPFLAGS+= -DHAVE_HUMANIZE_NUMBER" >>$CONFIG_MK
|
|
|
|
else
|
2012-12-15 15:17:30 +05:30
|
|
|
echo no.
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "COMPAT_OBJS+= compat/humanize_number.o" >>$CONFIG_MK
|
2012-12-06 17:28:17 +05:30
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for rbtree_ininit().
|
|
|
|
#
|
|
|
|
func=rb_tree_init
|
|
|
|
printf "Checking for $func() ... "
|
|
|
|
cat <<EOF > _$func.c
|
|
|
|
#include <sys/rbtree.h>
|
|
|
|
int main(void) {
|
|
|
|
rb_tree_init(NULL, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
2012-12-15 15:17:30 +05:30
|
|
|
echo yes.
|
2012-12-06 17:28:17 +05:30
|
|
|
echo "CPPFLAGS += -DHAVE_RBTREE" >>$CONFIG_MK
|
|
|
|
else
|
2012-12-15 15:17:30 +05:30
|
|
|
echo no.
|
2021-02-05 03:12:57 +05:30
|
|
|
echo "LIBPROP_OBJS += portableproplib/rb.o" >>$CONFIG_MK
|
2012-12-06 17:28:17 +05:30
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
|
2013-06-19 15:11:49 +05:30
|
|
|
#
|
|
|
|
# Check for fdatasync().
|
|
|
|
#
|
|
|
|
func=fdatasync
|
|
|
|
printf "Checking for $func() ... "
|
|
|
|
cat <<EOF > _$func.c
|
|
|
|
#include <unistd.h>
|
|
|
|
int main(void) {
|
|
|
|
fdatasync(0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
|
|
|
echo yes.
|
|
|
|
echo "CPPFLAGS += -DHAVE_FDATASYNC" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo no.
|
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
|
2011-12-19 21:11:57 +05:30
|
|
|
#
|
|
|
|
# Check for clock_gettime(3).
|
|
|
|
#
|
|
|
|
func=clock_gettime
|
|
|
|
printf "Checking for $func() ... "
|
|
|
|
cat <<EOF > _$func.c
|
|
|
|
#include <time.h>
|
|
|
|
int main(void) {
|
|
|
|
struct timespec ts;
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2017-01-02 21:18:08 +05:30
|
|
|
if $XCC _$func.c -lrt -o _$func 2>/dev/null; then
|
2011-12-19 21:11:57 +05:30
|
|
|
echo yes.
|
|
|
|
echo "CPPFLAGS += -DHAVE_CLOCK_GETTIME" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += -lrt" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += -lrt" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo no.
|
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
|
2011-07-04 16:39:37 +05:30
|
|
|
#
|
|
|
|
# zlib is required.
|
|
|
|
#
|
|
|
|
func=InflateInit2
|
2011-07-29 16:17:34 +05:30
|
|
|
printf "Checking for $func() ... "
|
2011-07-04 16:39:37 +05:30
|
|
|
cat <<EOF > _$func.c
|
|
|
|
#include <zlib.h>
|
|
|
|
int main(void) {
|
|
|
|
z_stream strm;
|
|
|
|
strm.zalloc = Z_NULL;
|
|
|
|
strm.zfree = Z_NULL;
|
|
|
|
strm.opaque = Z_NULL;
|
|
|
|
strm.avail_in = 0;
|
|
|
|
strm.next_in = Z_NULL;
|
|
|
|
inflateInit2(&strm, 15+16);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2017-01-02 21:18:08 +05:30
|
|
|
if $XCC _$func.c -lz -o _$func 2>/dev/null; then
|
2012-12-15 15:17:30 +05:30
|
|
|
echo yes.
|
2011-07-29 16:17:34 +05:30
|
|
|
echo "LDFLAGS += -lz" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += -lz" >>$CONFIG_MK
|
2011-07-04 16:39:37 +05:30
|
|
|
else
|
|
|
|
ZLIB=no
|
|
|
|
fi
|
|
|
|
rm -f _$func.c _$func
|
|
|
|
if [ "$ZLIB" = "no" ]; then
|
|
|
|
echo "Failed to link with your system's zlib, can't continue..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
#
|
|
|
|
# If building API library documentation, doxygen and graphviz are required.
|
|
|
|
#
|
|
|
|
if [ -n "$BUILD_API_DOCS" ]; then
|
|
|
|
echo "Building API documentation via doxygen and graphviz."
|
|
|
|
printf "Checking for doxygen ..."
|
|
|
|
DOXYGEN_BIN=$(_which doxygen)
|
|
|
|
if [ -z "$DOXYGEN_BIN" ]; then
|
|
|
|
echo "not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo yes
|
|
|
|
fi
|
|
|
|
printf "Checking for graphviz ... "
|
|
|
|
DOT_BIN=$(_which dot)
|
|
|
|
if [ -z "$DOT_BIN" ]; then
|
|
|
|
echo "dot(1) command not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "BUILD_API_DOCS= yes" >> $CONFIG_MK
|
|
|
|
BUILD_API_DOCS_VALUE=yes
|
|
|
|
else
|
|
|
|
BUILD_API_DOCS_VALUE=no
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# pkg-config is required to know dependencies for static linking.
|
|
|
|
#
|
|
|
|
printf "Checking for pkg-config ... "
|
|
|
|
PKGCONFIG_BIN=$(_which pkg-config)
|
|
|
|
if [ -z "$PKGCONFIG_BIN" ]; then
|
|
|
|
echo "not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
2017-10-25 12:55:03 +05:30
|
|
|
# libarchive with pkg-config support is required.
|
2010-05-20 02:08:27 +05:30
|
|
|
#
|
2019-06-26 12:35:37 +05:30
|
|
|
LIBARCHIVE_REQVER=3.3.3
|
2017-10-25 12:55:03 +05:30
|
|
|
|
|
|
|
printf "Checking for libarchive >= ${LIBARCHIVE_REQVER} via pkg-config ... "
|
2019-12-26 19:59:03 +05:30
|
|
|
if ! pkg-config --atleast-version=${LIBARCHIVE_REQVER} libarchive; then
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "libarchive.pc file not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
2019-12-26 19:59:03 +05:30
|
|
|
echo "found version $(pkg-config --modversion libarchive)."
|
|
|
|
echo "CFLAGS += $(pkg-config --cflags libarchive)" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += $(pkg-config --libs libarchive)" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += $(pkg-config --libs --static libarchive)" \
|
2011-01-14 05:00:49 +05:30
|
|
|
>>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
|
|
|
|
2011-01-15 15:11:35 +05:30
|
|
|
#
|
2017-12-26 19:58:16 +05:30
|
|
|
# libssl with pkg-config support is required.
|
2011-01-15 15:11:35 +05:30
|
|
|
#
|
2017-12-26 19:58:16 +05:30
|
|
|
printf "Checking for libssl via pkg-config ... "
|
2020-04-16 18:27:18 +05:30
|
|
|
if pkg-config --exists 'libssl' && ! pkg-config --exists libtls ; then
|
2019-12-26 19:59:03 +05:30
|
|
|
echo "found OpenSSL version $(pkg-config --modversion libssl)."
|
|
|
|
elif pkg-config --exists libssl libtls; then
|
|
|
|
echo "found LibreSSL version $(pkg-config --modversion libssl)."
|
2011-01-15 15:11:35 +05:30
|
|
|
else
|
2017-12-26 19:58:16 +05:30
|
|
|
echo "libssl.pc file not found or incompatible version detected, exiting."
|
|
|
|
exit 1
|
2011-01-15 15:11:35 +05:30
|
|
|
fi
|
2019-12-26 19:59:03 +05:30
|
|
|
echo "CFLAGS += $(pkg-config --cflags libssl)" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += $(pkg-config --libs libssl)" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += $(pkg-config --libs --static libssl)" \
|
2017-12-26 19:58:16 +05:30
|
|
|
>>$CONFIG_MK
|
2011-01-15 15:11:35 +05:30
|
|
|
|
2012-07-19 19:31:12 +05:30
|
|
|
#
|
2014-09-23 00:33:02 +05:30
|
|
|
# If --enable-static enabled, build static binaries.
|
2012-07-19 19:31:12 +05:30
|
|
|
#
|
|
|
|
if [ "$BUILD_STATIC" = "yes" ]; then
|
|
|
|
echo "BUILD_STATIC = yes" >>$CONFIG_MK
|
|
|
|
BUILD_STATIC_VALUE=yes
|
|
|
|
else
|
|
|
|
BUILD_STATIC_VALUE=no
|
|
|
|
fi
|
|
|
|
|
2012-03-12 19:53:04 +05:30
|
|
|
#
|
2014-09-23 00:33:02 +05:30
|
|
|
# If --enable-tests enabled, check for ATF >= 0.15 via pkg-config.
|
2012-03-12 19:53:04 +05:30
|
|
|
#
|
|
|
|
if [ "$BUILD_TESTS" = "yes" ]; then
|
|
|
|
printf "Checking for ATF via pkg-config ... "
|
2019-12-26 19:59:03 +05:30
|
|
|
if ! pkg-config --atleast-version=0.15 atf-c; then
|
2012-03-12 19:53:04 +05:30
|
|
|
echo "ATF >= 0.15 not found in PKG_CONFIG_LIBDIR, exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-12-26 19:59:03 +05:30
|
|
|
echo "found version $(pkg-config --modversion atf-c)."
|
|
|
|
echo "TEST_CFLAGS += $(pkg-config --cflags atf-c)" >>$CONFIG_MK
|
|
|
|
echo "TEST_LDFLAGS += $(pkg-config --libs atf-c)" >>$CONFIG_MK
|
2012-03-12 19:53:04 +05:30
|
|
|
echo "BUILD_TESTS = yes" >>$CONFIG_MK
|
|
|
|
BUILD_TESTS_VALUE=yes
|
|
|
|
else
|
|
|
|
BUILD_TESTS_VALUE=no
|
|
|
|
fi
|
|
|
|
|
2011-01-15 15:19:35 +05:30
|
|
|
if [ -n "$SILENT" ]; then
|
|
|
|
echo "SILENT = @" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo "SILENT =" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2019-04-24 10:46:42 +05:30
|
|
|
if [ "$SET_RPATH" ]; then
|
|
|
|
echo "PROG_LDFLAGS = -Wl,-rpath='XORIGIN/../lib'" >>$CONFIG_MK
|
|
|
|
sed -i 's,XORIGIN,$$ORIGIN,' $CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
echo
|
|
|
|
echo " XBPS has been configured with the following options:"
|
|
|
|
echo
|
2012-01-18 15:58:55 +05:30
|
|
|
echo " PREFIX = $PREFIX"
|
|
|
|
echo " EPREFIX = $EPREFIX"
|
2015-05-16 12:57:34 +05:30
|
|
|
echo " BINDIR = $BINDIR"
|
2010-05-20 02:08:27 +05:30
|
|
|
echo " LIBDIR = $LIBDIR"
|
|
|
|
echo " INCLUDEDIR = $INCLUDEDIR"
|
|
|
|
echo " SHAREDIR = $SHAREDIR"
|
|
|
|
echo " MANDIR = $MANDIR"
|
2011-06-04 17:07:53 +05:30
|
|
|
echo " ETCDIR = $ETCDIR"
|
2013-11-25 17:04:03 +05:30
|
|
|
echo " DBDIR = $DBDIR"
|
2020-01-06 16:39:28 +05:30
|
|
|
echo " CFLAGS = $CFLAGS"
|
|
|
|
echo " LDFLAGS = $LDFLAGS"
|
2011-01-15 16:51:38 +05:30
|
|
|
echo
|
|
|
|
echo " Build API documentation = $BUILD_API_DOCS_VALUE"
|
2012-03-12 19:53:04 +05:30
|
|
|
echo " Build Kyua test suite = $BUILD_TESTS_VALUE"
|
2012-07-19 19:31:12 +05:30
|
|
|
echo " Build programs as PIE = $BUILD_PIE_VALUE"
|
|
|
|
echo " Build static programs = $BUILD_STATIC_VALUE"
|
2020-01-06 17:17:50 +05:30
|
|
|
echo " Build with LTO = $BUILD_LTO"
|
2020-01-06 16:39:28 +05:30
|
|
|
echo " Build with debugging = $DEBUG"
|
2019-06-12 23:11:40 +05:30
|
|
|
echo " Build with full debug = $FULL_DEBUG"
|
2011-01-15 16:51:38 +05:30
|
|
|
if [ -n "$HAVE_VISIBILITY" ]; then
|
|
|
|
echo " Symbol visibility = $HAVE_VISIBILITY"
|
|
|
|
fi
|
2019-04-24 10:46:42 +05:30
|
|
|
if [ -n "$SET_RPATH" ]; then
|
|
|
|
echo " Build with rpath = $SET_RPATH"
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
echo
|
|
|
|
echo " You can now run make && make install clean."
|
|
|
|
echo
|
|
|
|
|
|
|
|
exit 0
|