444 lines
13 KiB
Bash
Executable File
444 lines
13 KiB
Bash
Executable File
#!/bin/sh
|
|
#############################################################################
|
|
##
|
|
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
## All rights reserved.
|
|
## Contact: Nokia Corporation (qt-info@nokia.com)
|
|
##
|
|
## This file is part of the Qt Mobility Components.
|
|
##
|
|
## $QT_BEGIN_LICENSE:LGPL$
|
|
## GNU Lesser General Public License Usage
|
|
## This file may be used under the terms of the GNU Lesser General Public
|
|
## License version 2.1 as published by the Free Software Foundation and
|
|
## appearing in the file LICENSE.LGPL included in the packaging of this
|
|
## file. Please review the following information to ensure the GNU Lesser
|
|
## General Public License version 2.1 requirements will be met:
|
|
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
##
|
|
## In addition, as a special exception, Nokia gives you certain additional
|
|
## rights. These rights are described in the Nokia Qt LGPL Exception
|
|
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
##
|
|
## GNU General Public License Usage
|
|
## Alternatively, this file may be used under the terms of the GNU General
|
|
## Public License version 3.0 as published by the Free Software Foundation
|
|
## and appearing in the file LICENSE.GPL included in the packaging of this
|
|
## file. Please review the following information to ensure the GNU General
|
|
## Public License version 3.0 requirements will be met:
|
|
## http://www.gnu.org/copyleft/gpl.html.
|
|
##
|
|
## Other Usage
|
|
## Alternatively, this file may be used in accordance with the terms and
|
|
## conditions contained in a signed written agreement between you and Nokia.
|
|
##
|
|
##
|
|
##
|
|
##
|
|
##
|
|
## $QT_END_LICENSE$
|
|
##
|
|
#############################################################################
|
|
|
|
# return status of 1 if absolute path as first argument
|
|
# also prints the return status
|
|
isAbsPath() {
|
|
slash=$(echo $1 | cut -c 1)
|
|
if [ "$slash" != "/" ]; then
|
|
echo 0
|
|
return 0
|
|
fi
|
|
echo 1
|
|
return 1
|
|
}
|
|
|
|
# Returns the absolute path for $1 for target $2
|
|
# as an example $2 might have value "maemo5".
|
|
# This is required because when building in scratchbox for
|
|
# maemo we do not want to follow symbolic links that are
|
|
# introduced by scratchbox
|
|
absPath() {
|
|
if [ "$2" = "maemo5" -o "$2" = "maemo6" -o "$2" = "meego" ]; then
|
|
if [ `isAbsPath $1` = '1' ]; then
|
|
echo $1;
|
|
else
|
|
echo >&2 "Relative prefix/bin/lib/header/plugin paths are not supported for Maemo"
|
|
exit 1;
|
|
fi
|
|
else
|
|
PATH=`$relpath/bin/pathhelper $1`
|
|
echo $PATH
|
|
fi
|
|
}
|
|
|
|
|
|
# the current directory (shadow build dir)
|
|
shadowpath=`/bin/pwd`
|
|
# the name of this script
|
|
relconf=`basename $0`
|
|
# the directory of this script is the "source tree"
|
|
relpath=`dirname $0`
|
|
relpath=`(cd "$relpath"; /bin/pwd)`
|
|
|
|
CONFIG_IN="$shadowpath/config.in"
|
|
BUILD_UNITTESTS=
|
|
BUILD_PUBLIC_UNITTESTS=
|
|
BUILD_EXAMPLES=
|
|
BUILD_DEMOS=
|
|
BUILD_DOCS=yes
|
|
BUILD_TOOLS=yes
|
|
RELEASEMODE=
|
|
BUILD_SILENT=
|
|
LINUX_TARGET=
|
|
LANGUAGES=
|
|
QMAKE_CACHE="$shadowpath/.qmake.cache"
|
|
QMAKE_EXEC=qmake
|
|
LIB_PATH="lib"
|
|
BIN_PATH="bin"
|
|
PLUGIN_PATH="plugins"
|
|
PLATFORM_CONFIG=
|
|
MAC_SDK=
|
|
QMKSPEC=
|
|
OS="other"
|
|
# By default, all modules are requested. Reset this later if -modules is supplied
|
|
ORGANIZER_REQUESTED=yes
|
|
TEST_USE_SIMULATOR=
|
|
NFC_SYMBIAN=auto
|
|
MAC_DEPLOY=
|
|
|
|
usage()
|
|
{
|
|
echo "Usage: configure [-prefix <dir>] [headerdir <dir>] [libdir <dir>]"
|
|
echo " [-bindir <dir>] [-tests] [-examples] [-no-docs]"
|
|
echo " [-no-tools] [-debug] [-release] [-silent]"
|
|
echo " [-modules <list>]"
|
|
echo
|
|
echo "Options:"
|
|
echo
|
|
echo "-prefix <dir> ..... This will install everything relative to <dir>"
|
|
echo " (default prefix: $shadowpath/install)"
|
|
echo "-headerdir <dir> .. Header files will be installed to <dir>"
|
|
echo " (default prefix: PREFIX/include)"
|
|
echo "-libdir <dir> ..... Libraries will be installed to <dir>"
|
|
echo " (default: PREFIX/lib)"
|
|
echo "-bindir <dir> ..... Executables will be installed to <dir>"
|
|
echo " (default: PREFIX/bin)"
|
|
echo "-plugindir <dir> .. Plug-ins will be installed to <dir>"
|
|
echo " (default: PREFIX/plugins)"
|
|
echo "-demosdir <dir> ... Demos will be installed to <dir>"
|
|
echo " (default: PREFIX/bin)"
|
|
echo "-examplesdir <dir> Examples will be installed to <dir>"
|
|
echo " (default PREFIX/bin)"
|
|
echo "-debug ............ Build with debugging symbols"
|
|
echo "-release .......... Build without debugging symbols"
|
|
echo "-silent ........... Reduces build output"
|
|
echo "-tests ............ Build unit tests (not build by default)"
|
|
echo " Note, this adds test symbols to all libraries"
|
|
echo " and should not be used for release builds."
|
|
echo "-examples ......... Build example applications"
|
|
echo "-demos ............ Build demo applications"
|
|
echo "-no-docs .......... Do not build documentation (build by default)"
|
|
echo "-no-tools ......... Do not build tools (build by default)"
|
|
echo "-modules <list> ... Restrict list of modules to build (default all supported)"
|
|
echo " Choose from: bearer contacts gallery location publishsubscribe"
|
|
echo " messaging multimedia systeminfo serviceframework"
|
|
echo " sensors versit organizer feedback connectivity"
|
|
echo " Modules should be separated by a space and surrounded"
|
|
echo " by double quotation. If a selected module depends on other modules"
|
|
echo " those modules (and their dependencies) will automatically be enabled."
|
|
echo "-maemo6 ........... Build Qt Mobility for Maemo6 (Harmattan)."
|
|
echo "-maemo5 ........... Build Qt Mobility for Maemo5 (Fremantle)."
|
|
echo "-meego ........... Build Qt Mobility for MeeGo."
|
|
echo "-sdk <sdk> ........ Build using Apple provided SDK <path/to/sdk>."
|
|
echo " example: -sdk /Developer/SDKs/MacOSX10.6.sdk"
|
|
echo "-languages ........ Languages/translations to be installed (e.g.: \"ar de ko\")."
|
|
echo " (default is empty)"
|
|
echo "-qmake-exec <name> Sets custom binary name for qmake binary"
|
|
echo " (default: qmake)"
|
|
echo "-no-nfc-symbian Disables the NFC Sybmian backend."
|
|
# echo "-test-sim Use simulator backend for testing systeminfo"
|
|
# echo "-staticconfig <name>"
|
|
# echo " Avoids running of configuration tests. The default"
|
|
# echo " values are sourced from features/platformconfig/<name>.pri"
|
|
echo "-mac-deploy .... Use this option for deploying QtMobility into Qt for use with macdeployqt tool"
|
|
echo " This overrides any -prefix that may be set."
|
|
echo
|
|
|
|
rm -f "$CONFIG_IN"
|
|
exit 1
|
|
}
|
|
|
|
rm -rf "$QMAKE_CACHE"
|
|
CONFIG_LOG="$shadowpath/config.log"
|
|
rm -rf "$CONFIG_LOG"
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
-h|-help|--help)
|
|
usage
|
|
;;
|
|
-tests)
|
|
BUILD_UNITTESTS="yes"
|
|
;;
|
|
-public-tests-only)
|
|
BUILD_PUBLIC_UNITTESTS="yes"
|
|
;;
|
|
-demos)
|
|
BUILD_DEMOS="yes"
|
|
;;
|
|
-examples)
|
|
BUILD_EXAMPLES="yes"
|
|
;;
|
|
-no-docs)
|
|
BUILD_DOCS=
|
|
;;
|
|
-no-tools)
|
|
BUILD_TOOLS=
|
|
;;
|
|
-debug)
|
|
RELEASEMODE=debug
|
|
;;
|
|
-release)
|
|
RELEASEMODE=release
|
|
;;
|
|
-silent)
|
|
BUILD_SILENT=yes
|
|
;;
|
|
-maemo5)
|
|
LINUX_TARGET=maemo5
|
|
;;
|
|
-maemo6)
|
|
LINUX_TARGET=maemo6
|
|
;;
|
|
-meego)
|
|
LINUX_TARGET=meego
|
|
;;
|
|
-sdk)
|
|
MAC_SDK="$2"
|
|
shift
|
|
;;
|
|
-qmake-exec)
|
|
QMAKE_EXEC="$2"
|
|
shift
|
|
;;
|
|
-staticconfig)
|
|
PLATFORM_CONFIG=$2
|
|
shift
|
|
;;
|
|
-languages)
|
|
LANGUAGES=$2
|
|
shift
|
|
;;
|
|
-test-sim)
|
|
TEST_USE_SIMULATOR="yes"
|
|
;;
|
|
-no-nfc-symbian)
|
|
NFC_SYMBIAN=no
|
|
;;
|
|
-mac-deploy)
|
|
MAC_DEPLOY='yes'
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
usage
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [ -z "$RELEASEMODE" ]; then
|
|
RELEASEMODE="debug"
|
|
fi
|
|
echo "CONFIG += $RELEASEMODE" > "$CONFIG_IN"
|
|
|
|
|
|
if [ -n "$BUILD_SILENT" ]; then
|
|
echo "CONFIG += silent" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
checkostype()
|
|
{
|
|
match="Darwin"
|
|
if [ `uname -s` = "${match}" ]; then
|
|
OS="darwin"
|
|
QMKSPEC="-spec macx-g++"
|
|
if [[ `gcc --version` =~ .*llvm.* ]]; then
|
|
QMKSPEC="-spec macx-llvm"
|
|
else
|
|
QMKSPEC="-spec macx-g++"
|
|
fi
|
|
echo "QMAKESPEC = "$QMKSPEC >> "$CONFIG_IN"
|
|
fi
|
|
}
|
|
|
|
checkostype
|
|
|
|
findUniversal()
|
|
{
|
|
if [ -e "mac.inc" ]; then
|
|
rm mac.inc
|
|
fi
|
|
echo "contains(QT_CONFIG,x86): system(echo CONFIG+=x86 >> mac.inc)" > 2.pro
|
|
echo "contains(QT_CONFIG,ppc): system(echo CONFIG+=ppc >> mac.inc)" >> 2.pro
|
|
echo "contains(QT_CONFIG,ppc64): system(echo CONFIG+=ppc64 >> mac.inc)" >> 2.pro
|
|
echo "contains(QT_CONFIG,x86_64): system(echo CONFIG+=x86_64 >> mac.inc)" >> 2.pro
|
|
SOMETIME=`$QMAKE_EXEC $QMKSPEC 2.pro 2>&1`
|
|
rm 2.pro
|
|
if [ -e "mac.inc" ]; then
|
|
echo "exists(mac.inc): include(mac.inc)" >> "$CONFIG_IN"
|
|
fi
|
|
}
|
|
|
|
if [ "$OS" = "darwin" ] ; then
|
|
findUniversal
|
|
fi
|
|
|
|
if [ -n "$MAC_SDK" ]; then
|
|
QMAKE_MAC_SDK="$MAC_SDK"
|
|
echo "QMAKE_MAC_SDK = $QMAKE_MAC_SDK" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
if [ -z "$BUILD_UNITTESTS" ]; then
|
|
echo "build_unit_tests = no" >> "$CONFIG_IN"
|
|
else
|
|
echo "build_unit_tests = yes" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
if [ -z "$BUILD_PUBLIC_UNITTESTS" ]; then
|
|
echo "build_public_unit_tests = no" >> "$CONFIG_IN"
|
|
else
|
|
echo "build_public_unit_tests = yes" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
if [ -z "$BUILD_EXAMPLES" ]; then
|
|
echo "build_examples = no" >> "$CONFIG_IN"
|
|
else
|
|
echo "build_examples = yes" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
if [ -z "$BUILD_DEMOS" ]; then
|
|
echo "build_demos = no" >> "$CONFIG_IN"
|
|
else
|
|
echo "build_demos = yes" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
if [ -z "$BUILD_DOCS" ]; then
|
|
echo "build_docs = no" >> "$CONFIG_IN"
|
|
else
|
|
echo "build_docs = yes" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
if [ -z "$BUILD_TOOLS" ]; then
|
|
echo "build_tools = no" >> "$CONFIG_IN"
|
|
else
|
|
echo "build_tools = yes" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
if [ -z "$TEST_USE_SIMULATOR" ]; then
|
|
echo "test_use_sim = no" >> "$CONFIG_IN"
|
|
else
|
|
echo "test_use_sim = yes" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
#process languages
|
|
if [ -z "LANGUAGES" ]; then
|
|
echo "selected_languages =" >> "$CONFIG_IN"
|
|
else
|
|
echo "selected_languages = $LANGUAGES" >> "$CONFIG_IN"
|
|
fi
|
|
|
|
|
|
echo "Configuring Qt MultimediaKit"
|
|
echo
|
|
|
|
WHICH="$relpath/config.tests/tools/which.test"
|
|
|
|
printf "Checking available Qt"
|
|
if ! "$WHICH" $QMAKE_EXEC 2>/dev/null 1>&2; then
|
|
QMAKE_EXEC_ALTERNATIVE=
|
|
if "$WHICH" qmake4 2>/dev/null 1>&2; then
|
|
QMAKE_EXEC_ALTERNATIVE=qmake4
|
|
elif "$WHICH" qmake-qt4 2>/dev/null 1>&2; then
|
|
QMAKE_EXEC_ALTERNATIVE=qmake-qt4
|
|
fi
|
|
|
|
if [ -z "$QMAKE_EXEC_ALTERNATIVE" ]; then
|
|
printf " ... Not found\n\n" >&2
|
|
echo >&2 "Cannot find "$QMAKE_EXEC" in your PATH.";
|
|
echo >&2 "Aborting."
|
|
exit 1
|
|
else
|
|
QMAKE_EXEC="$QMAKE_EXEC_ALTERNATIVE"
|
|
fi
|
|
fi
|
|
|
|
#we found a qmake binary
|
|
printf " ... "
|
|
$QMAKE_EXEC -query QT_VERSION
|
|
|
|
# find out which make we want to use
|
|
MAKE=
|
|
for m in make gmake; do
|
|
if "$WHICH" $m >/dev/null 2>&1; then
|
|
MAKE=`$WHICH $m`
|
|
break
|
|
fi
|
|
done
|
|
if [ -z "$MAKE" ]; then
|
|
echo >&2 "Cannot find 'make' or 'gmake' in your PATH";
|
|
echo >&2 "Aborting."
|
|
exit 1
|
|
fi
|
|
|
|
compileTest()
|
|
{
|
|
printf "Checking $1"
|
|
CURRENT_PWD=`pwd`
|
|
|
|
if [ "$shadowpath" = "$relpath" ]; then
|
|
#doing source tree build
|
|
cd "$relpath/config.tests/$2"
|
|
rm -rf ./$2
|
|
else
|
|
#using shadow build
|
|
rm -rf config.tests/$2
|
|
mkdir -p config.tests/$2
|
|
cd config.tests/$2
|
|
fi
|
|
|
|
$QMAKE_EXEC $QMKSPEC "$relpath/config.tests/$2/$2.pro" 2>> "$CONFIG_LOG" >> "$CONFIG_LOG"
|
|
printf " ."
|
|
"$MAKE" clean >> "$CONFIG_LOG"
|
|
printf "."
|
|
"$MAKE" >> "$CONFIG_LOG" 2>&1
|
|
printf ". "
|
|
if [ -e ./$2 ]; then
|
|
echo "OK"
|
|
echo "$2_enabled = yes" >> "$CONFIG_IN"
|
|
else
|
|
echo "Not Found"
|
|
echo "$2_enabled = no" >> "$CONFIG_IN"
|
|
fi
|
|
cd "$CURRENT_PWD"
|
|
}
|
|
|
|
if [ -z "$PLATFORM_CONFIG" ]; then
|
|
#compile tests
|
|
compileTest "Gstreamer Photography" gstreamer-photography
|
|
compileTest "Gstreamer AppSrc" gstreamer-appsrc
|
|
compileTest "Pulse Audio" pulseaudio
|
|
else
|
|
echo "Skipping configure tests"
|
|
echo "Loading ... features/platformconfig/$PLATFORM_CONFIG.pri"
|
|
if [ ! -f "$relpath/features/platformconfig/$PLATFORM_CONFIG.pri" ]; then
|
|
echo "Invalid platform configuration $PLATFORM_CONFIG.pri"
|
|
exit 1;
|
|
else
|
|
echo "include(\$\${QT_MOBILITY_SOURCE_TREE}/features/platformconfig/$PLATFORM_CONFIG.pri)" >> "$CONFIG_IN"
|
|
fi
|
|
fi
|
|
|
|
mv "$CONFIG_IN" config.pri
|
|
|