2010-05-20 02:08:27 +05:30
|
|
|
#!/bin/sh
|
|
|
|
# Try and be like autotools configure, but without autotools
|
|
|
|
|
|
|
|
# Ensure that we do not inherit these from env
|
|
|
|
STRLCPY=
|
|
|
|
STRLCAT=
|
2011-01-25 17:09:05 +05:30
|
|
|
VASPRINTF=
|
2010-05-20 02:08:27 +05:30
|
|
|
OS=
|
|
|
|
BUILD=
|
|
|
|
HOST=
|
|
|
|
TARGET=
|
|
|
|
DEBUG=
|
|
|
|
BUILD_API_DOCS=
|
|
|
|
BUILD_PIE=
|
|
|
|
EXTERNAL_PROPLIB=
|
2011-01-12 21:36:53 +05:30
|
|
|
EXTERNAL_LIBFETCH=
|
2011-01-15 15:19:35 +05:30
|
|
|
SILENT=
|
2011-01-15 16:51:38 +05:30
|
|
|
HAVE_VISIBILITY=no
|
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'.
|
|
|
|
|
2011-01-12 21:36:53 +05:30
|
|
|
--prefix=DIR install architecture-independent files in PREFIX
|
|
|
|
--sbindir=DIR system admin executables [PREFIX/sbin]
|
|
|
|
--libdir=DIR object code libraries [PREFIX/lib]
|
|
|
|
--includedir=DIR C header files [PREFIX/include]
|
|
|
|
--mandir=DIR man documentation [PREFIX/share/man]
|
|
|
|
--datadir=DIR read-only architecture-independent data [PREFIX/share]
|
2010-05-20 02:08:27 +05:30
|
|
|
|
2011-01-12 21:36:53 +05:30
|
|
|
--debug Build with debugging code and symbols
|
2011-01-15 15:19:35 +05:30
|
|
|
--silent Build silently, hidding compilation details.
|
2011-01-12 21:36:53 +05:30
|
|
|
--with-pie Build XBPS programs as PIE (default disabled)
|
|
|
|
--with-api-docs install XBPS API Library documentation (default disabled)
|
|
|
|
--with-external-proplib Use external proplib [default disabled]
|
|
|
|
--with-external-libfetch Use external libfetch [default disabled]
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
_EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
for x; do
|
|
|
|
opt=${x%%=*}
|
|
|
|
var=${x#*=}
|
|
|
|
case "$opt" in
|
|
|
|
--debug) DEBUG=yes;;
|
|
|
|
--prefix) PREFIX=$var;;
|
|
|
|
--sbindir) SBINDIR=$var;;
|
|
|
|
--mandir) MANDIR=$var;;
|
|
|
|
--datadir) SHAREDIR=$var;;
|
|
|
|
--build) BUILD=$var;;
|
|
|
|
--host) HOST=$var;;
|
|
|
|
--target) TARGET=$var;;
|
|
|
|
--includedir) INCLUDEDIR=$var;;
|
|
|
|
--libdir) LIBDIR=$var;;
|
|
|
|
--datadir|--infodir) ;; # ignore autotools
|
|
|
|
--with-api-docs) BUILD_API_DOCS=$var;;
|
2011-01-15 15:19:35 +05:30
|
|
|
--silent) SILENT=$var;;
|
2010-05-20 02:08:27 +05:30
|
|
|
--with-pie) BUILD_PIE=$var;;
|
|
|
|
--with-external-proplib) EXTERNAL_PROPLIB=$var;;
|
2011-01-12 21:36:53 +05:30
|
|
|
--with-external-libfetch) EXTERNAL_LIBFETCH=$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}
|
|
|
|
: ${SYSCONFDIR:=${PREFIX}/etc}
|
|
|
|
: ${SBINDIR:=${PREFIX}/sbin}
|
|
|
|
: ${LIBDIR:=${PREFIX}/lib}
|
|
|
|
: ${SHAREDIR:=${PREFIX}/share}
|
|
|
|
: ${MANDIR:=${PREFIX}/share/man}
|
|
|
|
: ${INCLUDEDIR:=${PREFIX}/include}
|
|
|
|
: ${TOPDIR:=..}
|
|
|
|
|
|
|
|
_which()
|
|
|
|
{
|
|
|
|
x="$(which "$1" 2>/dev/null)"
|
|
|
|
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_H=config.h
|
|
|
|
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"
|
|
|
|
rm -f $CONFIG_H $CONFIG_MK
|
|
|
|
echo "# Common vars used by XBPS on $OS." >$CONFIG_MK
|
|
|
|
echo "/* $OS */" >$CONFIG_H
|
|
|
|
|
|
|
|
echo "TOPDIR ?= $TOPDIR" >>$CONFIG_MK
|
|
|
|
echo "PREFIX ?= $PREFIX" >>$CONFIG_MK
|
|
|
|
echo "SBINDIR ?= $SBINDIR" >>$CONFIG_MK
|
|
|
|
echo "INCLUDEDIR ?= $INCLUDEDIR" >>$CONFIG_MK
|
|
|
|
echo "LIBDIR ?= $LIBDIR" >>$CONFIG_MK
|
|
|
|
echo "MANDIR ?= $MANDIR" >>$CONFIG_MK
|
|
|
|
echo "SHAREDIR ?= $SHAREDIR" >>$CONFIG_MK
|
|
|
|
|
|
|
|
[ -z "$DEBUG" ] && DEBUG=no
|
|
|
|
[ -z "$BUILD_PIE" ] && BUILD_PIE_VAL=no
|
|
|
|
|
|
|
|
if [ -z "$CC" ]; then
|
|
|
|
printf "Looking for compiler ... "
|
|
|
|
for b in $TARGET- ""; do
|
|
|
|
for cc in gcc pcc icc cc clang; do
|
|
|
|
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
|
|
|
|
echo "CC = $CC" >>$CONFIG_MK
|
|
|
|
echo "CFLAGS = -fPIC -DPIC" >>$CONFIG_MK
|
2011-01-11 19:34:23 +05:30
|
|
|
if [ -n "$CFLAGS" ]; then
|
|
|
|
echo "CFLAGS += $CFLAGS" >>$CONFIG_MK
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "LDFLAGS = -L\$(TOPDIR)/lib -L\$(LIBDIR)" >>$CONFIG_MK
|
2011-01-11 19:34:23 +05:30
|
|
|
if [ -n "$LDFLAGS" ]; then
|
|
|
|
echo "LDFLAGS += $LDFLAGS" >>$CONFIG_MK
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
|
|
|
|
echo "CPPFLAGS += -DHAVE_CONFIG_H" >>$CONFIG_MK
|
|
|
|
|
|
|
|
if [ -n "$DEBUG" -a "$DEBUG" != no -a "$DEBUG" != false ]; then
|
|
|
|
echo "Building with debugging symbols."
|
|
|
|
echo "INSTALL_STRIPPED =" >>$CONFIG_MK
|
|
|
|
echo "CFLAGS += -g" >>$CONFIG_MK
|
|
|
|
echo "CPPFLAGS += -DDEBUG" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo "INSTALL_STRIPPED = -s" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$OS" in
|
|
|
|
linux)
|
|
|
|
echo "CPPFLAGS += -D_XOPEN_SOURCE=600 -D_GNU_SOURCE" >>$CONFIG_MK
|
|
|
|
echo "CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" >> $CONFIG_MK
|
|
|
|
echo "CPPFLAGS += -D_LARGE_FILES" >> $CONFIG_MK
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
# Add CPPFLAGS and CFLAGS to CC for testing features
|
|
|
|
XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
|
|
|
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
|
|
|
|
|
|
|
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
|
|
|
|
rm -f _ccflag.c _ccflag _ccflag.err
|
|
|
|
return $rv
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for some compiler warning flags.
|
|
|
|
#
|
|
|
|
for f in all extra error shadow "format=2" missing-prototypes \
|
2011-01-15 16:29:44 +05:30
|
|
|
missing-declarations nested-externs vla no-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 \
|
2010-05-20 02:08:27 +05:30
|
|
|
cast-align cast-qual pointer-arith comment unused-macros \
|
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-01-15 15:11:35 +05:30
|
|
|
check_compiler_flag stack-protector-all f CFLAGS
|
2010-05-20 02:08:27 +05:30
|
|
|
if [ $? -eq 0 ]; then
|
2010-10-27 03:49:02 +05:30
|
|
|
if [ "$CC" = "gcc" ]; then
|
2011-01-15 15:11:35 +05:30
|
|
|
check_compiler_flag "param ssp-buffer-size=1" - CFLAGS
|
2010-10-27 03:49:02 +05:30
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
2011-01-15 15:11:35 +05:30
|
|
|
check_compiler_flag "p,-D_FORTIFY_SOURCE=2" W
|
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
|
|
|
|
fi
|
2011-01-15 15:11:35 +05:30
|
|
|
check_compiler_flag "std=c99" "" CFLAGS
|
2011-01-14 05:00:49 +05:30
|
|
|
check_compiler_flag "l,--as-needed" W LDFLAGS
|
2011-01-15 18:06:46 +05:30
|
|
|
check_compiler_flag "O2" "" CFLAGS
|
|
|
|
check_compiler_flag "pipe" "" CFLAGS
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
#
|
|
|
|
# Check if -fPIE and -pie are supported if --build-pie is set.
|
|
|
|
#
|
|
|
|
if [ -n "$BUILD_PIE" ]; then
|
|
|
|
BUILD_PIE_VAL=yes
|
|
|
|
echo "Building programs as PIE (Position Independent Executable)."
|
2010-10-27 03:49:02 +05:30
|
|
|
[ "$CC" = "gcc" ] && check_compiler_flag PIE f PROG_CFLAGS
|
2010-05-20 02:08:27 +05:30
|
|
|
check_compiler_flag pie "" PROG_LDFLAGS
|
|
|
|
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() ... "
|
|
|
|
|
|
|
|
cat <<EOF >_$func.c
|
2011-01-25 17:09:05 +05:30
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
|
|
vasprintf(NULL, NULL, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2011-01-25 17:12:34 +05:30
|
|
|
if $XCC _$func.c -o _$func 2>/dev/null; then
|
2011-01-25 17:09:05 +05:30
|
|
|
VASPRINTF=yes
|
|
|
|
else
|
|
|
|
VASPRINTF=no
|
|
|
|
fi
|
|
|
|
echo "$VASPRINTF."
|
2011-01-25 17:12:34 +05:30
|
|
|
rm -f _$func.c _$func
|
2011-01-25 17:09:05 +05:30
|
|
|
if [ "$VASPRINTF" = "yes" ]; then
|
|
|
|
echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
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
|
2010-05-20 02:08:27 +05:30
|
|
|
STRLCPY=yes
|
|
|
|
else
|
|
|
|
STRLCPY=no
|
|
|
|
fi
|
|
|
|
echo "$STRLCPY."
|
2011-01-25 17:12:34 +05:30
|
|
|
rm -f _$func.c _$func
|
2010-05-20 02:08:27 +05:30
|
|
|
if [ "$STRLCPY" = no ]; then
|
|
|
|
echo "COMPAT_SRCS += compat/strlcpy.o" >>$CONFIG_MK
|
|
|
|
echo "#include \"strlcpy.h\"" >>$CONFIG_H
|
2011-01-25 17:09:05 +05:30
|
|
|
else
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "CPPFLAGS += -DHAVE_STRLCPY" >> $CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for strlcat().
|
2011-01-25 17:12:34 +05:30
|
|
|
func=strlcat
|
|
|
|
printf "Checking for $func() ... "
|
2010-05-20 02:08:27 +05:30
|
|
|
cat <<EOF > _strlcat.c
|
|
|
|
#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
|
2010-05-20 02:08:27 +05:30
|
|
|
STRLCAT=yes
|
|
|
|
else
|
|
|
|
STRLCAT=no
|
|
|
|
fi
|
|
|
|
echo "$STRLCAT."
|
2011-01-25 17:12:34 +05:30
|
|
|
rm -f _$func.c _$func
|
2010-05-20 02:08:27 +05:30
|
|
|
if [ "$STRLCAT" = no ]; then
|
|
|
|
echo "COMPAT_SRCS += compat/strlcat.o" >>$CONFIG_MK
|
|
|
|
echo "#include \"strlcat.h\"" >>$CONFIG_H
|
2011-01-25 17:09:05 +05:30
|
|
|
else
|
2010-05-20 02:08:27 +05:30
|
|
|
echo "CPPFLAGS += -DHAVE_STRLCAT" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2011-01-19 19:15:58 +05:30
|
|
|
#
|
|
|
|
# Check if external libfetch should be used.
|
|
|
|
#
|
|
|
|
if [ -z "$EXTERNAL_LIBFETCH" ]; then
|
|
|
|
EXTERNAL_LIBFETCH_VALUE="no (using internal copy)"
|
|
|
|
echo "CPPFLAGS += -I\$(TOPDIR)/lib/fetch" >>$CONFIG_MK
|
|
|
|
echo "PROG_LDFLAGS += -lxbps" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS = -lxbps" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
EXTERNAL_LIBFETCH_VALUE=yes
|
|
|
|
echo "USE_EXTERNAL_LIBFETCH = 1" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += -lfetch" >>$CONFIG_MK
|
|
|
|
echo "PROG_LDFLAGS += -lxbps -lfetch" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS = -lxbps -lfetch" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
#
|
|
|
|
# zlib with pkg-config support is required.
|
|
|
|
#
|
2011-01-14 05:00:49 +05:30
|
|
|
printf "Checking for zlib via pkg-config ... "
|
2010-05-20 02:08:27 +05:30
|
|
|
if ! $PKGCONFIG_BIN --exists zlib; then
|
|
|
|
echo "zlib.pc file not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "found version $($PKGCONFIG_BIN --modversion zlib)."
|
2011-01-14 05:00:49 +05:30
|
|
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags zlib)" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs zlib)" >>$CONFIG_MK
|
2011-01-19 19:15:58 +05:30
|
|
|
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static zlib)" \
|
2011-01-14 05:00:49 +05:30
|
|
|
>>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
|
|
|
|
2011-01-14 05:00:49 +05:30
|
|
|
#
|
|
|
|
# Check if external proplib via pkg-config should be used instead.
|
|
|
|
#
|
|
|
|
if [ -z "$EXTERNAL_PROPLIB" ]; then
|
2011-01-15 16:51:38 +05:30
|
|
|
EXTERNAL_PROPLIB_VALUE="no (using internal copy)"
|
2011-01-14 05:00:49 +05:30
|
|
|
echo "CPPFLAGS += -I\$(TOPDIR)/lib/portableproplib" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += -lpthread" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += -lpthread" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
EXTERNAL_PROPLIB_VALUE=yes
|
|
|
|
echo "USE_EXTERNAL_PROPLIB = 1" >>$CONFIG_MK
|
2011-01-15 16:51:38 +05:30
|
|
|
printf "Checking for portable proplib via pkg-config ... "
|
2011-01-14 05:00:49 +05:30
|
|
|
if ! $PKGCONFIG_BIN --exists proplib; then
|
|
|
|
echo "proplib.pc file not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "found version $($PKGCONFIG_BIN --modversion proplib)."
|
|
|
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags proplib)" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs proplib)" \
|
|
|
|
>>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static proplib)" \
|
|
|
|
>>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
|
|
|
|
#
|
|
|
|
# libarchive >= 2.8.0 with pkg-config support is required.
|
|
|
|
#
|
|
|
|
printf "Checking for libarchive via pkg-config ... "
|
|
|
|
if ! $PKGCONFIG_BIN --exists libarchive; then
|
|
|
|
echo "libarchive.pc file not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "found version $($PKGCONFIG_BIN --modversion libarchive)."
|
2011-01-14 05:00:49 +05:30
|
|
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags libarchive)" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs libarchive)" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static libarchive)" \
|
|
|
|
>>$CONFIG_MK
|
2010-05-20 02:08:27 +05:30
|
|
|
fi
|
|
|
|
|
2011-01-15 15:11:35 +05:30
|
|
|
#
|
|
|
|
# OpenSSL libssl with pkg-config support is required.
|
|
|
|
#
|
|
|
|
printf "Checking for OpenSSL via pkg-config ... "
|
|
|
|
if ! $PKGCONFIG_BIN --exists libssl; then
|
|
|
|
echo "libssl.pc file not found, exiting."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "found version $($PKGCONFIG_BIN --modversion libssl)."
|
|
|
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags libssl)" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs libssl)" >>$CONFIG_MK
|
|
|
|
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static libssl)" \
|
|
|
|
>>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2011-01-15 15:19:35 +05:30
|
|
|
if [ -n "$SILENT" ]; then
|
|
|
|
echo "SILENT = @" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo "SILENT =" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2010-05-20 02:08:27 +05:30
|
|
|
echo
|
|
|
|
echo " XBPS has been configured with the following options:"
|
|
|
|
echo
|
|
|
|
echo " SBINDIR = $SBINDIR"
|
|
|
|
echo " LIBDIR = $LIBDIR"
|
|
|
|
echo " INCLUDEDIR = $INCLUDEDIR"
|
|
|
|
echo " SHAREDIR = $SHAREDIR"
|
|
|
|
echo " MANDIR = $MANDIR"
|
2011-01-15 16:51:38 +05:30
|
|
|
if [ -n "$CFLAGS" ]; then
|
|
|
|
echo " CFLAGS = $CFLAGS"
|
|
|
|
fi
|
|
|
|
if [ -n "$LDFLAGS" ]; then
|
|
|
|
echo " LDFLAGS = $LDFLAGS"
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
echo " Build API documentation = $BUILD_API_DOCS_VALUE"
|
|
|
|
echo " Build programs as PIE = $BUILD_PIE_VAL"
|
|
|
|
echo " Build with debug = $DEBUG"
|
|
|
|
echo " Use external proplib = $EXTERNAL_PROPLIB_VALUE"
|
|
|
|
echo " Use external libfetch = $EXTERNAL_LIBFETCH_VALUE"
|
|
|
|
if [ -n "$HAVE_VISIBILITY" ]; then
|
|
|
|
echo " Symbol visibility = $HAVE_VISIBILITY"
|
|
|
|
fi
|
2010-05-20 02:08:27 +05:30
|
|
|
echo
|
|
|
|
echo " You can now run make && make install clean."
|
|
|
|
echo
|
|
|
|
|
|
|
|
exit 0
|