Sun, 07 Dec 2025 20:16:02 +0100
update uwproj
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | #set( $D = '$' ) |
| 515 | 4 | #[[ |
| 615 | 5 | # some utility functions |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | isplatform() |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | { |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | for p in $PLATFORM |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | do |
| 511 | 10 | if [ "$p" = "$1" ]; then |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | return 0 |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | done |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | return 1 |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | } |
| 515 | 16 | notisplatform() |
|
207
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
17 | { |
|
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
18 | for p in $PLATFORM |
|
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
19 | do |
| 511 | 20 | if [ "$p" = "$1" ]; then |
|
207
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
21 | return 1 |
|
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
22 | fi |
|
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
23 | done |
|
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
24 | return 0 |
|
27f8a41882a7
more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
206
diff
changeset
|
25 | } |
| 515 | 26 | istoolchain() |
| 27 | { | |
| 28 | for t in $TOOLCHAIN | |
| 29 | do | |
| 30 | if [ "$t" = "$1" ]; then | |
| 31 | return 0 | |
| 32 | fi | |
| 33 | done | |
| 34 | return 1 | |
| 35 | } | |
| 36 | notistoolchain() | |
| 37 | { | |
| 38 | for t in $TOOLCHAIN | |
| 39 | do | |
| 40 | if [ "$t" = "$1" ]; then | |
| 41 | return 1 | |
| 42 | fi | |
| 43 | done | |
| 44 | return 0 | |
| 45 | } | |
| 615 | 46 | |
| 47 | # clean abort | |
| 48 | abort_configure() | |
| 49 | { | |
| 50 | rm -Rf "$TEMP_DIR" | |
| 51 | exit 1 | |
| 52 | } | |
| 53 | ||
| 54 | # Test for availability of pkg-config | |
| 55 | PKG_CONFIG=`command -v pkg-config` | |
| 56 | : ${PKG_CONFIG:="false"} | |
| 57 | ||
| 58 | # Simple uname based platform detection | |
| 59 | # $PLATFORM is used for platform dependent dependency selection | |
| 60 | OS=`uname -s` | |
| 61 | OS_VERSION=`uname -r` | |
| 656 | 62 | ARCH=`uname -m` |
| 615 | 63 | printf "detect platform... " |
| 64 | if [ "$OS" = "SunOS" ]; then | |
| 65 | PLATFORM="solaris sunos unix svr4" | |
| 66 | elif [ "$OS" = "Linux" ]; then | |
| 67 | PLATFORM="linux unix" | |
| 68 | elif [ "$OS" = "FreeBSD" ]; then | |
| 69 | PLATFORM="freebsd bsd unix" | |
| 70 | elif [ "$OS" = "OpenBSD" ]; then | |
| 71 | PLATFORM="openbsd bsd unix" | |
| 72 | elif [ "$OS" = "NetBSD" ]; then | |
| 73 | PLATFORM="netbsd bsd unix" | |
| 74 | elif [ "$OS" = "Darwin" ]; then | |
| 75 | PLATFORM="macos osx bsd unix" | |
| 76 | elif echo "$OS" | grep -i "MINGW" > /dev/null; then | |
| 77 | PLATFORM="windows mingw" | |
| 78 | fi | |
| 79 | : ${PLATFORM:="unix"} | |
| 80 | ||
| 81 | PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` | |
| 82 | echo "$PLATFORM_NAME" | |
| 83 | ]]# | |
| 84 | ||
| 85 | # help text | |
| 86 | printhelp() | |
| 87 | { | |
| 88 | echo "Usage: $0 [OPTIONS]..." | |
| 656 | 89 | echo 'Configuration:' |
| 90 | #foreach( $cfg in $config ) | |
| 91 | if true \ | |
| 92 | #if( $cfg.platform ) | |
| 93 | && isplatform "${cfg.platform}" \ | |
| 94 | #end | |
| 95 | #foreach( $np in $cfg.notList ) | |
| 96 | && notisplatform "${np}" \ | |
| 97 | #end | |
| 98 | ; then | |
| 99 | : | |
| 100 | #foreach( $var in $cfg.vars ) | |
| 101 | #if( $var.overridable ) | |
| 102 | if test -z "${D}${var.varName}__described__"; then | |
| 103 | ${var.varName}__described__=1 | |
| 104 | cat << '__EOF__' | |
| 105 | ${var.helpText} | |
| 106 | __EOF__ | |
| 107 | fi | |
| 108 | #end | |
| 109 | #end | |
| 110 | fi | |
| 111 | #end | |
| 112 | cat << '__EOF__' | |
| 615 | 113 | |
| 114 | Build Types: | |
| 115 | --debug add extra compile flags for debug builds | |
| 116 | --release add extra compile flags for release builds | |
| 117 | #if( $options.size() > 0 ) | |
| 118 | ||
| 119 | Options: | |
| 120 | #foreach( $opt in $options ) | |
| 656 | 121 | ${opt.helpText} |
| 615 | 122 | #end |
| 123 | #end | |
| 124 | #if( $features.size() > 0 ) | |
| 125 | ||
| 126 | Optional Features: | |
| 127 | #foreach( $feature in $features ) | |
| 128 | ${feature.helpText} | |
| 129 | #end | |
| 130 | #end | |
| 131 | ||
| 132 | __EOF__ | |
| 656 | 133 | abort_configure |
| 615 | 134 | } |
| 135 | ||
| 136 | # create temporary directory | |
| 137 | TEMP_DIR=".tmp-`uname -n`" | |
| 138 | rm -Rf "$TEMP_DIR" | |
| 139 | if mkdir -p "$TEMP_DIR"; then | |
| 140 | : | |
| 141 | else | |
| 142 | echo "Cannot create tmp dir $TEMP_DIR" | |
| 143 | echo "Abort" | |
| 144 | exit 1 | |
| 145 | fi | |
| 146 | touch "$TEMP_DIR/options" | |
| 147 | touch "$TEMP_DIR/features" | |
| 148 | ||
| 656 | 149 | # config variables |
| 615 | 150 | #foreach( $cfg in $config ) |
| 151 | if true \ | |
| 152 | #if( $cfg.platform ) | |
| 153 | && isplatform "${cfg.platform}" \ | |
| 154 | #end | |
| 155 | #foreach( $np in $cfg.notList ) | |
| 156 | && notisplatform "${np}" \ | |
| 157 | #end | |
| 158 | ; then | |
| 656 | 159 | : |
| 615 | 160 | #foreach( $var in $cfg.vars ) |
| 656 | 161 | if test -z "${D}${var.varName}__initialized__"; then |
| 162 | ${var.varName}__initialized__=1 | |
| 163 | #if( $var.exec ) | |
| 164 | ${var.varName}=`${var.value}` | |
| 165 | #else | |
| 166 | ${var.varName}='${var.value}' | |
| 167 | #end | |
| 168 | fi | |
| 615 | 169 | #end |
| 170 | fi | |
| 171 | #end | |
| 172 | ||
| 173 | # features | |
| 174 | #foreach( $feature in $features ) | |
| 175 | #if( ${feature.auto} ) | |
| 176 | ${feature.varName}=auto | |
| 177 | #end | |
| 178 | #end | |
| 179 | ||
| 180 | # | |
| 181 | # parse arguments | |
| 182 | # | |
| 183 | BUILD_TYPE="default" | |
| 184 | for ARG in "$@" | |
| 185 | do | |
| 186 | case "$ARG" in | |
| 656 | 187 | #foreach( $var in $vars ) |
| 188 | #if ($var.overridable) | |
| 189 | "--${var.arg}="*) ${var.varName}=${D}{ARG#--${var.arg}=} ;; | |
| 190 | #end | |
| 191 | #end | |
| 192 | "--help"*) printhelp ;; | |
| 193 | "--debug") BUILD_TYPE="debug" ;; | |
| 194 | "--release") BUILD_TYPE="release" ;; | |
| 615 | 195 | #foreach( $opt in $options ) |
| 656 | 196 | "--${opt.arg}="*) ${opt.varName}=${D}{ARG#--${opt.arg}=} ;; |
| 197 | "--${opt.arg}") echo "option '$ARG' needs a value:"; echo " $ARG=${opt.valuesString}"; abort_configure ;; | |
| 615 | 198 | #end |
| 199 | #foreach( $feature in $features ) | |
| 200 | "--enable-${feature.arg}") ${feature.varName}=on ;; | |
| 201 | "--disable-${feature.arg}") unset ${feature.varName} ;; | |
| 202 | #end | |
| 203 | "-"*) echo "unknown option: $ARG"; abort_configure ;; | |
| 204 | esac | |
| 205 | done | |
| 206 | ||
| 656 | 207 | # toolchain detection utilities |
| 208 | . make/toolchain.sh | |
| 209 | ||
| 210 | # check languages | |
| 211 | lang_c= | |
| 212 | lang_cpp= | |
| 213 | #foreach( $lang in $languages ) | |
| 214 | if detect_${lang}_compiler ; then | |
| 215 | lang_${lang}=1 | |
| 216 | fi | |
| 217 | #end | |
| 218 | ||
| 615 | 219 | ## Begin unparsed content. ** |
| 220 | #[[ | |
| 221 | ||
| 222 | # set defaults for dir variables | |
| 223 | : ${exec_prefix:="$prefix"} | |
| 224 | : ${bindir:='${exec_prefix}/bin'} | |
| 225 | : ${sbindir:='${exec_prefix}/sbin'} | |
| 226 | : ${libdir:='${exec_prefix}/lib'} | |
| 227 | : ${libexecdir:='${exec_prefix}/libexec'} | |
| 228 | : ${datarootdir:='${prefix}/share'} | |
| 229 | : ${datadir:='${datarootdir}'} | |
| 230 | : ${sharedstatedir:='${prefix}/com'} | |
| 656 | 231 | if [ -z "$sysconfdir" ]; then |
| 232 | if [ "$prefix" = '/usr' ]; then | |
| 233 | sysconfdir='/etc' | |
| 234 | else | |
| 235 | sysconfdir='${prefix}/etc' | |
| 236 | fi | |
| 237 | fi | |
| 238 | if [ -z "$localstatedir" ]; then | |
| 239 | if [ "$prefix" = '/usr' ]; then | |
| 240 | localstatedir='/var' | |
| 241 | else | |
| 242 | localstatedir='${prefix}/var' | |
| 243 | fi | |
| 244 | fi | |
| 245 | if [ -z "$runstatedir" ]; then | |
| 246 | if [ "$prefix" = '/usr' ]; then | |
| 247 | runstatedir='/var/run' | |
| 248 | else | |
| 249 | runstatedir='${prefix}/var' | |
| 250 | fi | |
| 251 | fi | |
| 615 | 252 | : ${includedir:='${prefix}/include'} |
| 253 | : ${infodir:='${datarootdir}/info'} | |
| 254 | : ${mandir:='${datarootdir}/man'} | |
| 255 | : ${localedir:='${datarootdir}/locale'} | |
| 256 | ||
| 257 | ||
| 258 | # check if a config.site exists and load it | |
| 656 | 259 | CONFIG_SITE_OK=0 |
| 615 | 260 | if [ -n "$CONFIG_SITE" ]; then |
| 261 | # CONFIG_SITE may contain space separated file names | |
| 262 | for cs in $CONFIG_SITE; do | |
| 263 | printf "loading defaults from $cs... " | |
| 656 | 264 | if [ -f "$cs" ]; then |
| 265 | . "$cs" | |
| 266 | echo ok | |
| 267 | CONFIG_SITE_OK=1 | |
| 268 | break | |
| 269 | else | |
| 270 | echo "not found" | |
| 271 | fi | |
| 615 | 272 | done |
| 273 | elif [ -f "$prefix/share/config.site" ]; then | |
| 274 | printf "loading site defaults... " | |
| 275 | . "$prefix/share/config.site" | |
| 276 | echo ok | |
| 656 | 277 | CONFIG_SITE_OK=1 |
| 615 | 278 | elif [ -f "$prefix/etc/config.site" ]; then |
| 279 | printf "loading site defaults... " | |
| 280 | . "$prefix/etc/config.site" | |
| 281 | echo ok | |
| 656 | 282 | CONFIG_SITE_OK=1 |
| 283 | fi | |
| 284 | ||
| 285 | if [ $CONFIG_SITE_OK -eq 0 ]; then | |
| 286 | # try to detect the correct libdir on our own, except it was changed by the user | |
| 287 | if [ "$libdir" = '${exec_prefix}/lib' ] ; then | |
| 288 | if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then | |
| 289 | if [ "$OS" = "SunOS" ]; then | |
| 290 | [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64' | |
| 291 | else | |
| 292 | [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64' | |
| 293 | fi | |
| 294 | elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then | |
| 295 | if [ "$OS" = "SunOS" ]; then | |
| 296 | [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32' | |
| 297 | else | |
| 298 | [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32' | |
| 299 | fi | |
| 300 | fi | |
| 301 | fi | |
| 615 | 302 | fi |
| 515 | 303 | ]]# |
| 304 | ## End of unparsed content ** | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
305 | |
| 515 | 306 | # generate vars.mk |
| 307 | cat > "$TEMP_DIR/vars.mk" << __EOF__ | |
| 308 | #foreach( $var in $vars ) | |
| 309 | ${var.varName}=${D}${var.varName} | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
310 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
311 | __EOF__ |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
312 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
313 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
314 | # |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
315 | # DEPENDENCIES |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
316 | # |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
317 | |
| 656 | 318 | |
| 515 | 319 | |
| 320 | # create buffer for make variables required by dependencies | |
| 321 | echo > "$TEMP_DIR/make.mk" | |
| 322 | ||
| 323 | test_pkg_config() | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
324 | { |
| 515 | 325 | if "$PKG_CONFIG" --exists "$1" ; then : |
| 326 | else return 1 ; fi | |
| 327 | if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : | |
| 328 | else return 1 ; fi | |
| 329 | if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : | |
| 330 | else return 1 ; fi | |
| 331 | if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : | |
| 332 | else return 1 ; fi | |
| 333 | return 0 | |
| 334 | } | |
| 335 | ||
| 336 | print_check_msg() | |
| 337 | { | |
| 338 | if [ -z "$1" ]; then | |
| 339 | shift | |
| 340 | printf "$@" | |
| 341 | fi | |
| 342 | } | |
| 343 | ||
| 344 | #foreach( $dependency in $namedDependencies ) | |
| 345 | dependency_error_${dependency.id}() | |
| 346 | { | |
| 347 | print_check_msg "${D}dep_checked_${dependency.id}" "checking for ${dependency.name}... " | |
| 348 | #foreach( $sub in $dependency.subdependencies ) | |
| 349 | # dependency $sub.fullName | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
350 | while true |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
351 | do |
| 511 | 352 | #if( $sub.platform ) |
| 515 | 353 | if notisplatform "${sub.platform}"; then |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
354 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
355 | fi |
| 511 | 356 | #end |
| 515 | 357 | #if( $sub.toolchain ) |
| 358 | if notistoolchain "${sub.toolchain}"; then | |
| 359 | break | |
| 360 | fi | |
| 361 | #end | |
| 362 | #foreach( $np in $sub.notList ) | |
| 363 | if isplatform "${np}" || istoolchain "${np}"; then | |
| 364 | break | |
| 365 | fi | |
| 366 | #end | |
| 367 | #foreach( $lang in $sub.lang ) | |
| 368 | if [ -z "$lang_${lang}" ] ; then | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
369 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
370 | fi |
| 511 | 371 | #end |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
372 | #if( $sub.pkgconfig.size() > 0 ) |
|
206
f5bdca63bbe7
fix some incompabilities in configure
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
204
diff
changeset
|
373 | if [ -z "$PKG_CONFIG" ]; then |
| 511 | 374 | break |
| 375 | fi | |
| 376 | #end | |
| 377 | #foreach( $test in $sub.tests ) | |
| 656 | 378 | if $test > /dev/null 2>&1 ; then |
| 515 | 379 | : |
| 380 | else | |
| 381 | break | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
382 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
383 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
384 | #foreach( $pkg in $sub.pkgconfig ) |
| 515 | 385 | if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then |
| 386 | TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" | |
| 387 | TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" | |
| 388 | else | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
389 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
390 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
391 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
392 | #foreach( $flags in $sub.flags ) |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
393 | #if( $flags.exec ) |
| 515 | 394 | if tmp_flags=`$flags.value` ; then |
| 395 | TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
396 | else |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
397 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
398 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
399 | #else |
| 511 | 400 | TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
401 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
402 | #end |
| 511 | 403 | #if ( $sub.make.length() > 0 ) |
| 404 | cat >> $TEMP_DIR/make.mk << __EOF__ | |
| 405 | # Dependency: $dependency.name | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
406 | $sub.make |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
407 | __EOF__ |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
408 | #end |
| 515 | 409 | print_check_msg "${D}dep_checked_${dependency.id}" "yes\n" |
| 410 | dep_checked_${dependency.id}=1 | |
| 411 | return 1 | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
412 | done |
| 511 | 413 | |
| 414 | #end | |
| 515 | 415 | print_check_msg "${D}dep_checked_${dependency.id}" "no\n" |
| 416 | dep_checked_${dependency.id}=1 | |
| 417 | return 0 | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
418 | } |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
419 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
420 | |
| 515 | 421 | # start collecting dependency information |
| 422 | echo > "$TEMP_DIR/flags.mk" | |
| 423 | ||
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
424 | DEPENDENCIES_FAILED= |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
425 | ERROR=0 |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
426 | #if( $dependencies.size() > 0 ) |
| 515 | 427 | # unnamed dependencies |
| 615 | 428 | TEMP_CFLAGS="$CFLAGS" |
| 429 | TEMP_CXXFLAGS="$CXXFLAGS" | |
| 430 | TEMP_LDFLAGS="$LDFLAGS" | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
431 | #foreach( $dependency in $dependencies ) |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
432 | while true |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
433 | do |
| 511 | 434 | #if( $dependency.platform ) |
| 515 | 435 | if notisplatform "${dependency.platform}"; then |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
436 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
437 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
438 | #end |
| 515 | 439 | #if( $dependency.toolchain ) |
| 440 | if notistoolchain "${dependency.toolchain}"; then | |
| 441 | break | |
| 442 | fi | |
| 443 | #end | |
| 444 | #foreach( $np in $dependency.notList ) | |
| 445 | if isplatform "${np}" || istoolchain "${np}"; then | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
446 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
447 | fi |
| 511 | 448 | #end |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
449 | while true |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
450 | do |
| 515 | 451 | #foreach( $lang in $dependency.lang ) |
| 452 | if [ -z "$lang_${lang}" ] ; then | |
| 453 | ERROR=1 | |
| 454 | break | |
| 455 | fi | |
| 456 | #end | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
457 | #if( $dependency.pkgconfig.size() > 0 ) |
|
206
f5bdca63bbe7
fix some incompabilities in configure
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
204
diff
changeset
|
458 | if [ -z "$PKG_CONFIG" ]; then |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
459 | ERROR=1 |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
460 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
461 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
462 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
463 | #foreach( $pkg in $dependency.pkgconfig ) |
| 515 | 464 | print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "checking for pkg-config package $pkg.name... " |
| 465 | if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then | |
| 466 | print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "yes\n" | |
| 467 | dep_pkgconfig_checked_${pkg.id}=1 | |
| 468 | TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" | |
| 469 | TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" | |
| 470 | else | |
| 471 | print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "no\n" | |
| 472 | dep_pkgconfig_checked_${pkg.id}=1 | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
473 | ERROR=1 |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
474 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
475 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
476 | #end |
| 511 | 477 | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
478 | #foreach( $flags in $dependency.flags ) |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
479 | #if( $flags.exec ) |
| 515 | 480 | if tmp_flags=`$flags.value` ; then |
| 481 | TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
482 | else |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
483 | ERROR=1 |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
484 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
485 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
486 | #else |
| 511 | 487 | TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
488 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
489 | #end |
| 511 | 490 | #if ( $dependency.make.length() > 0 ) |
| 491 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
492 | $dependency.make |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
493 | __EOF__ |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
494 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
495 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
496 | done |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
497 | break |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
498 | done |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
499 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
500 | |
| 615 | 501 | # build type |
| 502 | if [ "$BUILD_TYPE" = "debug" ]; then | |
| 503 | TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS" | |
| 504 | TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 505 | fi | |
| 506 | if [ "$BUILD_TYPE" = "release" ]; then | |
| 507 | TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS" | |
| 508 | TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 509 | fi | |
| 510 | ||
| 515 | 511 | # add general dependency flags to flags.mk |
| 512 | echo "# general flags" >> "$TEMP_DIR/flags.mk" | |
| 513 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then | |
| 514 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
515 | fi |
| 515 | 516 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
| 517 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
518 | fi |
| 511 | 519 | if [ -n "${TEMP_LDFLAGS}" ]; then |
| 515 | 520 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
521 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
522 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
523 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
524 | # |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
525 | # OPTION VALUES |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
526 | # |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
527 | #foreach( $opt in $options ) |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
528 | #foreach( $val in $opt.values ) |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
529 | ${val.func}() |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
530 | { |
| 511 | 531 | VERR=0 |
| 532 | #foreach( $dep in $val.dependencies ) | |
| 515 | 533 | if dependency_error_$dep ; then |
| 511 | 534 | VERR=1 |
| 535 | fi | |
| 536 | #end | |
| 537 | if [ $VERR -ne 0 ]; then | |
| 538 | return 1 | |
| 539 | fi | |
| 540 | #foreach( $def in $val.defines ) | |
| 541 | TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" | |
| 515 | 542 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" |
| 511 | 543 | #end |
| 544 | #if( $val.hasMake() ) | |
| 545 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
546 | $val.make |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
547 | __EOF__ |
| 511 | 548 | #end |
| 549 | return 0 | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
550 | } |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
551 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
552 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
553 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
554 | # |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
555 | # TARGETS |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
556 | # |
| 515 | 557 | |
| 558 | #foreach( $target in $targets ) | |
| 559 | echo >> "$TEMP_DIR/flags.mk" | |
| 560 | #if ( $target.name ) | |
| 561 | echo "configuring target: $target.name" | |
| 562 | echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk" | |
| 563 | #else | |
| 564 | echo "configuring global target" | |
| 565 | echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" | |
| 566 | #end | |
| 511 | 567 | TEMP_CFLAGS= |
| 568 | TEMP_CXXFLAGS= | |
| 569 | TEMP_LDFLAGS= | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
570 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
571 | #foreach( $dependency in $target.dependencies ) |
| 515 | 572 | if dependency_error_$dependency; then |
| 511 | 573 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
| 574 | ERROR=1 | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
575 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
576 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
577 | |
|
250
f4d93355b054
update configure script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
210
diff
changeset
|
578 | # Features |
|
f4d93355b054
update configure script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
210
diff
changeset
|
579 | #foreach( $feature in $target.features ) |
| 515 | 580 | if [ -n "${D}${feature.varName}" ]; then |
|
250
f4d93355b054
update configure script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
210
diff
changeset
|
581 | #foreach( $dependency in $feature.dependencies ) |
| 511 | 582 | # check dependency |
| 515 | 583 | if dependency_error_$dependency ; then |
| 511 | 584 | # "auto" features can fail and are just disabled in this case |
| 515 | 585 | if [ "${D}${feature.varName}" = "auto" ]; then |
| 586 | DISABLE_${feature.varName}=1 | |
| 587 | else | |
| 511 | 588 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
| 589 | ERROR=1 | |
| 590 | fi | |
| 591 | fi | |
|
250
f4d93355b054
update configure script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
210
diff
changeset
|
592 | #end |
| 515 | 593 | if [ -n "$DISABLE_${feature.varName}" ]; then |
| 594 | unset ${feature.varName} | |
| 595 | fi | |
|
250
f4d93355b054
update configure script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
210
diff
changeset
|
596 | fi |
| 615 | 597 | if [ -n "${D}${feature.varName}" ]; then |
| 598 | : | |
| 599 | #foreach( $def in $feature.defines ) | |
| 600 | TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" | |
| 601 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" | |
| 602 | #end | |
| 603 | #if( $feature.hasMake() ) | |
| 604 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
| 605 | $feature.make | |
| 606 | __EOF__ | |
| 607 | #end | |
| 608 | else | |
| 609 | : | |
| 610 | #foreach( $def in $feature.disabled.defines ) | |
| 611 | TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" | |
| 612 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" | |
| 613 | #end | |
| 614 | #if( $feature.disabled.hasMake() ) | |
| 615 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
| 616 | $feature.disabled.make | |
| 617 | __EOF__ | |
| 618 | #end | |
| 619 | #foreach( $dependency in $feature.disabled.dependencies ) | |
| 620 | if dependency_error_$dependency ; then | |
| 621 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " | |
| 622 | ERROR=1 | |
| 623 | fi | |
| 624 | #end | |
| 625 | fi | |
|
250
f4d93355b054
update configure script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
210
diff
changeset
|
626 | #end |
|
f4d93355b054
update configure script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
210
diff
changeset
|
627 | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
628 | #foreach( $opt in $target.options ) |
| 656 | 629 | # Option: --${opt.arg} |
| 515 | 630 | if [ -z "${D}${opt.varName}" ]; then |
| 656 | 631 | echo "auto-detecting option '${opt.arg}'" |
| 511 | 632 | SAVED_ERROR="$ERROR" |
| 633 | SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" | |
| 515 | 634 | ERROR=1 |
| 511 | 635 | while true |
| 636 | do | |
| 637 | #foreach( $optdef in $opt.defaults ) | |
| 638 | #if( $optdef.platform ) | |
| 639 | if isplatform "$optdef.platform"; then | |
| 640 | #end | |
| 515 | 641 | if $optdef.func ; then |
| 656 | 642 | echo " ${opt.arg}: ${optdef.valueName}" >> "$TEMP_DIR/options" |
| 511 | 643 | ERROR=0 |
| 644 | break | |
| 645 | fi | |
| 646 | #if( $optdef.platform ) | |
| 647 | fi | |
| 648 | #end | |
| 649 | #end | |
| 650 | break | |
| 651 | done | |
| 652 | if [ $ERROR -ne 0 ]; then | |
| 653 | SAVED_ERROR=1 | |
| 656 | 654 | SAVED_DEPENDENCIES_FAILED="option '${opt.arg}' $SAVED_DEPENDENCIES_FAILED" |
| 511 | 655 | fi |
| 656 | ERROR="$SAVED_ERROR" | |
| 657 | DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
658 | else |
| 656 | 659 | echo "checking option ${opt.arg} = ${D}${opt.varName}" |
| 511 | 660 | if false; then |
| 661 | false | |
| 662 | #foreach( $optval in $opt.values ) | |
| 515 | 663 | elif [ "${D}${opt.varName}" = "${optval.value}" ]; then |
| 656 | 664 | echo " ${opt.arg}: ${D}${opt.varName}" >> $TEMP_DIR/options |
| 515 | 665 | if $optval.func ; then |
| 666 | : | |
| 667 | else | |
| 511 | 668 | ERROR=1 |
| 656 | 669 | DEPENDENCIES_FAILED="option '${opt.arg}' $DEPENDENCIES_FAILED" |
| 511 | 670 | fi |
| 671 | #end | |
| 615 | 672 | else |
| 673 | echo | |
| 674 | echo "Invalid option value - usage:" | |
| 656 | 675 | echo " --${opt.arg}=${opt.valuesString}" |
| 615 | 676 | abort_configure |
| 511 | 677 | fi |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
678 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
679 | #end |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
680 | |
| 515 | 681 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
| 682 | echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 683 | fi | |
| 684 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then | |
| 685 | echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
686 | fi |
| 511 | 687 | if [ -n "${TEMP_LDFLAGS}" ]; then |
| 515 | 688 | echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
689 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
690 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
691 | #end |
| 515 | 692 | |
| 693 | # final result | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
694 | if [ $ERROR -ne 0 ]; then |
| 511 | 695 | echo |
| 696 | echo "Error: Unresolved dependencies" | |
| 697 | echo "$DEPENDENCIES_FAILED" | |
| 515 | 698 | abort_configure |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
699 | fi |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
700 | |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
701 | echo "configure finished" |
|
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
702 | echo |
| 656 | 703 | echo "Toolchain:" |
| 615 | 704 | echo " name: $TOOLCHAIN_NAME" |
| 705 | if [ -n "$TOOLCHAIN_CC" ]; then | |
| 706 | echo " cc: $TOOLCHAIN_CC" | |
| 707 | fi | |
| 708 | if [ -n "$TOOLCHAIN_CXX" ]; then | |
| 709 | echo " cxx: $TOOLCHAIN_CXX" | |
| 710 | fi | |
| 711 | if [ -n "$TOOLCHAIN_WSIZE" ]; then | |
| 712 | echo " word size: $TOOLCHAIN_WSIZE bit" | |
| 713 | fi | |
| 714 | if [ -n "$TOOLCHAIN_CSTD" ]; then | |
| 715 | echo " default C std: $TOOLCHAIN_CSTD" | |
| 716 | fi | |
| 717 | echo | |
| 656 | 718 | echo "Config:" |
| 719 | #foreach( $var in $vars ) | |
| 720 | #if ($var.overridable) | |
| 721 | printf ' %-16s' '${var.arg}:' | |
| 722 | echo "${D}${var.varName}" | |
| 723 | #end | |
| 724 | #end | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
725 | #if ( $options.size() > 0 ) |
| 615 | 726 | echo |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
727 | echo "Options:" |
| 511 | 728 | cat "$TEMP_DIR/options" |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
729 | #end |
| 515 | 730 | #if ( $features.size() > 0 ) |
| 615 | 731 | echo |
| 515 | 732 | echo "Features:" |
| 733 | #foreach( $feature in $features ) | |
| 656 | 734 | printf ' %-16s' '$feature.name:' |
| 515 | 735 | if [ -n "${D}${feature.varName}" ]; then |
| 656 | 736 | echo 'on' |
| 515 | 737 | else |
| 656 | 738 | echo 'off' |
| 515 | 739 | fi |
| 740 | #end | |
| 741 | #end | |
|
204
e870a7c8f223
replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
742 | echo |
| 515 | 743 | |
| 744 | # generate the config.mk file | |
| 615 | 745 | pwd=`pwd` |
| 515 | 746 | cat > "$TEMP_DIR/config.mk" << __EOF__ |
| 747 | # | |
| 615 | 748 | # config.mk generated by: |
| 749 | # pwd: $pwd | |
| 750 | # $0 $@ | |
| 515 | 751 | # |
| 752 | ||
| 753 | __EOF__ | |
| 754 | write_toolchain_defaults "$TEMP_DIR/toolchain.mk" | |
| 615 | 755 | cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
| 511 | 756 | rm -Rf "$TEMP_DIR" |