We recognize the VALAC environment variable, or you can specify VALAC=whatever on the ./configure command line. Also, this cleans up some of the configure logic to be a little easier to read and edit.
156 lines
3.8 KiB
Bash
Executable file
156 lines
3.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Copyright 2012 Yorba Foundation
|
|
#
|
|
# This software is licensed under the GNU LGPL (version 2.1 or later).
|
|
# See the COPYING file in this distribution.
|
|
|
|
DEFAULT_PREFIX="/usr/local"
|
|
|
|
PREFIX=$DEFAULT_PREFIX
|
|
|
|
configure_help() {
|
|
cat <<- EOT
|
|
Usage:
|
|
./configure [OPTIONS]...
|
|
|
|
Options:
|
|
-h, --help Print this help and exit.
|
|
--prefix=PREFIX Prepend PREFIX to program installation paths.
|
|
[$DEFAULT_PREFIX]
|
|
--debug Build for debugging.
|
|
|
|
--enable-ref-tracking
|
|
Enable reference tracking which is dumped to stdout when the program exits.
|
|
--disable-schemas-compile
|
|
Disable compiling the GSettings schema.
|
|
--disable-desktop-update
|
|
Disable desktop database update.
|
|
--disable-icon-update
|
|
Disable icon cache update.
|
|
|
|
Some influential environment variables:
|
|
PKG_CONFIG_PATH Adds directories to pkg-config's search path.
|
|
PKG_CONFIG_LIBDIR Overrides pkg-config's built-in search path.
|
|
|
|
VALAC Name of the vala compiler to use, e.g. "valac-0.18".
|
|
|
|
EOT
|
|
}
|
|
|
|
abort() {
|
|
printf "%s: Invalid argument %s\n" $0 $1
|
|
configure_help
|
|
exit 1
|
|
}
|
|
|
|
while [ $# != 0 ]
|
|
do
|
|
if [[ "$1" = *=* ]]
|
|
then
|
|
option=${1%%=*}
|
|
value=${1#*=}
|
|
else
|
|
option=$1
|
|
value=
|
|
fi
|
|
|
|
case $option in
|
|
-h | --help) configure_help
|
|
exit 0
|
|
;;
|
|
|
|
--prefix) [ ! $value ] && abort $1
|
|
CMDLINE="${CMDLINE} -DCMAKE_INSTALL_PREFIX=${value}"
|
|
;;
|
|
|
|
--debug)
|
|
CMDLINE="${CMDLINE} -DDEBUG=ON"
|
|
;;
|
|
|
|
--enable-ref-tracking)
|
|
CMDLINE="${CMDLINE} -DREF_TRACKING=ON"
|
|
;;
|
|
|
|
--disable-schemas-compile)
|
|
CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE=OFF"
|
|
CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE_IN_PLACE=OFF"
|
|
;;
|
|
|
|
--disable-icon-update)
|
|
CMDLINE="${CMDLINE} -DICON_UPDATE=OFF"
|
|
;;
|
|
|
|
--disable-desktop-update)
|
|
CMDLINE="${CMDLINE} -DDESKTOP_UPDATE=OFF"
|
|
;;
|
|
|
|
VALAC) [ ! $value ] && abort $1
|
|
VALAC=$value
|
|
;;
|
|
|
|
*) abort $option
|
|
;;
|
|
esac
|
|
|
|
shift
|
|
done
|
|
|
|
# Verify use supplied vala executable
|
|
if [ -n "$VALAC" ]
|
|
then
|
|
VALA_EXECUTABLE=`type -p "$VALAC"`
|
|
|
|
if [ -z "$VALA_EXECUTABLE" ]
|
|
then
|
|
printf "$VALAC is not an executable program.\n"
|
|
exit 1
|
|
fi
|
|
|
|
CMDLINE="${CMDLINE} -DVALA_EXECUTABLE='$VALA_EXECUTABLE'"
|
|
fi
|
|
|
|
# Verify cmake is installed
|
|
# TODO: Check for minimum version number
|
|
if ! cmake --version
|
|
then
|
|
printf "cmake must be installed to configure and build.\n"
|
|
exit 1
|
|
fi
|
|
|
|
# Simple check to verify this script is running in the root of the source tree
|
|
if ! [ -e Makefile.in ]
|
|
then
|
|
printf "configure script must be executed in source directory (Makefile.in not found).\n"
|
|
exit 1
|
|
fi
|
|
|
|
# Remove existing Makefile so it's not left around if configure fails
|
|
rm -f Makefile
|
|
|
|
# Remove the build folder to force Cmake to update its cache.
|
|
rm -fr build
|
|
|
|
if ! mkdir -p build
|
|
then
|
|
printf "Unable to create build directory.\n"
|
|
exit 1
|
|
fi
|
|
|
|
cd build
|
|
|
|
if ! cmake $CMDLINE ..
|
|
then
|
|
printf "Unable to prepare build directory.\n"
|
|
exit 1
|
|
fi
|
|
|
|
cd ..
|
|
|
|
if ! cp -f Makefile.in Makefile
|
|
then
|
|
printf "Unable to prepare Makefile.\n"
|
|
exit 1
|
|
fi
|
|
|
|
printf "Configured. Type 'make' to build, 'make install' to install.\n"
|