Skip to content

ENT-12600: configure: Documented script #1777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 77 additions & 91 deletions build-scripts/configure
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#!/bin/sh -x
#!/bin/sh


. `dirname "$0"`/functions
. "$(dirname "$0")"/functions
. detect-environment
. compile-options
. version

case "$PROJECT" in
community) NOVA=no ;;
nova) NOVA=yes ;;
*) fatal "Unknown project: $PROJECT" ;;
community)
NOVA=no
;;
nova)
NOVA=yes
;;
*)
fatal "$(basename "$0"): Unknown project: $PROJECT"
;;
esac


Expand All @@ -21,119 +27,99 @@ if [ $EMBEDDED_DB = lmdb ]
then
var_append ARGS "--with-lmdb=$P"
fi

for dep in "pthreads-w32" "ldap" "libxml2" "libyaml" "librsync" "leech" "libacl" "libvirt" "libcurl"
do
case "$DEPS" in
*"$dep"*)
var_append ARGS "--with-$dep=$P"
;;
*)
var_append ARGS "--without-$dep"
;;
esac
done

case "$DEPS" in
*pthreads-w32*) var_append ARGS "--with-pthreads=$P" ;;
esac
case "$DEPS" in
*openldap*) var_append ARGS "--with-ldap=$P" ;;
*) var_append ARGS "--without-ldap" ;;
esac
case "$DEPS" in
*libxml2*) var_append ARGS "--with-libxml2=$P" ;;
*) var_append ARGS "--without-libxml2" ;;
esac
case "$DEPS" in
*libyaml*) var_append ARGS "--with-libyaml=$P" ;;
*) var_append ARGS "--without-libyaml" ;;
esac
case "$DEPS" in
*librsync*) var_append ARGS "--with-librsync=$P" ;;
*) var_append ARGS "--without-librsync" ;;
esac
case "$DEPS" in
*leech*) var_append ARGS "--with-leech=$P" ;;
*) var_append ARGS "--without-leech" ;;
esac
case "$DEPS" in
*postgresql*) var_append ARGS "--with-postgresql=$P --without-mysql" ;;
*) var_append ARGS "--without-sql" ;;
esac
case "$DEPS" in
*libacl*) var_append ARGS "--with-libacl=$P" ;;
*) var_append ARGS "--without-libacl" ;;
esac
case "$DEPS" in
*libvirt*) var_append ARGS "--with-libvirt=$P" ;;
*) var_append ARGS "--without-libvirt" ;;
esac
# both libcurl or libcurl-hub are valid
case "$DEPS" in
*libcurl*) var_append ARGS "--with-libcurl=$P" ;;
*) var_append ARGS "--without-libcurl" ;;
*postgresql*)
var_append ARGS "--with-postgresql=$P --without-mysql"
;;
*)
var_append ARGS "--without-sql"
;;
esac

case "$ROLE" in
hub) var_append ARGS "--with-cfmod --with-enterprise-api --with-postgresql=$P" ;;
agent) var_append ARGS "--without-cfmod --without-postgresql" ;;
*) fatal "Unknown ROLE: $ROLE" ;;
hub)
var_append ARGS "--with-cfmod --with-enterprise-api --with-postgresql=$P"
;;
agent)
var_append ARGS "--without-cfmod --without-postgresql"
;;
*)
fatal "$(basename "$0"): Unknown ROLE: $ROLE"
;;
esac

case "$WITH_SYSTEMD" in
yes) var_append ARGS "--with-systemd-service" ;;
*) var_append ARGS "--without-systemd-service" ;;
yes)
var_append ARGS "--with-systemd-service"
;;
*)
var_append ARGS "--without-systemd-service"
;;
esac

# RHEL 8 requires an SELinux policy
if [ "x$OS" = "xrhel" ] && [ "${VER%\.*}" -gt "7" ]; then
if [ "$OS" = rhel ] && [ "${VER%\.*}" -gt "7" ]; then
var_append ARGS "--with-selinux-policy"
fi

# Cross-compiling Windows?
case "$ARCH-${OS_FAMILY}" in
x86-mingw) var_append ARGS "--host=i686-w64-mingw32" ;;
x64-mingw) var_append ARGS "--host=x86_64-w64-mingw32" ;;
x86-mingw)
var_append ARGS "--host=i686-w64-mingw32"
;;
x64-mingw)
var_append ARGS "--host=x86_64-w64-mingw32"
;;
esac


case "$BUILD_TYPE" in

RELEASE)
CFLAGS="-g2 -O2 -DNDEBUG $CFLAGS"
;;
DEBUG)
ARGS="$ARGS --enable-debug"
# Override the default "-g3 -O0" that comes with ./configure --enable-debug
# in order to reduce the size of the packages
CFLAGS="-g2 -O1 $CFLAGS"
;;
CODE_COVERAGE)
ARGS="$ARGS --enable-debug"
# lcov is not found in Windows and other platforms
case "${OS}-${OS_VERSION}" in
mingw*)
RELEASE)
CFLAGS="-g2 -O2 -DNDEBUG $CFLAGS"
;;
DEBUG)
ARGS="$ARGS --enable-debug"
# Override the default "-g3 -O0" that comes with ./configure --enable-debug
# in order to reduce the size of the packages
CFLAGS="-g2 -O1 $CFLAGS"
;;
*)
echo "$(basename "$0"): Error: Unknown build type: $BUILD_TYPE"
exit 42
;;
hpux*)
;;
solaris*)
;;
rhel-4.*)
;;
aix*)
;;
*)
ARGS="$ARGS --enable-coverage"
;;
esac
;;
*)
echo "Unknown build type: $BUILD_TYPE"
exit 42
;;
esac

if [ "x$OS" = "xsolaris" ]
if [ "$OS" = solaris ]
then
export PKG_CONFIG_PATH="$BUILDPREFIX/lib/pkgconfig"
fi

echo "$(basename "$0"): Debug: running configure on core repo..."
( cd "$BASEDIR"/core && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" )

( cd $BASEDIR/core && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS )

if [ "x$NOVA" = "xyes" ]
if [ "$NOVA" = yes ]
then
( cd $BASEDIR/enterprise && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS )
if [ "x$ROLE" = "xhub" ]
echo "$(basename "$0"): Debug: running configure on enterprise repo..."
( cd "$BASEDIR"/enterprise && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" )
if [ "$ROLE" = hub ]
then
( cd $BASEDIR/nova && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS )
echo "$(basename "$0"): Debug: running configure on hub repo..."
( cd "$BASEDIR"/nova && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" )
fi
fi

( cd $BASEDIR/masterfiles && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS )
echo "$(basename "$0"): Debug: running configure on masterfiles repo..."
( cd "$BASEDIR"/masterfiles && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" )
Loading