Thu, 13 Nov 2025 22:09:53 +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]..." |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
89 | cat << __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
90 | Installation directories: |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
91 | --prefix=PREFIX path prefix for architecture-independent files |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
92 | [${D}prefix] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
93 | --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
94 | [PREFIX] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
95 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
96 | --bindir=DIR user executables [EPREFIX/bin] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
97 | --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
98 | --libexecdir=DIR program executables [EPREFIX/libexec] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
99 | --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
100 | --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
101 | --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
102 | --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
103 | --libdir=DIR object code libraries [EPREFIX/lib] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
104 | --includedir=DIR C header files [PREFIX/include] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
105 | --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
106 | --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
107 | --infodir=DIR info documentation [DATAROOTDIR/info] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
108 | --mandir=DIR man documentation [DATAROOTDIR/man] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
109 | --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
110 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
111 | Build Types: |
| 103 | 112 | --debug add extra compile flags for debug builds |
| 113 | --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
|
114 | #if( $options.size() > 0 ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
115 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
116 | Options: |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
117 | #foreach( $opt in $options ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
118 | --${opt.argument}=${opt.valuesString} |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
119 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
120 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
121 | #if( $features.size() > 0 ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
122 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
123 | Optional Features: |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
124 | #foreach( $feature in $features ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
125 | ${feature.helpText} |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
126 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
127 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
128 | |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
129 | __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
130 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
131 | |
| 0 | 132 | # create temporary directory |
| 133 | TEMP_DIR=".tmp-`uname -n`" | |
| 134 | rm -Rf "$TEMP_DIR" | |
| 135 | if mkdir -p "$TEMP_DIR"; then | |
| 136 | : | |
| 137 | else | |
| 138 | echo "Cannot create tmp dir $TEMP_DIR" | |
| 139 | echo "Abort" | |
| 140 | exit 1 | |
| 141 | fi | |
| 142 | touch "$TEMP_DIR/options" | |
| 143 | touch "$TEMP_DIR/features" | |
| 144 | ||
| 145 | # define standard variables | |
| 1 | 146 | # also define standard prefix (this is where we will search for config.site) |
| 147 | prefix=/usr | |
| 148 | exec_prefix= | |
| 149 | bindir= | |
| 150 | sbindir= | |
| 151 | libdir= | |
| 152 | libexecdir= | |
| 153 | datarootdir= | |
| 154 | datadir= | |
| 155 | sysconfdir= | |
| 156 | sharedstatedir= | |
| 157 | localstatedir= | |
| 158 | runstatedir= | |
| 159 | includedir= | |
| 160 | infodir= | |
| 161 | localedir= | |
| 162 | mandir= | |
| 0 | 163 | |
| 164 | # custom variables | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
165 | #foreach( $cfg in $config ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
166 | if true \ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
167 | #if( $cfg.platform ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
168 | && isplatform "${cfg.platform}" \ |
|
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 | #foreach( $np in $cfg.notList ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
171 | && notisplatform "${np}" \ |
| 0 | 172 | #end |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
173 | ; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
174 | #foreach( $var in $cfg.vars ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
175 | #if( $var.exec ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
176 | ${var.varName}=`${var.value}` |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
177 | #else |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
178 | ${var.varName}="${var.value}" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
179 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
180 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
181 | fi |
| 0 | 182 | #end |
| 183 | ||
| 184 | # features | |
| 185 | #foreach( $feature in $features ) | |
| 186 | #if( ${feature.auto} ) | |
| 187 | ${feature.varName}=auto | |
| 188 | #end | |
| 189 | #end | |
| 190 | ||
| 191 | # | |
| 192 | # parse arguments | |
| 193 | # | |
| 194 | BUILD_TYPE="default" | |
| 195 | for ARG in "$@" | |
| 196 | do | |
| 197 | case "$ARG" in | |
| 1 | 198 | "--prefix="*) prefix=${D}{ARG#--prefix=} ;; |
| 199 | "--exec-prefix="*) exec_prefix=${D}{ARG#--exec-prefix=} ;; | |
| 200 | "--bindir="*) bindir=${D}{ARG#----bindir=} ;; | |
| 201 | "--sbindir="*) sbindir=${D}{ARG#--sbindir=} ;; | |
| 202 | "--libdir="*) libdir=${D}{ARG#--libdir=} ;; | |
| 203 | "--libexecdir="*) libexecdir=${D}{ARG#--libexecdir=} ;; | |
| 204 | "--datarootdir="*) datarootdir=${D}{ARG#--datarootdir=} ;; | |
| 205 | "--datadir="*) datadir=${D}{ARG#--datadir=} ;; | |
| 206 | "--sysconfdir="*) sysconfdir=${D}{ARG#--sysconfdir=} ;; | |
| 207 | "--sharedstatedir="*) sharedstatedir=${D}{ARG#--sharedstatedir=} ;; | |
| 208 | "--localstatedir="*) localstatedir=${D}{ARG#--localstatedir=} ;; | |
| 285 | 209 | "--runstatedir="*) runstatedir=${D}{ARG#--runstatedir=} ;; |
| 1 | 210 | "--includedir="*) includedir=${D}{ARG#--includedir=} ;; |
| 211 | "--infodir="*) infodir=${D}{ARG#--infodir=} ;; | |
| 212 | "--mandir"*) mandir=${D}{ARG#--mandir} ;; | |
| 213 | "--localedir"*) localedir=${D}{ARG#--localedir} ;; | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
214 | "--help"*) printhelp; abort_configure ;; |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
215 | "--debug") BUILD_TYPE="debug" ;; |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
216 | "--release") BUILD_TYPE="release" ;; |
| 0 | 217 | #foreach( $opt in $options ) |
| 218 | "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;; | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
219 | "--${opt.argument}") echo "option '$ARG' needs a value:"; echo " $ARG=${opt.valuesString}"; abort_configure ;; |
| 0 | 220 | #end |
| 221 | #foreach( $feature in $features ) | |
| 222 | "--enable-${feature.arg}") ${feature.varName}=on ;; | |
| 223 | "--disable-${feature.arg}") unset ${feature.varName} ;; | |
| 224 | #end | |
| 225 | "-"*) echo "unknown option: $ARG"; abort_configure ;; | |
| 226 | esac | |
| 227 | done | |
| 228 | ||
| 229 | ## Begin unparsed content. ** | |
| 230 | #[[ | |
| 1 | 231 | |
| 232 | # set defaults for dir variables | |
| 233 | : ${exec_prefix:="$prefix"} | |
| 234 | : ${bindir:='${exec_prefix}/bin'} | |
| 235 | : ${sbindir:='${exec_prefix}/sbin'} | |
| 236 | : ${libdir:='${exec_prefix}/lib'} | |
| 237 | : ${libexecdir:='${exec_prefix}/libexec'} | |
| 238 | : ${datarootdir:='${prefix}/share'} | |
| 239 | : ${datadir:='${datarootdir}'} | |
| 240 | : ${sharedstatedir:='${prefix}/com'} | |
| 285 | 241 | if [ -z "$sysconfdir" ]; then |
| 242 | if [ "$prefix" = '/usr' ]; then | |
| 243 | sysconfdir='/etc' | |
| 244 | else | |
| 245 | sysconfdir='${prefix}/etc' | |
| 246 | fi | |
| 247 | fi | |
| 248 | if [ -z "$localstatedir" ]; then | |
| 249 | if [ "$prefix" = '/usr' ]; then | |
| 250 | localstatedir='/var' | |
| 251 | else | |
| 252 | localstatedir='${prefix}/var' | |
| 253 | fi | |
| 254 | fi | |
| 255 | if [ -z "$runstatedir" ]; then | |
| 256 | if [ "$prefix" = '/usr' ]; then | |
| 257 | runstatedir='/var/run' | |
| 258 | else | |
| 259 | runstatedir='${prefix}/var' | |
| 260 | fi | |
| 261 | fi | |
| 1 | 262 | : ${includedir:='${prefix}/include'} |
| 263 | : ${infodir:='${datarootdir}/info'} | |
| 264 | : ${mandir:='${datarootdir}/man'} | |
| 265 | : ${localedir:='${datarootdir}/locale'} | |
| 266 | ||
| 103 | 267 | # remember the above values and compare them later |
| 268 | orig_bindir="$bindir" | |
| 269 | orig_sbindir="$sbindir" | |
| 270 | orig_libdir="$libdir" | |
| 271 | orig_libexecdir="$libexecdir" | |
| 272 | orig_datarootdir="$datarootdir" | |
| 273 | orig_datadir="$datadir" | |
| 274 | orig_sysconfdir="$sysconfdir" | |
| 275 | orig_sharedstatedir="$sharedstatedir" | |
| 276 | orig_localstatedir="$localstatedir" | |
| 277 | orig_runstatedir="$runstatedir" | |
| 278 | orig_includedir="$includedir" | |
| 279 | orig_infodir="$infodir" | |
| 280 | orig_mandir="$mandir" | |
| 281 | orig_localedir="$localedir" | |
| 282 | ||
| 1 | 283 | # check if a config.site exists and load it |
| 284 | if [ -n "$CONFIG_SITE" ]; then | |
| 285 | # CONFIG_SITE may contain space separated file names | |
| 286 | for cs in $CONFIG_SITE; do | |
| 287 | printf "loading defaults from $cs... " | |
| 288 | . "$cs" | |
| 289 | echo ok | |
| 290 | done | |
| 291 | elif [ -f "$prefix/share/config.site" ]; then | |
| 292 | printf "loading site defaults... " | |
| 293 | . "$prefix/share/config.site" | |
| 294 | echo ok | |
| 295 | elif [ -f "$prefix/etc/config.site" ]; then | |
| 296 | printf "loading site defaults... " | |
| 297 | . "$prefix/etc/config.site" | |
| 298 | echo ok | |
| 285 | 299 | else |
| 300 | # try to detect the correct libdir on our own, except it was changed by the user | |
| 301 | if test "$libdir" = '${exec_prefix}/lib'; then | |
| 302 | if [ "$OS" = "SunOS" ]; then | |
| 303 | test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64' | |
| 304 | else | |
| 305 | # check if the standard libdir even exists | |
| 306 | if test -d "${exec_prefix}/lib" ; then | |
| 307 | : | |
| 308 | else | |
| 309 | # if it does not, maybe a lib32 exists | |
| 310 | test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32' | |
| 311 | fi | |
| 312 | # now check if there is a special 64bit libdir that we should use | |
| 313 | for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do | |
| 314 | if [ $ARCH = $i ]; then | |
| 315 | test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64' | |
| 316 | break | |
| 317 | fi | |
| 318 | done | |
| 319 | fi | |
| 320 | fi | |
| 1 | 321 | fi |
| 0 | 322 | ]]# |
| 323 | ## End of unparsed content ** | |
| 324 | ||
| 325 | # generate vars.mk | |
| 326 | cat > "$TEMP_DIR/vars.mk" << __EOF__ | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
327 | prefix=$prefix |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
328 | exec_prefix=$exec_prefix |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
329 | bindir=$bindir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
330 | sbindir=$sbindir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
331 | libdir=$libdir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
332 | libexecdir=$libexecdir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
333 | datarootdir=$datarootdir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
334 | datadir=$datadir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
335 | sysconfdir=$sysconfdir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
336 | sharedstatedir=$sharedstatedir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
337 | localstatedir=$localstatedir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
338 | runstatedir=$runstatedir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
339 | includedir=$includedir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
340 | infodir=$infodir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
341 | mandir=$mandir |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
342 | localedir=$localedir |
| 0 | 343 | #foreach( $var in $vars ) |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
344 | ${var.varName}=${D}${var.varName} |
| 0 | 345 | #end |
| 346 | __EOF__ | |
| 347 | ||
| 348 | # toolchain detection utilities | |
| 349 | . make/toolchain.sh | |
| 350 | ||
| 351 | # | |
| 352 | # DEPENDENCIES | |
| 353 | # | |
| 354 | ||
| 355 | # check languages | |
| 356 | lang_c= | |
| 357 | lang_cpp= | |
| 358 | #foreach( $lang in $languages ) | |
| 359 | if detect_${lang}_compiler ; then | |
| 360 | lang_${lang}=1 | |
| 361 | fi | |
| 362 | #end | |
| 363 | ||
| 364 | # create buffer for make variables required by dependencies | |
| 365 | echo > "$TEMP_DIR/make.mk" | |
| 366 | ||
| 367 | test_pkg_config() | |
| 368 | { | |
| 369 | if "$PKG_CONFIG" --exists "$1" ; then : | |
| 370 | else return 1 ; fi | |
| 371 | if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : | |
| 372 | else return 1 ; fi | |
| 373 | if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : | |
| 374 | else return 1 ; fi | |
| 375 | if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : | |
| 376 | else return 1 ; fi | |
| 377 | return 0 | |
| 378 | } | |
| 379 | ||
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
380 | print_check_msg() |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
381 | { |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
382 | if [ -z "$1" ]; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
383 | shift |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
384 | printf "$@" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
385 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
386 | } |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
387 | |
| 0 | 388 | #foreach( $dependency in $namedDependencies ) |
| 389 | dependency_error_${dependency.id}() | |
| 390 | { | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
391 | print_check_msg "${D}dep_checked_${dependency.id}" "checking for ${dependency.name}... " |
| 0 | 392 | #foreach( $sub in $dependency.subdependencies ) |
| 393 | # dependency $sub.fullName | |
| 394 | while true | |
| 395 | do | |
| 396 | #if( $sub.platform ) | |
| 397 | if notisplatform "${sub.platform}"; then | |
| 398 | break | |
| 399 | fi | |
| 400 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
401 | #if( $sub.toolchain ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
402 | if notistoolchain "${sub.toolchain}"; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
403 | break |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
404 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
405 | #end |
| 0 | 406 | #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
|
407 | if isplatform "${np}" || istoolchain "${np}"; then |
| 0 | 408 | break |
| 409 | fi | |
| 410 | #end | |
| 411 | #foreach( $lang in $sub.lang ) | |
| 412 | if [ -z "$lang_${lang}" ] ; then | |
| 413 | break | |
| 414 | fi | |
| 415 | #end | |
| 416 | #if( $sub.pkgconfig.size() > 0 ) | |
| 417 | if [ -z "$PKG_CONFIG" ]; then | |
| 418 | break | |
| 419 | fi | |
| 420 | #end | |
| 421 | #foreach( $test in $sub.tests ) | |
| 285 | 422 | if $test > /dev/null 2>&1 ; then |
| 0 | 423 | : |
| 424 | else | |
| 425 | break | |
| 426 | fi | |
| 427 | #end | |
| 428 | #foreach( $pkg in $sub.pkgconfig ) | |
| 429 | if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then | |
| 430 | TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" | |
| 431 | TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" | |
| 432 | else | |
| 433 | break | |
| 434 | fi | |
| 435 | #end | |
| 436 | #foreach( $flags in $sub.flags ) | |
| 437 | #if( $flags.exec ) | |
| 438 | if tmp_flags=`$flags.value` ; then | |
| 439 | TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" | |
| 440 | else | |
| 441 | break | |
| 442 | fi | |
| 443 | #else | |
| 444 | TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" | |
| 445 | #end | |
| 446 | #end | |
| 447 | #if ( $sub.make.length() > 0 ) | |
| 448 | cat >> $TEMP_DIR/make.mk << __EOF__ | |
| 449 | # Dependency: $dependency.name | |
| 450 | $sub.make | |
| 451 | __EOF__ | |
| 452 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
453 | 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
|
454 | dep_checked_${dependency.id}=1 |
| 0 | 455 | return 1 |
| 456 | done | |
| 457 | ||
| 458 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
459 | 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
|
460 | dep_checked_${dependency.id}=1 |
| 0 | 461 | return 0 |
| 462 | } | |
| 463 | #end | |
| 464 | ||
| 465 | # start collecting dependency information | |
| 466 | echo > "$TEMP_DIR/flags.mk" | |
| 467 | ||
| 468 | DEPENDENCIES_FAILED= | |
| 469 | ERROR=0 | |
| 470 | #if( $dependencies.size() > 0 ) | |
| 471 | # unnamed dependencies | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
472 | TEMP_CFLAGS="$CFLAGS" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
473 | TEMP_CXXFLAGS="$CXXFLAGS" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
474 | TEMP_LDFLAGS="$LDFLAGS" |
| 0 | 475 | #foreach( $dependency in $dependencies ) |
| 476 | while true | |
| 477 | do | |
| 478 | #if( $dependency.platform ) | |
| 479 | if notisplatform "${dependency.platform}"; then | |
| 480 | break | |
| 481 | fi | |
| 482 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
483 | #if( $dependency.toolchain ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
484 | if notistoolchain "${dependency.toolchain}"; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
485 | break |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
486 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
487 | #end |
| 0 | 488 | #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
|
489 | if isplatform "${np}" || istoolchain "${np}"; then |
| 0 | 490 | break |
| 491 | fi | |
| 492 | #end | |
| 493 | while true | |
| 494 | do | |
| 495 | #foreach( $lang in $dependency.lang ) | |
| 496 | if [ -z "$lang_${lang}" ] ; then | |
| 497 | ERROR=1 | |
| 498 | break | |
| 499 | fi | |
| 500 | #end | |
| 501 | #if( $dependency.pkgconfig.size() > 0 ) | |
| 502 | if [ -z "$PKG_CONFIG" ]; then | |
| 503 | ERROR=1 | |
| 504 | break | |
| 505 | fi | |
| 506 | #end | |
| 507 | #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
|
508 | print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "checking for pkg-config package $pkg.name... " |
| 0 | 509 | 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
|
510 | 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
|
511 | dep_pkgconfig_checked_${pkg.id}=1 |
| 0 | 512 | TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" |
| 513 | TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" | |
| 514 | else | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
515 | 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
|
516 | dep_pkgconfig_checked_${pkg.id}=1 |
| 0 | 517 | ERROR=1 |
| 518 | break | |
| 519 | fi | |
| 520 | #end | |
| 521 | ||
| 522 | #foreach( $flags in $dependency.flags ) | |
| 523 | #if( $flags.exec ) | |
| 524 | if tmp_flags=`$flags.value` ; then | |
| 525 | TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" | |
| 526 | else | |
| 527 | ERROR=1 | |
| 528 | break | |
| 529 | fi | |
| 530 | #else | |
| 531 | TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" | |
| 532 | #end | |
| 533 | #end | |
| 534 | #if ( $dependency.make.length() > 0 ) | |
| 535 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
| 536 | $dependency.make | |
| 537 | __EOF__ | |
| 538 | #end | |
| 539 | break | |
| 540 | done | |
| 541 | break | |
| 542 | done | |
| 543 | #end | |
| 544 | ||
| 103 | 545 | # build type |
| 546 | if [ "$BUILD_TYPE" = "debug" ]; then | |
| 285 | 547 | TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS" |
| 548 | TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 103 | 549 | fi |
| 550 | if [ "$BUILD_TYPE" = "release" ]; then | |
| 285 | 551 | TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS" |
| 552 | TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 103 | 553 | fi |
| 554 | ||
| 0 | 555 | # add general dependency flags to flags.mk |
| 556 | 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
|
557 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
| 0 | 558 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
| 559 | fi | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
560 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
| 0 | 561 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
| 562 | fi | |
| 563 | if [ -n "${TEMP_LDFLAGS}" ]; then | |
| 564 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 565 | fi | |
| 566 | #end | |
| 567 | ||
| 568 | # | |
| 569 | # OPTION VALUES | |
| 570 | # | |
| 571 | #foreach( $opt in $options ) | |
| 572 | #foreach( $val in $opt.values ) | |
| 573 | ${val.func}() | |
| 574 | { | |
| 575 | VERR=0 | |
| 576 | #foreach( $dep in $val.dependencies ) | |
| 577 | if dependency_error_$dep ; then | |
| 578 | VERR=1 | |
| 579 | fi | |
| 580 | #end | |
| 581 | if [ $VERR -ne 0 ]; then | |
| 582 | return 1 | |
| 583 | fi | |
| 584 | #foreach( $def in $val.defines ) | |
| 585 | TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" | |
| 586 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" | |
| 587 | #end | |
| 588 | #if( $val.hasMake() ) | |
| 589 | cat >> "$TEMP_DIR/make.mk" << __EOF__ | |
| 590 | $val.make | |
| 591 | __EOF__ | |
| 592 | #end | |
| 593 | return 0 | |
| 594 | } | |
| 595 | #end | |
| 596 | #end | |
| 597 | ||
| 598 | # | |
| 599 | # TARGETS | |
| 600 | # | |
| 601 | ||
| 602 | #foreach( $target in $targets ) | |
| 603 | echo >> "$TEMP_DIR/flags.mk" | |
| 604 | #if ( $target.name ) | |
| 605 | echo "configuring target: $target.name" | |
| 606 | echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk" | |
| 607 | #else | |
| 608 | echo "configuring global target" | |
| 609 | echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" | |
| 610 | #end | |
| 611 | TEMP_CFLAGS= | |
| 612 | TEMP_CXXFLAGS= | |
| 613 | TEMP_LDFLAGS= | |
| 614 | ||
| 615 | #foreach( $dependency in $target.dependencies ) | |
| 616 | if dependency_error_$dependency; then | |
| 617 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " | |
| 618 | ERROR=1 | |
| 619 | fi | |
| 620 | #end | |
| 621 | ||
| 622 | # Features | |
| 623 | #foreach( $feature in $target.features ) | |
| 624 | if [ -n "${D}${feature.varName}" ]; then | |
| 625 | #foreach( $dependency in $feature.dependencies ) | |
| 626 | # check dependency | |
| 627 | if dependency_error_$dependency ; then | |
| 628 | # "auto" features can fail and are just disabled in this case | |
| 629 | if [ "${D}${feature.varName}" = "auto" ]; then | |
| 630 | DISABLE_${feature.varName}=1 | |
| 631 | else | |
| 632 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " | |
| 633 | ERROR=1 | |
| 634 | fi | |
| 635 | fi | |
| 636 | #end | |
| 637 | if [ -n "$DISABLE_${feature.varName}" ]; then | |
| 638 | unset ${feature.varName} | |
| 639 | fi | |
| 640 | fi | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
641 | 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
|
642 | : |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
643 | #foreach( $def in $feature.defines ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
644 | 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
|
645 | 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
|
646 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
647 | #if( $feature.hasMake() ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
648 | 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
|
649 | $feature.make |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
650 | __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
651 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
652 | else |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
653 | : |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
654 | #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
|
655 | 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
|
656 | 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
|
657 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
658 | #if( $feature.disabled.hasMake() ) |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
659 | 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
|
660 | $feature.disabled.make |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
661 | __EOF__ |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
662 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
663 | #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
|
664 | if dependency_error_$dependency ; then |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
665 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
666 | ERROR=1 |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
667 | fi |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
668 | #end |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
669 | fi |
| 0 | 670 | #end |
| 671 | ||
| 672 | #foreach( $opt in $target.options ) | |
| 673 | # Option: --${opt.argument} | |
| 674 | if [ -z "${D}${opt.varName}" ]; then | |
| 675 | echo "auto-detecting option '${opt.argument}'" | |
| 676 | SAVED_ERROR="$ERROR" | |
| 677 | SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" | |
| 678 | ERROR=1 | |
| 679 | while true | |
| 680 | do | |
| 681 | #foreach( $optdef in $opt.defaults ) | |
| 682 | #if( $optdef.platform ) | |
| 683 | if isplatform "$optdef.platform"; then | |
| 684 | #end | |
| 685 | if $optdef.func ; then | |
| 686 | echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options" | |
| 687 | ERROR=0 | |
| 688 | break | |
| 689 | fi | |
| 690 | #if( $optdef.platform ) | |
| 691 | fi | |
| 692 | #end | |
| 693 | #end | |
| 694 | break | |
| 695 | done | |
| 696 | if [ $ERROR -ne 0 ]; then | |
| 697 | SAVED_ERROR=1 | |
| 698 | SAVED_DEPENDENCIES_FAILED="option '${opt.argument}' $SAVED_DEPENDENCIES_FAILED" | |
| 699 | fi | |
| 700 | ERROR="$SAVED_ERROR" | |
| 701 | DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" | |
| 702 | else | |
| 703 | echo "checking option ${opt.argument} = ${D}${opt.varName}" | |
| 704 | if false; then | |
| 705 | false | |
| 706 | #foreach( $optval in $opt.values ) | |
| 707 | elif [ "${D}${opt.varName}" = "${optval.value}" ]; then | |
| 708 | echo " ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options | |
| 709 | if $optval.func ; then | |
| 710 | : | |
| 711 | else | |
| 712 | ERROR=1 | |
| 713 | DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED" | |
| 714 | fi | |
| 715 | #end | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
716 | else |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
717 | echo |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
718 | echo "Invalid option value - usage:" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
719 | echo " --${opt.argument}=${opt.valuesString}" |
|
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
720 | abort_configure |
| 0 | 721 | fi |
| 722 | fi | |
| 723 | #end | |
| 724 | ||
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
725 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
| 0 | 726 | echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
| 727 | fi | |
|
76
eb16be99b0ad
update to newest versions of uwproj and ucx
Mike Becker <universe@uap-core.de>
parents:
1
diff
changeset
|
728 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
| 0 | 729 | echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
| 730 | fi | |
| 731 | if [ -n "${TEMP_LDFLAGS}" ]; then | |
| 732 | echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 733 | fi | |
| 734 | ||
| 735 | #end | |
| 736 | ||
| 737 | # final result | |
| 738 | if [ $ERROR -ne 0 ]; then | |
| 739 | echo | |
| 740 | echo "Error: Unresolved dependencies" | |
| 741 | echo "$DEPENDENCIES_FAILED" | |
| 742 | abort_configure | |
| 743 | fi | |
| 744 | ||
| 745 | echo "configure finished" | |
| 746 | echo | |
| 103 | 747 | echo "Toolchain" |
| 748 | echo " name: $TOOLCHAIN_NAME" | |
| 749 | if [ -n "$TOOLCHAIN_CC" ]; then | |
| 750 | echo " cc: $TOOLCHAIN_CC" | |
| 751 | fi | |
| 752 | if [ -n "$TOOLCHAIN_CXX" ]; then | |
| 753 | echo " cxx: $TOOLCHAIN_CXX" | |
| 754 | fi | |
| 755 | if [ -n "$TOOLCHAIN_WSIZE" ]; then | |
| 756 | echo " word size: $TOOLCHAIN_WSIZE bit" | |
| 757 | fi | |
| 758 | if [ -n "$TOOLCHAIN_CSTD" ]; then | |
| 759 | echo " default C std: $TOOLCHAIN_CSTD" | |
| 760 | fi | |
| 761 | echo | |
| 0 | 762 | echo "Build Config:" |
| 103 | 763 | echo " prefix: $prefix" |
| 764 | echo " exec_prefix: $exec_prefix" | |
| 765 | if [ "$orig_bindir" != "$bindir" ]; then | |
| 766 | echo " bindir: $bindir" | |
| 767 | fi | |
| 768 | if [ "$orig_sbindir" != "$sbindir" ]; then | |
| 769 | echo " sbindir: $sbindir" | |
| 770 | fi | |
| 771 | if [ "$orig_libdir" != "$libdir" ]; then | |
| 772 | echo " libdir: $libdir" | |
| 773 | fi | |
| 774 | if [ "$orig_libexecdir" != "$libexecdir" ]; then | |
| 775 | echo " libexecdir: $libexecdir" | |
| 776 | fi | |
| 777 | if [ "$orig_datarootdir" != "$datarootdir" ]; then | |
| 778 | echo " datarootdir: $datarootdir" | |
| 779 | fi | |
| 780 | if [ "$orig_datadir" != "$datadir" ]; then | |
| 781 | echo " datadir: $datadir" | |
| 782 | fi | |
| 783 | if [ "$orig_sysconfdir" != "$sysconfdir" ]; then | |
| 784 | echo " sysconfdir: $sysconfdir" | |
| 785 | fi | |
| 786 | if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then | |
| 787 | echo " sharedstatedir: $sharedstatedir" | |
| 788 | fi | |
| 789 | if [ "$orig_localstatedir" != "$localstatedir" ]; then | |
| 790 | echo " localstatedir: $localstatedir" | |
| 791 | fi | |
| 792 | if [ "$orig_runstatedir" != "$runstatedir" ]; then | |
| 793 | echo " runstatedir: $runstatedir" | |
| 794 | fi | |
| 795 | if [ "$orig_includedir" != "$includedir" ]; then | |
| 796 | echo " includedir: $includedir" | |
| 797 | fi | |
| 798 | if [ "$orig_infodir" != "$infodir" ]; then | |
| 799 | echo " infodir: $infodir" | |
| 800 | fi | |
| 801 | if [ "$orig_mandir" != "$mandir" ]; then | |
| 802 | echo " mandir: $mandir" | |
| 803 | fi | |
| 804 | if [ "$orig_localedir" != "$localedir" ]; then | |
| 805 | echo " localedir: $localedir" | |
| 806 | fi | |
| 0 | 807 | #if ( $options.size() > 0 ) |
| 103 | 808 | echo |
| 0 | 809 | echo "Options:" |
| 810 | cat "$TEMP_DIR/options" | |
| 811 | #end | |
| 812 | #if ( $features.size() > 0 ) | |
| 103 | 813 | echo |
| 0 | 814 | echo "Features:" |
| 815 | #foreach( $feature in $features ) | |
| 816 | if [ -n "${D}${feature.varName}" ]; then | |
| 817 | echo " $feature.name: on" | |
| 818 | else | |
| 819 | echo " $feature.name: off" | |
| 820 | fi | |
| 821 | #end | |
| 822 | #end | |
| 823 | echo | |
| 824 | ||
| 825 | # generate the config.mk file | |
| 103 | 826 | pwd=`pwd` |
| 0 | 827 | cat > "$TEMP_DIR/config.mk" << __EOF__ |
| 828 | # | |
| 103 | 829 | # config.mk generated by: |
| 830 | # pwd: $pwd | |
| 831 | # $0 $@ | |
| 0 | 832 | # |
| 833 | ||
| 834 | __EOF__ | |
| 835 | write_toolchain_defaults "$TEMP_DIR/toolchain.mk" | |
| 103 | 836 | cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
| 0 | 837 | rm -Rf "$TEMP_DIR" |