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