| 1 |
#!/bin/sh |
| 2 |
############################################################################# |
| 3 |
## |
| 4 |
## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
| 5 |
## All rights reserved. |
| 6 |
## Contact: Nokia Corporation (qt-info@nokia.com) |
| 7 |
## |
| 8 |
## This file is part of the Qt Mobility Components. |
| 9 |
## |
| 10 |
## $QT_BEGIN_LICENSE:LGPL$ |
| 11 |
## No Commercial Usage |
| 12 |
## This file contains pre-release code and may not be distributed. |
| 13 |
## You may use this file in accordance with the terms and conditions |
| 14 |
## contained in the Technology Preview License Agreement accompanying |
| 15 |
## this package. |
| 16 |
## |
| 17 |
## GNU Lesser General Public License Usage |
| 18 |
## Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 |
## General Public License version 2.1 as published by the Free Software |
| 20 |
## Foundation and appearing in the file LICENSE.LGPL included in the |
| 21 |
## packaging of this file. Please review the following information to |
| 22 |
## ensure the GNU Lesser General Public License version 2.1 requirements |
| 23 |
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 24 |
## |
| 25 |
## In addition, as a special exception, Nokia gives you certain additional |
| 26 |
## rights. These rights are described in the Nokia Qt LGPL Exception |
| 27 |
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 28 |
## |
| 29 |
## If you have questions regarding the use of this file, please contact |
| 30 |
## Nokia at qt-info@nokia.com. |
| 31 |
## |
| 32 |
## |
| 33 |
## |
| 34 |
## |
| 35 |
## |
| 36 |
## |
| 37 |
## |
| 38 |
## |
| 39 |
## $QT_END_LICENSE$ |
| 40 |
## |
| 41 |
############################################################################# |
| 42 |
|
| 43 |
# the current directory (shadow build dir) |
| 44 |
shadowpath=`/bin/pwd` |
| 45 |
# the name of this script |
| 46 |
relconf=`basename $0` |
| 47 |
# the directory of this script is the "source tree" |
| 48 |
relpath=`dirname $0` |
| 49 |
relpath=`(cd "$relpath"; /bin/pwd)` |
| 50 |
|
| 51 |
CONFIG_IN="$shadowpath/config.in" |
| 52 |
QT_MOBILITY_PREFIX=$shadowpath/install |
| 53 |
QT_MOBILITY_INCLUDE= |
| 54 |
QT_MOBILITY_LIB= |
| 55 |
QT_MOBILITY_BIN= |
| 56 |
BUILD_UNITTESTS= |
| 57 |
BUILD_EXAMPLES= |
| 58 |
BUILD_DOCS=yes |
| 59 |
RELEASEMODE= |
| 60 |
BUILD_SILENT= |
| 61 |
LINUX_TARGET= |
| 62 |
QMAKE_CACHE="$shadowpath/.qmake.cache" |
| 63 |
LIB_PATH="lib" |
| 64 |
BIN_PATH="bin" |
| 65 |
MAC_SDK= |
| 66 |
MOBILITY_MODULES="bearer location contacts multimedia publishsubscribe versit messaging systeminfo serviceframework sensors" |
| 67 |
MOBILITY_MODULES_UNPARSED= |
| 68 |
|
| 69 |
usage() |
| 70 |
{ |
| 71 |
echo "Usage: configure [-prefix <dir>] [headerdir <dir>] [libdir <dir>]" |
| 72 |
echo " [-bindir <dir>] [-tests] [-examples] [-no-docs]" |
| 73 |
echo " [-debug] [-release] [-silent] [-modules <list>]" |
| 74 |
echo |
| 75 |
echo "Options:" |
| 76 |
echo |
| 77 |
echo "-prefix <dir> ..... This will install everything relative to <dir>" |
| 78 |
echo " (default prefix: $shadowpath/install)" |
| 79 |
echo "-headerdir <dir> .. Header files will be installed to <dir>" |
| 80 |
echo " (default prefix: PREFIX/include)" |
| 81 |
echo "-libdir <dir> ..... Libraries will be installed to <dir>" |
| 82 |
echo " (default PREFIX/lib)" |
| 83 |
echo "-bindir <dir> ..... Executables will be installed to <dir>" |
| 84 |
echo " (default PREFIX/bin)" |
| 85 |
echo "-debug ............ Build with debugging symbols" |
| 86 |
echo "-release .......... Build without debugging symbols" |
| 87 |
echo "-silent ........... Reduces build output" |
| 88 |
echo "-tests ............ Build unit tests (not build by default)" |
| 89 |
echo " Note, this adds test symbols to all libraries" |
| 90 |
echo " and should not be used for release builds." |
| 91 |
echo "-examples ......... Build example applications" |
| 92 |
echo "-no-docs .......... Do not build documentation (build by default)" |
| 93 |
echo "-modules <list> ... Restrict list of modules to build (default all supported)" |
| 94 |
echo " Choose from: bearer contacts location publishsubscribe" |
| 95 |
echo " messaging multimedia systeminfo serviceframework versit" |
| 96 |
echo " Modules should be separated by a space and surrounded" |
| 97 |
echo " by double quotation. If a" |
| 98 |
echo " selected module depends on other modules dependencies" |
| 99 |
echo " will automatically be enabled." |
| 100 |
echo "-maemo6 ........... Build Qt Mobility for Maemo6 (Harmattan)." |
| 101 |
echo "-maemo5 ........... Build Qt Mobility for Maemo5 (Freemantle)." |
| 102 |
echo "-sdk <sdk>..........Build using Apple provided SDK <path/to/sdk>." |
| 103 |
echo " example: -sdk /Developer/SDKs/MacOSX10.6.sdk" |
| 104 |
echo |
| 105 |
|
| 106 |
rm -f "$CONFIG_IN" |
| 107 |
exit 1 |
| 108 |
} |
| 109 |
|
| 110 |
rm -rf "$QMAKE_CACHE" |
| 111 |
CONFIG_LOG="$shadowpath/config.log" |
| 112 |
rm -rf "$CONFIG_LOG" |
| 113 |
|
| 114 |
while [ "$#" -gt 0 ]; do |
| 115 |
case "$1" in |
| 116 |
-h|-help|--help) |
| 117 |
usage |
| 118 |
;; |
| 119 |
-headerdir) |
| 120 |
QT_MOBILITY_INCLUDE="$2" |
| 121 |
shift |
| 122 |
;; |
| 123 |
-libdir) |
| 124 |
QT_MOBILITY_LIB="$2" |
| 125 |
shift |
| 126 |
;; |
| 127 |
--prefix|-prefix) |
| 128 |
QT_MOBILITY_PREFIX="$2" |
| 129 |
shift |
| 130 |
;; |
| 131 |
-bindir) |
| 132 |
QT_MOBILITY_BIN="$2" |
| 133 |
shift |
| 134 |
;; |
| 135 |
-tests) |
| 136 |
BUILD_UNITTESTS="yes" |
| 137 |
;; |
| 138 |
-examples) |
| 139 |
BUILD_EXAMPLES="yes" |
| 140 |
;; |
| 141 |
-no-docs) |
| 142 |
BUILD_DOCS= |
| 143 |
;; |
| 144 |
-debug) |
| 145 |
RELEASEMODE=debug |
| 146 |
;; |
| 147 |
-release) |
| 148 |
RELEASEMODE=release |
| 149 |
;; |
| 150 |
-silent) |
| 151 |
BUILD_SILENT=yes |
| 152 |
;; |
| 153 |
-maemo5) |
| 154 |
LINUX_TARGET=maemo5 |
| 155 |
;; |
| 156 |
-maemo6) |
| 157 |
LINUX_TARGET=maemo6 |
| 158 |
;; |
| 159 |
-sdk) |
| 160 |
MAC_SDK="$2" |
| 161 |
shift |
| 162 |
;; |
| 163 |
-modules) |
| 164 |
MOBILITY_MODULES_UNPARSED=$2 |
| 165 |
#reset default selection |
| 166 |
MOBILITY_MODULES= |
| 167 |
for m in $MOBILITY_MODULES_UNPARSED; do |
| 168 |
case "$m" in |
| 169 |
bearer|contacts|location|messaging|multimedia|publishsubscribe|serviceframework|systeminfo|versit|sensors) |
| 170 |
MOBILITY_MODULES="$MOBILITY_MODULES $m"; |
| 171 |
;; |
| 172 |
*) |
| 173 |
echo "Unknown module: $m" |
| 174 |
echo |
| 175 |
usage |
| 176 |
;; |
| 177 |
|
| 178 |
esac |
| 179 |
done |
| 180 |
if [ -z "$MOBILITY_MODULES" ]; then |
| 181 |
echo "List of selected modules is empty." |
| 182 |
echo |
| 183 |
usage |
| 184 |
fi |
| 185 |
shift |
| 186 |
;; |
| 187 |
*) |
| 188 |
echo "Unknown option: $1" |
| 189 |
usage |
| 190 |
;; |
| 191 |
esac |
| 192 |
shift |
| 193 |
done |
| 194 |
|
| 195 |
findframeworks() |
| 196 |
{ |
| 197 |
# figure out if Qt was built with frameworks |
| 198 |
# if so, install in the correct place. |
| 199 |
# and fix rpath |
| 200 |
echo "contains(QT_CONFIG,qt_framework):message(1)" > 1.pro |
| 201 |
SOMETHING=`qmake 1.pro 2>&1` |
| 202 |
if [ "$SOMETHING" = "Project MESSAGE: 1" ]; then |
| 203 |
LIB_PATH="Library/Frameworks" |
| 204 |
BIN_PATH="Applications" |
| 205 |
fi |
| 206 |
rm 1.pro |
| 207 |
} |
| 208 |
|
| 209 |
findframeworks |
| 210 |
|
| 211 |
if [ -n "$BUILD_SILENT" ]; then |
| 212 |
echo "CONFIG += silent" > "$CONFIG_IN" |
| 213 |
fi |
| 214 |
|
| 215 |
if [ -z "$RELEASEMODE" ]; then |
| 216 |
RELEASEMODE="debug" |
| 217 |
fi |
| 218 |
echo "CONFIG += $RELEASEMODE" >> "$CONFIG_IN" |
| 219 |
|
| 220 |
#do we build for Maemo? |
| 221 |
if [ -n "$LINUX_TARGET" ]; then |
| 222 |
if [ "$LINUX_TARGET" = "maemo5" ]; then |
| 223 |
echo "CONFIG+=maemo5" >> "$CONFIG_IN" |
| 224 |
elif [ "$LINUX_TARGET" = "maemo6" ]; then |
| 225 |
echo "CONFIG+=maemo6" >> "$CONFIG_IN" |
| 226 |
fi |
| 227 |
fi |
| 228 |
|
| 229 |
#process PREFIX |
| 230 |
if [ -d "$QT_MOBILITY_PREFIX" ]; then |
| 231 |
QT_MOBILITY_PREFIX=`(cd "$QT_MOBILITY_PREFIX"; /bin/pwd)` |
| 232 |
else |
| 233 |
mkdir -p "$QT_MOBILITY_PREFIX" |
| 234 |
absPath=`(cd "$QT_MOBILITY_PREFIX"; /bin/pwd)` |
| 235 |
rm -rf "$QT_MOBILITY_PREFIX" |
| 236 |
QT_MOBILITY_PREFIX="$absPath" |
| 237 |
fi |
| 238 |
echo "QT_MOBILITY_PREFIX = $QT_MOBILITY_PREFIX" >> "$CONFIG_IN" |
| 239 |
|
| 240 |
#process include path |
| 241 |
if [ -z "$QT_MOBILITY_INCLUDE" ]; then |
| 242 |
QT_MOBILITY_INCLUDE="$QT_MOBILITY_PREFIX/include" |
| 243 |
elif [ -d "$QT_MOBILITY_INCLUDE" ]; then |
| 244 |
QT_MOBILITY_INCLUDE=`(cd "$QT_MOBILITY_INCLUDE"; /bin/pwd)` |
| 245 |
else |
| 246 |
mkdir -p "$QT_MOBILITY_INCLUDE" |
| 247 |
absPath=`(cd "$QT_MOBILITY_INCLUDE"; /bin/pwd)` |
| 248 |
rm -rf "$QT_MOBILITY_INCLUDE" |
| 249 |
QT_MOBILITY_INCLUDE="$absPath" |
| 250 |
fi |
| 251 |
echo "QT_MOBILITY_INCLUDE = $QT_MOBILITY_INCLUDE" >> "$CONFIG_IN" |
| 252 |
|
| 253 |
|
| 254 |
#process library path |
| 255 |
if [ -z "$QT_MOBILITY_LIB" ]; then |
| 256 |
QT_MOBILITY_LIB="$QT_MOBILITY_PREFIX/$LIB_PATH" |
| 257 |
elif [ -d "$QT_MOBILITY_LIB" ]; then |
| 258 |
QT_MOBILITY_LIB=`(cd "$QT_MOBILITY_LIB"; /bin/pwd)` |
| 259 |
else |
| 260 |
mkdir -p "$QT_MOBILITY_LIB" |
| 261 |
absPath=`(cd "$QT_MOBILITY_LIB"; /bin/pwd)` |
| 262 |
rm -rf "$QT_MOBILITY_LIB" |
| 263 |
QT_MOBILITY_LIB="$absPath" |
| 264 |
fi |
| 265 |
echo "QT_MOBILITY_LIB = $QT_MOBILITY_LIB" >> "$CONFIG_IN" |
| 266 |
|
| 267 |
#process binary path |
| 268 |
if [ -z "$QT_MOBILITY_BIN" ]; then |
| 269 |
QT_MOBILITY_BIN="$QT_MOBILITY_PREFIX/$BIN_PATH" |
| 270 |
elif [ -d "$QT_MOBILITY_BIN" ]; then |
| 271 |
QT_MOBILITY_BIN=`(cd "$QT_MOBILITY_BIN"; /bin/pwd)` |
| 272 |
else |
| 273 |
mkdir -p "$QT_MOBILITY_BIN" |
| 274 |
absPath=`(cd "$QT_MOBILITY_BIN"; /bin/pwd)` |
| 275 |
rm -rf "$QT_MOBILITY_BIN" |
| 276 |
QT_MOBILITY_BIN="$absPath" |
| 277 |
fi |
| 278 |
echo "QT_MOBILITY_BIN = $QT_MOBILITY_BIN" >> "$CONFIG_IN" |
| 279 |
|
| 280 |
echo "QT_MOBILITY_SOURCE_TREE = $relpath" >> "$QMAKE_CACHE" |
| 281 |
echo "QT_MOBILITY_BUILD_TREE = $shadowpath" >> "$QMAKE_CACHE" |
| 282 |
|
| 283 |
if [ -n "$MAC_SDK" ]; then |
| 284 |
QMAKE_MAC_SDK="$MAC_SDK" |
| 285 |
echo "QMAKE_MAC_SDK = $QMAKE_MAC_SDK" >> "$CONFIG_IN" |
| 286 |
fi |
| 287 |
|
| 288 |
if [ -z "$BUILD_UNITTESTS" ]; then |
| 289 |
echo "build_unit_tests = no" >> "$CONFIG_IN" |
| 290 |
else |
| 291 |
echo "build_unit_tests = yes" >> "$CONFIG_IN" |
| 292 |
fi |
| 293 |
|
| 294 |
if [ -z "$BUILD_EXAMPLES" ]; then |
| 295 |
echo "build_examples = no" >> "$CONFIG_IN" |
| 296 |
else |
| 297 |
echo "build_examples = yes" >> "$CONFIG_IN" |
| 298 |
fi |
| 299 |
|
| 300 |
if [ -z "$BUILD_DOCS" ]; then |
| 301 |
echo "build_docs = no" >> "$CONFIG_IN" |
| 302 |
else |
| 303 |
echo "build_docs = yes" >> "$CONFIG_IN" |
| 304 |
fi |
| 305 |
|
| 306 |
echo "Configuring Qt Mobility" |
| 307 |
echo |
| 308 |
|
| 309 |
WHICH="$relpath/config.tests/tools/which.test" |
| 310 |
|
| 311 |
printf "Checking available Qt" |
| 312 |
if ! "$WHICH" qmake 2>/dev/null 1>&2; then |
| 313 |
printf " ... Not found\n\n" >&2 |
| 314 |
echo >&2 "Cannot find 'qmake' in your PATH."; |
| 315 |
echo >&2 "Aborting." |
| 316 |
else |
| 317 |
printf " ... " |
| 318 |
qmake -query QT_VERSION |
| 319 |
fi |
| 320 |
|
| 321 |
# find out which make we want to use |
| 322 |
MAKE= |
| 323 |
for m in make gmake; do |
| 324 |
if "$WHICH" $m >/dev/null 2>&1; then |
| 325 |
MAKE=`$WHICH $m` |
| 326 |
break |
| 327 |
fi |
| 328 |
done |
| 329 |
if [ -z "$MAKE" ]; then |
| 330 |
echo >&2 "Cannot find 'make' or 'gmake' in your PATH"; |
| 331 |
echo >&2 "Aborting." |
| 332 |
fi |
| 333 |
|
| 334 |
compileTest() |
| 335 |
{ |
| 336 |
printf "Checking $1" |
| 337 |
CURRENT_PWD=`pwd` |
| 338 |
|
| 339 |
if [ "$shadowpath" = "$relpath" ]; then |
| 340 |
#doing source tree build |
| 341 |
cd "$relpath/config.tests/$2" |
| 342 |
rm -rf ./$2 |
| 343 |
else |
| 344 |
#using shadow build |
| 345 |
rm -rf config.tests/$2 |
| 346 |
mkdir -p config.tests/$2 |
| 347 |
cd config.tests/$2 |
| 348 |
fi |
| 349 |
|
| 350 |
qmake "$relpath/config.tests/$2/$2.pro" >> "$CONFIG_LOG" |
| 351 |
printf " ." |
| 352 |
"$MAKE" clean >> "$CONFIG_LOG" |
| 353 |
printf "." |
| 354 |
"$MAKE" >> "$CONFIG_LOG" 2>&1 |
| 355 |
printf ". " |
| 356 |
if ./$2 >> "$CONFIG_LOG" 2>&1; then |
| 357 |
echo "OK" |
| 358 |
echo "$2_enabled = yes" >> "$CONFIG_IN" |
| 359 |
else |
| 360 |
echo "Not Found" |
| 361 |
echo "$2_enabled = no" >> "$CONFIG_IN" |
| 362 |
fi |
| 363 |
cd "$CURRENT_PWD" |
| 364 |
} |
| 365 |
|
| 366 |
#compile tests |
| 367 |
compileTest QMF qmf |
| 368 |
compileTest NetworkManager networkmanager |
| 369 |
compileTest "CoreWLAN (MacOS 10.6)" corewlan |
| 370 |
|
| 371 |
# Now module selection |
| 372 |
# using 'expr match ....' should help a bit |
| 373 |
#if [ -n "$MOBILITY_MODULES_UNPARSED" ]; then |
| 374 |
# In theory we should do some sanity checking here. |
| 375 |
# MOBILITY_MODULES="$MOBILITY_MODULES_UNPARSED" |
| 376 |
#fi |
| 377 |
|
| 378 |
# It's a lot easier to make qmake do the dependency checking... |
| 379 |
echo "mobility_modules = $MOBILITY_MODULES" >> "$CONFIG_IN" |
| 380 |
echo "contains(mobility_modules,versit): mobility_modules *= contacts" >> "$CONFIG_IN" |
| 381 |
echo "maemo6:contains(mobility_modules,messaging): mobility_modules -= messaging" >> "$CONFIG_IN" |
| 382 |
|
| 383 |
# Ideally we'd skip generating headers for modules that are not enabled |
| 384 |
echo "Generating Mobility Headers..." |
| 385 |
#remove old headers |
| 386 |
rm -rf $shadowpath/include |
| 387 |
mkdir $shadowpath/include |
| 388 |
for module in $MOBILITY_MODULES; do |
| 389 |
case "$module" in |
| 390 |
bearer) |
| 391 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/bearer |
| 392 |
;; |
| 393 |
publishsubscribe) |
| 394 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/publishsubscribe |
| 395 |
;; |
| 396 |
location) |
| 397 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/location |
| 398 |
;; |
| 399 |
serviceframework) |
| 400 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/serviceframework |
| 401 |
;; |
| 402 |
systeminfo) |
| 403 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/systeminfo |
| 404 |
;; |
| 405 |
contacts) |
| 406 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts |
| 407 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/details |
| 408 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/requests |
| 409 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/filters |
| 410 |
;; |
| 411 |
multimedia) |
| 412 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/multimedia |
| 413 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/multimedia/experimental |
| 414 |
;; |
| 415 |
messaging) |
| 416 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/messaging |
| 417 |
;; |
| 418 |
versit) |
| 419 |
#versit implies contacts |
| 420 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/versit |
| 421 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts |
| 422 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/details |
| 423 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/requests |
| 424 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/filters |
| 425 |
;; |
| 426 |
sensors) |
| 427 |
$relpath/bin/syncheaders $shadowpath/include $relpath/src/sensors |
| 428 |
;; |
| 429 |
*) |
| 430 |
echo "Cannot generate headers for $module" |
| 431 |
;; |
| 432 |
esac |
| 433 |
done |
| 434 |
|
| 435 |
mv "$CONFIG_IN" config.pri |
| 436 |
mkdir -p "$shadowpath/features" |
| 437 |
|
| 438 |
echo "Running qmake..." |
| 439 |
if qmake -recursive "$relpath/qtmobility.pro"; then |
| 440 |
echo "" |
| 441 |
echo "configure has finished. You may run make or gmake to build the project now." |
| 442 |
else |
| 443 |
echo "" |
| 444 |
echo "configure failed." |
| 445 |
fi |