From e6053aa5475e03568f39e4967dc49ef4aba3c5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 3 Aug 2015 17:04:31 +0200 Subject: Make build system architecture agnostic to remove Android special case --- configure | 207 +++++++++++++++++--------------------------------------------- 1 file changed, 56 insertions(+), 151 deletions(-) (limited to 'configure') diff --git a/configure b/configure index c1f7f6da17..6fbaa9f7f8 100755 --- a/configure +++ b/configure @@ -1,89 +1,63 @@ #!/usr/bin/env bash -set -e -set -o pipefail +set -euo pipefail CONFIG_FILE=$1 -if [ `uname -s` = 'Darwin' ]; then - MASON_PLATFORM=${MASON_PLATFORM:-osx} +if [ -z ${CONFIG_FILE} ]; then + abort 'You need to specify an output path for the configuration file' fi -function finish { - >&2 echo -en "\033[0m"; -} -trap finish EXIT +# Make sure we clear all colors +trap '>&2 echo -en "\033[0m"' TERM INT + +function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } +function info { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } +function warn { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } # Install mason -git submodule update --init .mason export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" -case ${MASON_PLATFORM} in - 'ios') - SQLITE_VERSION=system - LIBUV_VERSION=0.10.28 - ZLIB_VERSION=system - BOOST_VERSION=system - ;; - 'android') - SQLITE_VERSION=3.8.8.1 - LIBPNG_VERSION=1.6.16 - LIBJPEG_VERSION=v9a - OPENSSL_VERSION=1.0.1l - LIBCURL_VERSION=7.40.0 - LIBUV_VERSION=1.4.0 - ZLIB_VERSION=system - BOOST_VERSION=1.57.0 - NUNICODE_VERSION=1.5.1 - LIBZIP_VERSION=0.11.2 - ;; - *) - GLFW_VERSION=3.1 - SQLITE_VERSION=3.8.8.1 - LIBPNG_VERSION=1.6.16 - LIBJPEG_VERSION=v9a - LIBCURL_VERSION=system - LIBUV_VERSION=0.10.28 - ZLIB_VERSION=system - BOOST_VERSION=1.57.0 - BOOST_PROGRAM_OPTIONS_VERSION=1.57.0 - NUNICODE_VERSION=1.5.1 - LIBZIP_VERSION=0.11.2 - ;; -esac - -if [ ${MASON_PLATFORM} == 'linux' ] ; then - MESA_VERSION=10.4.3 - mason install mesa ${MESA_VERSION} - export PKG_CONFIG_PATH=`mason prefix mesa ${MESA_VERSION}`/lib/pkgconfig -fi +# You can override the function for a particular set of flags by defining a +# print_XXX_flags function in your dependencies.sh file +function print_flags { + local NAME=$1; shift + if [ "$(type -t print_${NAME}_flags)" = 'function' ]; then + print_${NAME}_flags + else + local VERSION=`echo "${NAME}_VERSION" | tr "[:lower:]" "[:upper:]"` + if [ ! -z ${!VERSION:-} ] ; then + mason install ${NAME} ${!VERSION} + for FLAGS in "$@" ; do + CONFIG+=" '${NAME}_${FLAGS}%': $(quote_flags $(mason ${FLAGS} ${NAME} ${!VERSION})),"$LN + done + else + warn "* Not using ${NAME}" + fi + fi +} -function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } +function print_default_flags { + : +} -if [ -z ${CONFIG_FILE} ]; then - abort 'You need to specify an output path for the configuration file' -fi +function print_opengl_flags { + CONFIG+=" 'opengl_cflags%': [],"$LN + CONFIG+=" 'opengl_ldflags%': [],"$LN +} -if [[ ${MASON_PLATFORM} = 'android' && -z ${MASON_ANDROID_ABI} ]]; then - abort 'You need to specify an ABI for android platforms' +# Load dependencies +source scripts/${MASON_PLATFORM}/configure.sh +if [ -e scripts/${MASON_PLATFORM}/${MASON_PLATFORM_VERSION}/configure.sh ]; then + source scripts/${MASON_PLATFORM}/${MASON_PLATFORM_VERSION}/configure.sh fi -echo -n "MASON_PLATFORM=${MASON_PLATFORM} " -if [ ${MASON_PLATFORM} = 'android' ]; then echo -n "MASON_ANDROID_ABI=${MASON_ANDROID_ABI} " ; fi -echo $0 $@ - PYTHON=`which python || abort 'Cannot find python'` >&2 echo -en "\033[1m\033[32m* Using " >&2 ${PYTHON} --version >&2 echo -en "\033[0m"; -PKG_CONFIG=`which pkg-config || abort 'Cannot find pkg-config'` - ->&2 echo -en "\033[1m\033[32m* Using pkg-config " ->&2 ${PKG_CONFIG} --version ->&2 echo -en "\033[0m"; - function quote_flags { ${PYTHON} -c "import sys, re; print filter(None, re.split('(? ${CONFIG_FILE} cat ${CONFIG_FILE} -- cgit v1.2.1