Sun, 30 Nov 2025 16:52:33 +0100
update uwproj
| 0 | 1 | #!/bin/sh |
| 2 | ||
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
3 | #set( $D = '$' ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
4 | #[[ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
5 | # some utility functions |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
6 | isplatform() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
7 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
8 | for p in $PLATFORM |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
9 | do |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
10 | if [ "$p" = "$1" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
11 | return 0 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
12 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
13 | done |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
14 | return 1 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
15 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
16 | notisplatform() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
17 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
18 | for p in $PLATFORM |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
19 | do |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
20 | if [ "$p" = "$1" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
21 | return 1 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
22 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
23 | done |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
24 | return 0 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
25 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
26 | istoolchain() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
27 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
28 | for t in $TOOLCHAIN |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
29 | do |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
30 | if [ "$t" = "$1" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
31 | return 0 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
32 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
33 | done |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
34 | return 1 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
35 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
36 | notistoolchain() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
37 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
38 | for t in $TOOLCHAIN |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
39 | do |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
40 | if [ "$t" = "$1" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
41 | return 1 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
42 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
43 | done |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
44 | return 0 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
45 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
46 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
47 | # clean abort |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
48 | abort_configure() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
49 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
50 | rm -Rf "$TEMP_DIR" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
51 | exit 1 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
52 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
53 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
54 | # Test for availability of pkg-config |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
55 | PKG_CONFIG=`command -v pkg-config` |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
56 | : ${PKG_CONFIG:="false"} |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
57 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
58 | # Simple uname based platform detection |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
59 | # $PLATFORM is used for platform dependent dependency selection |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
60 | OS=`uname -s` |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
61 | OS_VERSION=`uname -r` |
| 285 | 62 | ARCH=`uname -m` |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
63 | printf "detect platform... " |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
64 | if [ "$OS" = "SunOS" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
65 | PLATFORM="solaris sunos unix svr4" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
66 | elif [ "$OS" = "Linux" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
67 | PLATFORM="linux unix" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
68 | elif [ "$OS" = "FreeBSD" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
69 | PLATFORM="freebsd bsd unix" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
70 | elif [ "$OS" = "OpenBSD" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
71 | PLATFORM="openbsd bsd unix" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
72 | elif [ "$OS" = "NetBSD" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
73 | PLATFORM="netbsd bsd unix" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
74 | elif [ "$OS" = "Darwin" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
75 | PLATFORM="macos osx bsd unix" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
76 | elif echo "$OS" | grep -i "MINGW" > /dev/null; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
77 | PLATFORM="windows mingw" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
78 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
79 | : ${PLATFORM:="unix"} |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
80 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
81 | PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
82 | echo "$PLATFORM_NAME" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
83 | ]]# |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
84 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
85 | # help text |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
86 | printhelp() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
87 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
88 | echo "Usage: $0 [OPTIONS]..." |
| 289 | 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__' | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
113 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
114 | Build Types: |
| 103 | 115 | --debug add extra compile flags for debug builds |
| 116 | --release add extra compile flags for release builds | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
117 | #if( $options.size() > 0 ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
118 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
119 | Options: |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
120 | #foreach( $opt in $options ) |
| 289 | 121 | ${opt.helpText} |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
122 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
123 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
124 | #if( $features.size() > 0 ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
125 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
126 | Optional Features: |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
127 | #foreach( $feature in $features ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
128 | ${feature.helpText} |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
129 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
130 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
131 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
132 | __EOF__ |
| 289 | 133 | abort_configure |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
134 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
135 | |
| 0 | 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 | ||
| 289 | 149 | # config variables |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
150 | #foreach( $cfg in $config ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
151 | if true \ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
152 | #if( $cfg.platform ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
153 | && isplatform "${cfg.platform}" \ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
154 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
155 | #foreach( $np in $cfg.notList ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
156 | && notisplatform "${np}" \ |
| 0 | 157 | #end |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
158 | ; then |
| 289 | 159 | : |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
160 | #foreach( $var in $cfg.vars ) |
| 289 | 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 | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
169 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
170 | fi |
| 0 | 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 | |
| 289 | 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" ;; | |
| 0 | 195 | #foreach( $opt in $options ) |
| 289 | 196 | "--${opt.arg}="*) ${opt.varName}=${D}{ARG#--${opt.arg}=} ;; |
| 197 | "--${opt.arg}") echo "option '$ARG' needs a value:"; echo " $ARG=${opt.valuesString}"; abort_configure ;; | |
| 0 | 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 | ||
| 289 | 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 | ||
| 0 | 219 | ## Begin unparsed content. ** |
| 220 | #[[ | |
| 1 | 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'} | |
| 285 | 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 | |
| 1 | 252 | : ${includedir:='${prefix}/include'} |
| 253 | : ${infodir:='${datarootdir}/info'} | |
| 254 | : ${mandir:='${datarootdir}/man'} | |
| 255 | : ${localedir:='${datarootdir}/locale'} | |
| 256 | ||
| 103 | 257 | |
| 1 | 258 | # check if a config.site exists and load it |
| 289 | 259 | CONFIG_SITE_OK=0 |
| 1 | 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... " | |
| 289 | 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 | |
| 1 | 272 | done |
| 273 | elif [ -f "$prefix/share/config.site" ]; then | |
| 274 | printf "loading site defaults... " | |
| 275 | . "$prefix/share/config.site" | |
| 276 | echo ok | |
| 289 | 277 | CONFIG_SITE_OK=1 |
| 1 | 278 | elif [ -f "$prefix/etc/config.site" ]; then |
| 279 | printf "loading site defaults... " | |
| 280 | . "$prefix/etc/config.site" | |
| 281 | echo ok | |
| 289 | 282 | CONFIG_SITE_OK=1 |
| 283 | fi | |
| 284 | ||
| 285 | if [ $CONFIG_SITE_OK -eq 0 ]; then | |
| 285 | 286 | # try to detect the correct libdir on our own, except it was changed by the user |
| 289 | 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' | |
| 285 | 291 | else |
| 289 | 292 | [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64' |
| 285 | 293 | fi |
| 289 | 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 | |
| 285 | 300 | fi |
| 301 | fi | |
| 1 | 302 | fi |
| 0 | 303 | ]]# |
| 304 | ## End of unparsed content ** | |
| 305 | ||
| 306 | # generate vars.mk | |
| 307 | cat > "$TEMP_DIR/vars.mk" << __EOF__ | |
| 308 | #foreach( $var in $vars ) | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
309 | ${var.varName}=${D}${var.varName} |
| 0 | 310 | #end |
| 311 | __EOF__ | |
| 312 | ||
| 313 | ||
| 314 | # | |
| 315 | # DEPENDENCIES | |
| 316 | # | |
| 317 | ||
| 289 | 318 | |
| 0 | 319 | |
| 320 | # create buffer for make variables required by dependencies | |
| 321 | echo > "$TEMP_DIR/make.mk" | |
| 322 | ||
| 323 | test_pkg_config() | |
| 324 | { | |
| 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 | ||
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
336 | print_check_msg() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
337 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
338 | if [ -z "$1" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
339 | shift |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
340 | printf "$@" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
341 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
342 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
343 | |
| 0 | 344 | #foreach( $dependency in $namedDependencies ) |
| 345 | dependency_error_${dependency.id}() | |
| 346 | { | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
347 | print_check_msg "${D}dep_checked_${dependency.id}" "checking for ${dependency.name}... " |
| 0 | 348 | #foreach( $sub in $dependency.subdependencies ) |
| 349 | # dependency $sub.fullName | |
| 350 | while true | |
| 351 | do | |
| 352 | #if( $sub.platform ) | |
| 353 | if notisplatform "${sub.platform}"; then | |
| 354 | break | |
| 355 | fi | |
| 356 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
357 | #if( $sub.toolchain ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
358 | if notistoolchain "${sub.toolchain}"; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
359 | break |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
360 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
361 | #end |
| 0 | 362 | #foreach( $np in $sub.notList ) |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
363 | if isplatform "${np}" || istoolchain "${np}"; then |
| 0 | 364 | break |
| 365 | fi | |
| 366 | #end | |
| 367 | #foreach( $lang in $sub.lang ) | |
| 368 | if [ -z "$lang_${lang}" ] ; then | |
| 369 | break | |
| 370 | fi | |
| 371 | #end | |
| 372 | #if( $sub.pkgconfig.size() > 0 ) | |
| 373 | if [ -z "$PKG_CONFIG" ]; then | |
| 374 | break | |
| 375 | fi | |
| 376 | #end | |
| 377 | #foreach( $test in $sub.tests ) | |
| 285 | 378 | if $test > /dev/null 2>&1 ; then |
| 0 | 379 | : |
| 380 | else | |
| 381 | break | |
| 382 | fi | |
| 383 | #end | |
| 384 | #foreach( $pkg in $sub.pkgconfig ) | |
| 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 | |
| 389 | break | |
| 390 | fi | |
| 391 | #end | |
| 392 | #foreach( $flags in $sub.flags ) | |
| 393 | #if( $flags.exec ) | |
| 394 | if tmp_flags=`$flags.value` ; then | |
| 395 | TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" | |
| 396 | else | |
| 397 | break | |
| 398 | fi | |
| 399 | #else | |
| 400 | TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" | |
| 401 | #end | |
| 402 | #end | |
| 403 | #if ( $sub.make.length() > 0 ) | |
| 404 | cat >> $TEMP_DIR/make.mk << __EOF__ | |
| 405 | # Dependency: $dependency.name | |
| 406 | $sub.make | |
| 407 | __EOF__ | |
| 408 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
409 | print_check_msg "${D}dep_checked_${dependency.id}" "yes\n" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
410 | dep_checked_${dependency.id}=1 |
| 0 | 411 | return 1 |
| 412 | done | |
| 413 | ||
| 414 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
415 | print_check_msg "${D}dep_checked_${dependency.id}" "no\n" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
416 | dep_checked_${dependency.id}=1 |
| 0 | 417 | return 0 |
| 418 | } | |
| 419 | #end | |
| 420 | ||
| 421 | # start collecting dependency information | |
| 422 | echo > "$TEMP_DIR/flags.mk" | |
| 423 | ||
| 424 | DEPENDENCIES_FAILED= | |
| 425 | ERROR=0 | |
| 426 | #if( $dependencies.size() > 0 ) | |
| 427 | # unnamed dependencies | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
428 | TEMP_CFLAGS="$CFLAGS" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
429 | TEMP_CXXFLAGS="$CXXFLAGS" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
430 | TEMP_LDFLAGS="$LDFLAGS" |
| 0 | 431 | #foreach( $dependency in $dependencies ) |
| 432 | while true | |
| 433 | do | |
| 434 | #if( $dependency.platform ) | |
| 435 | if notisplatform "${dependency.platform}"; then | |
| 436 | break | |
| 437 | fi | |
| 438 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
439 | #if( $dependency.toolchain ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
440 | if notistoolchain "${dependency.toolchain}"; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
441 | break |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
442 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
443 | #end |
| 0 | 444 | #foreach( $np in $dependency.notList ) |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
445 | if isplatform "${np}" || istoolchain "${np}"; then |
| 0 | 446 | break |
| 447 | fi | |
| 448 | #end | |
| 449 | while true | |
| 450 | do | |
| 451 | #foreach( $lang in $dependency.lang ) | |
| 452 | if [ -z "$lang_${lang}" ] ; then | |
| 453 | ERROR=1 | |
| 454 | break | |
| 455 | fi | |
| 456 | #end | |
| 457 | #if( $dependency.pkgconfig.size() > 0 ) | |
| 458 | if [ -z "$PKG_CONFIG" ]; then | |
| 459 | ERROR=1 | |
| 460 | break | |
| 461 | fi | |
| 462 | #end | |
| 463 | #foreach( $pkg in $dependency.pkgconfig ) | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
464 | print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "checking for pkg-config package $pkg.name... " |
| 0 | 465 | if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
466 | print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "yes\n" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
467 | dep_pkgconfig_checked_${pkg.id}=1 |
| 0 | 468 | TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" |
| 469 | TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" | |
| 470 | else | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
471 | print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "no\n" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
472 | dep_pkgconfig_checked_${pkg.id}=1 |
| 0 | 473 | ERROR=1 |
| 474 | break | |
| 475 | fi | |
| 476 | #end | |
| 477 | ||
| 478 | #foreach( $flags in $dependency.flags ) | |
| 479 | #if( $flags.exec ) | |
| 480 | if tmp_flags=`$flags.value` ; then | |
| 481 | TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" | |
| 482 | else | |
| 483 | ERROR=1 | |
| 484 | break | |
| 485 | fi | |
| 486 | #else | |
| 487 | TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" | |
| 488 | #end | |
| 489 | #end | |
| 490 | #if ( $dependency.make.length() > 0 ) | |
| 491 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
| 492 | $dependency.make | |
| 493 | __EOF__ | |
| 494 | #end | |
| 495 | break | |
| 496 | done | |
| 497 | break | |
| 498 | done | |
| 499 | #end | |
| 500 | ||
| 103 | 501 | # build type |
| 502 | if [ "$BUILD_TYPE" = "debug" ]; then | |
| 285 | 503 | TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS" |
| 504 | TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 103 | 505 | fi |
| 506 | if [ "$BUILD_TYPE" = "release" ]; then | |
| 285 | 507 | TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS" |
| 508 | TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 103 | 509 | fi |
| 510 | ||
| 0 | 511 | # add general dependency flags to flags.mk |
| 512 | echo "# general flags" >> "$TEMP_DIR/flags.mk" | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
513 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
| 0 | 514 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
| 515 | fi | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
516 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
| 0 | 517 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
| 518 | fi | |
| 519 | if [ -n "${TEMP_LDFLAGS}" ]; then | |
| 520 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 521 | fi | |
| 522 | #end | |
| 523 | ||
| 524 | # | |
| 525 | # OPTION VALUES | |
| 526 | # | |
| 527 | #foreach( $opt in $options ) | |
| 528 | #foreach( $val in $opt.values ) | |
| 529 | ${val.func}() | |
| 530 | { | |
| 531 | VERR=0 | |
| 532 | #foreach( $dep in $val.dependencies ) | |
| 533 | if dependency_error_$dep ; then | |
| 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()}" | |
| 542 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" | |
| 543 | #end | |
| 544 | #if( $val.hasMake() ) | |
| 545 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
| 546 | $val.make | |
| 547 | __EOF__ | |
| 548 | #end | |
| 549 | return 0 | |
| 550 | } | |
| 551 | #end | |
| 552 | #end | |
| 553 | ||
| 554 | # | |
| 555 | # TARGETS | |
| 556 | # | |
| 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 | |
| 567 | TEMP_CFLAGS= | |
| 568 | TEMP_CXXFLAGS= | |
| 569 | TEMP_LDFLAGS= | |
| 570 | ||
| 571 | #foreach( $dependency in $target.dependencies ) | |
| 572 | if dependency_error_$dependency; then | |
| 573 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " | |
| 574 | ERROR=1 | |
| 575 | fi | |
| 576 | #end | |
| 577 | ||
| 578 | # Features | |
| 579 | #foreach( $feature in $target.features ) | |
| 580 | if [ -n "${D}${feature.varName}" ]; then | |
| 581 | #foreach( $dependency in $feature.dependencies ) | |
| 582 | # check dependency | |
| 583 | if dependency_error_$dependency ; then | |
| 584 | # "auto" features can fail and are just disabled in this case | |
| 585 | if [ "${D}${feature.varName}" = "auto" ]; then | |
| 586 | DISABLE_${feature.varName}=1 | |
| 587 | else | |
| 588 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " | |
| 589 | ERROR=1 | |
| 590 | fi | |
| 591 | fi | |
| 592 | #end | |
| 593 | if [ -n "$DISABLE_${feature.varName}" ]; then | |
| 594 | unset ${feature.varName} | |
| 595 | fi | |
| 596 | fi | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
597 | if [ -n "${D}${feature.varName}" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
598 | : |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
599 | #foreach( $def in $feature.defines ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
600 | TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
601 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
602 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
603 | #if( $feature.hasMake() ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
604 | cat >> "$TEMP_DIR/make.mk" << __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
605 | $feature.make |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
606 | __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
607 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
608 | else |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
609 | : |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
610 | #foreach( $def in $feature.disabled.defines ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
611 | TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
612 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
613 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
614 | #if( $feature.disabled.hasMake() ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
615 | cat >> "$TEMP_DIR/make.mk" << __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
616 | $feature.disabled.make |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
617 | __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
618 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
619 | #foreach( $dependency in $feature.disabled.dependencies ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
620 | if dependency_error_$dependency ; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
621 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
622 | ERROR=1 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
623 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
624 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
625 | fi |
| 0 | 626 | #end |
| 627 | ||
| 628 | #foreach( $opt in $target.options ) | |
| 289 | 629 | # Option: --${opt.arg} |
| 0 | 630 | if [ -z "${D}${opt.varName}" ]; then |
| 289 | 631 | echo "auto-detecting option '${opt.arg}'" |
| 0 | 632 | SAVED_ERROR="$ERROR" |
| 633 | SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" | |
| 634 | ERROR=1 | |
| 635 | while true | |
| 636 | do | |
| 637 | #foreach( $optdef in $opt.defaults ) | |
| 638 | #if( $optdef.platform ) | |
| 639 | if isplatform "$optdef.platform"; then | |
| 640 | #end | |
| 641 | if $optdef.func ; then | |
| 289 | 642 | echo " ${opt.arg}: ${optdef.valueName}" >> "$TEMP_DIR/options" |
| 0 | 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 | |
| 289 | 654 | SAVED_DEPENDENCIES_FAILED="option '${opt.arg}' $SAVED_DEPENDENCIES_FAILED" |
| 0 | 655 | fi |
| 656 | ERROR="$SAVED_ERROR" | |
| 657 | DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" | |
| 658 | else | |
| 289 | 659 | echo "checking option ${opt.arg} = ${D}${opt.varName}" |
| 0 | 660 | if false; then |
| 661 | false | |
| 662 | #foreach( $optval in $opt.values ) | |
| 663 | elif [ "${D}${opt.varName}" = "${optval.value}" ]; then | |
| 289 | 664 | echo " ${opt.arg}: ${D}${opt.varName}" >> $TEMP_DIR/options |
| 0 | 665 | if $optval.func ; then |
| 666 | : | |
| 667 | else | |
| 668 | ERROR=1 | |
| 289 | 669 | DEPENDENCIES_FAILED="option '${opt.arg}' $DEPENDENCIES_FAILED" |
| 0 | 670 | fi |
| 671 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
672 | else |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
673 | echo |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
674 | echo "Invalid option value - usage:" |
| 289 | 675 | echo " --${opt.arg}=${opt.valuesString}" |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
676 | abort_configure |
| 0 | 677 | fi |
| 678 | fi | |
| 679 | #end | |
| 680 | ||
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
681 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
| 0 | 682 | echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
| 683 | fi | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
684 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
| 0 | 685 | echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
| 686 | fi | |
| 687 | if [ -n "${TEMP_LDFLAGS}" ]; then | |
| 688 | echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 689 | fi | |
| 690 | ||
| 691 | #end | |
| 692 | ||
| 693 | # final result | |
| 694 | if [ $ERROR -ne 0 ]; then | |
| 695 | echo | |
| 696 | echo "Error: Unresolved dependencies" | |
| 697 | echo "$DEPENDENCIES_FAILED" | |
| 698 | abort_configure | |
| 699 | fi | |
| 700 | ||
| 701 | echo "configure finished" | |
| 702 | echo | |
| 289 | 703 | echo "Toolchain:" |
| 103 | 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 | |
| 289 | 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 | |
| 0 | 725 | #if ( $options.size() > 0 ) |
| 103 | 726 | echo |
| 0 | 727 | echo "Options:" |
| 728 | cat "$TEMP_DIR/options" | |
| 729 | #end | |
| 730 | #if ( $features.size() > 0 ) | |
| 103 | 731 | echo |
| 0 | 732 | echo "Features:" |
| 733 | #foreach( $feature in $features ) | |
| 289 | 734 | printf ' %-16s' '$feature.name:' |
| 0 | 735 | if [ -n "${D}${feature.varName}" ]; then |
| 289 | 736 | echo 'on' |
| 0 | 737 | else |
| 289 | 738 | echo 'off' |
| 0 | 739 | fi |
| 740 | #end | |
| 741 | #end | |
| 742 | echo | |
| 743 | ||
| 744 | # generate the config.mk file | |
| 103 | 745 | pwd=`pwd` |
| 0 | 746 | cat > "$TEMP_DIR/config.mk" << __EOF__ |
| 747 | # | |
| 103 | 748 | # config.mk generated by: |
| 749 | # pwd: $pwd | |
| 750 | # $0 $@ | |
| 0 | 751 | # |
| 752 | ||
| 753 | __EOF__ | |
| 754 | write_toolchain_defaults "$TEMP_DIR/toolchain.mk" | |
| 103 | 755 | cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
| 0 | 756 | rm -Rf "$TEMP_DIR" |