| 1 #!/bin/sh |
1 #!/bin/sh |
| |
2 |
| |
3 |
| |
4 # some utility functions |
| |
5 isplatform() |
| |
6 { |
| |
7 for p in $PLATFORM |
| |
8 do |
| |
9 if [ "$p" = "$1" ]; then |
| |
10 return 0 |
| |
11 fi |
| |
12 done |
| |
13 return 1 |
| |
14 } |
| |
15 notisplatform() |
| |
16 { |
| |
17 for p in $PLATFORM |
| |
18 do |
| |
19 if [ "$p" = "$1" ]; then |
| |
20 return 1 |
| |
21 fi |
| |
22 done |
| |
23 return 0 |
| |
24 } |
| |
25 istoolchain() |
| |
26 { |
| |
27 for t in $TOOLCHAIN |
| |
28 do |
| |
29 if [ "$t" = "$1" ]; then |
| |
30 return 0 |
| |
31 fi |
| |
32 done |
| |
33 return 1 |
| |
34 } |
| |
35 notistoolchain() |
| |
36 { |
| |
37 for t in $TOOLCHAIN |
| |
38 do |
| |
39 if [ "$t" = "$1" ]; then |
| |
40 return 1 |
| |
41 fi |
| |
42 done |
| |
43 return 0 |
| |
44 } |
| |
45 |
| |
46 # clean abort |
| |
47 abort_configure() |
| |
48 { |
| |
49 rm -Rf "$TEMP_DIR" |
| |
50 exit 1 |
| |
51 } |
| |
52 |
| |
53 # Test for availability of pkg-config |
| |
54 PKG_CONFIG=`command -v pkg-config` |
| |
55 : ${PKG_CONFIG:="false"} |
| |
56 |
| |
57 # Simple uname based platform detection |
| |
58 # $PLATFORM is used for platform dependent dependency selection |
| |
59 OS=`uname -s` |
| |
60 OS_VERSION=`uname -r` |
| |
61 printf "detect platform... " |
| |
62 if [ "$OS" = "SunOS" ]; then |
| |
63 PLATFORM="solaris sunos unix svr4" |
| |
64 elif [ "$OS" = "Linux" ]; then |
| |
65 PLATFORM="linux unix" |
| |
66 elif [ "$OS" = "FreeBSD" ]; then |
| |
67 PLATFORM="freebsd bsd unix" |
| |
68 elif [ "$OS" = "OpenBSD" ]; then |
| |
69 PLATFORM="openbsd bsd unix" |
| |
70 elif [ "$OS" = "NetBSD" ]; then |
| |
71 PLATFORM="netbsd bsd unix" |
| |
72 elif [ "$OS" = "Darwin" ]; then |
| |
73 PLATFORM="macos osx bsd unix" |
| |
74 elif echo "$OS" | grep -i "MINGW" > /dev/null; then |
| |
75 PLATFORM="windows mingw" |
| |
76 fi |
| |
77 : ${PLATFORM:="unix"} |
| |
78 |
| |
79 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
| |
80 echo "$PLATFORM_NAME" |
| |
81 |
| |
82 |
| |
83 # help text |
| |
84 printhelp() |
| |
85 { |
| |
86 echo "Usage: $0 [OPTIONS]..." |
| |
87 cat << __EOF__ |
| |
88 Installation directories: |
| |
89 --prefix=PREFIX path prefix for architecture-independent files |
| |
90 [$prefix] |
| |
91 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
| |
92 [PREFIX] |
| |
93 |
| |
94 --bindir=DIR user executables [EPREFIX/bin] |
| |
95 --sbindir=DIR system admin executables [EPREFIX/sbin] |
| |
96 --libexecdir=DIR program executables [EPREFIX/libexec] |
| |
97 --sysconfdir=DIR system configuration files [PREFIX/etc] |
| |
98 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
| |
99 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
| |
100 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
| |
101 --libdir=DIR object code libraries [EPREFIX/lib] |
| |
102 --includedir=DIR C header files [PREFIX/include] |
| |
103 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
| |
104 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
| |
105 --infodir=DIR info documentation [DATAROOTDIR/info] |
| |
106 --mandir=DIR man documentation [DATAROOTDIR/man] |
| |
107 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
| |
108 |
| |
109 Options: |
| |
110 --debug add extra compile flags for debug builds |
| |
111 --release add extra compile flags for release builds |
| |
112 --toolkit=(gtk3|cli|gtk2|wpf) |
| |
113 |
| |
114 Optional Features: |
| |
115 --disable-db Needlessly adds a completely useless SQLite database |
| |
116 by default. |
| |
117 Here another line to test tabs and line |
| |
118 |
| |
119 breaks. |
| |
120 --enable-gui |
| |
121 |
| |
122 __EOF__ |
| |
123 } |
| 2 |
124 |
| 3 # create temporary directory |
125 # create temporary directory |
| 4 TEMP_DIR=".tmp-`uname -n`" |
126 TEMP_DIR=".tmp-`uname -n`" |
| 5 rm -Rf "$TEMP_DIR" |
127 rm -Rf "$TEMP_DIR" |
| 6 if mkdir -p "$TEMP_DIR"; then |
128 if mkdir -p "$TEMP_DIR"; then |
| 34 |
156 |
| 35 # custom variables |
157 # custom variables |
| 36 |
158 |
| 37 # features |
159 # features |
| 38 FEATURE_DB=auto |
160 FEATURE_DB=auto |
| 39 |
|
| 40 # clean abort |
|
| 41 abort_configure() |
|
| 42 { |
|
| 43 rm -Rf "$TEMP_DIR" |
|
| 44 exit 1 |
|
| 45 } |
|
| 46 |
|
| 47 # help text |
|
| 48 printhelp() |
|
| 49 { |
|
| 50 echo "Usage: $0 [OPTIONS]..." |
|
| 51 cat << __EOF__ |
|
| 52 Installation directories: |
|
| 53 --prefix=PREFIX path prefix for architecture-independent files |
|
| 54 [$prefix] |
|
| 55 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
| 56 [PREFIX] |
|
| 57 |
|
| 58 --bindir=DIR user executables [EPREFIX/bin] |
|
| 59 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
| 60 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
| 61 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
| 62 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
| 63 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
| 64 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
| 65 --libdir=DIR object code libraries [EPREFIX/lib] |
|
| 66 --includedir=DIR C header files [PREFIX/include] |
|
| 67 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
| 68 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
| 69 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
| 70 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
| 71 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
| 72 |
|
| 73 Options: |
|
| 74 --debug add extra compile flags for debug builds |
|
| 75 --release add extra compile flags for release builds |
|
| 76 --toolkit=(gtk3|cli|gtk2|wpf) |
|
| 77 |
|
| 78 Optional Features: |
|
| 79 --disable-db Needlessly adds a completely useless SQLite database |
|
| 80 by default. |
|
| 81 Here another line to test tabs and line |
|
| 82 |
|
| 83 breaks. |
|
| 84 --enable-gui |
|
| 85 |
|
| 86 __EOF__ |
|
| 87 } |
|
| 88 |
161 |
| 89 # |
162 # |
| 90 # parse arguments |
163 # parse arguments |
| 91 # |
164 # |
| 92 BUILD_TYPE="default" |
165 BUILD_TYPE="default" |
| 155 printf "loading site defaults... " |
228 printf "loading site defaults... " |
| 156 . "$prefix/etc/config.site" |
229 . "$prefix/etc/config.site" |
| 157 echo ok |
230 echo ok |
| 158 fi |
231 fi |
| 159 |
232 |
| 160 # Test for availability of pkg-config |
|
| 161 PKG_CONFIG=`command -v pkg-config` |
|
| 162 : ${PKG_CONFIG:="false"} |
|
| 163 |
|
| 164 # Simple uname based platform detection |
|
| 165 # $PLATFORM is used for platform dependent dependency selection |
|
| 166 OS=`uname -s` |
|
| 167 OS_VERSION=`uname -r` |
|
| 168 printf "detect platform... " |
|
| 169 if [ "$OS" = "SunOS" ]; then |
|
| 170 PLATFORM="solaris sunos unix svr4" |
|
| 171 elif [ "$OS" = "Linux" ]; then |
|
| 172 PLATFORM="linux unix" |
|
| 173 elif [ "$OS" = "FreeBSD" ]; then |
|
| 174 PLATFORM="freebsd bsd unix" |
|
| 175 elif [ "$OS" = "OpenBSD" ]; then |
|
| 176 PLATFORM="openbsd bsd unix" |
|
| 177 elif [ "$OS" = "NetBSD" ]; then |
|
| 178 PLATFORM="netbsd bsd unix" |
|
| 179 elif [ "$OS" = "Darwin" ]; then |
|
| 180 PLATFORM="macos osx bsd unix" |
|
| 181 elif echo "$OS" | grep -i "MINGW" > /dev/null; then |
|
| 182 PLATFORM="windows mingw" |
|
| 183 fi |
|
| 184 : ${PLATFORM:="unix"} |
|
| 185 |
|
| 186 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
|
| 187 echo "$PLATFORM_NAME" |
|
| 188 |
|
| 189 isplatform() |
|
| 190 { |
|
| 191 for p in $PLATFORM |
|
| 192 do |
|
| 193 if [ "$p" = "$1" ]; then |
|
| 194 return 0 |
|
| 195 fi |
|
| 196 done |
|
| 197 return 1 |
|
| 198 } |
|
| 199 notisplatform() |
|
| 200 { |
|
| 201 for p in $PLATFORM |
|
| 202 do |
|
| 203 if [ "$p" = "$1" ]; then |
|
| 204 return 1 |
|
| 205 fi |
|
| 206 done |
|
| 207 return 0 |
|
| 208 } |
|
| 209 istoolchain() |
|
| 210 { |
|
| 211 for t in $TOOLCHAIN |
|
| 212 do |
|
| 213 if [ "$t" = "$1" ]; then |
|
| 214 return 0 |
|
| 215 fi |
|
| 216 done |
|
| 217 return 1 |
|
| 218 } |
|
| 219 notistoolchain() |
|
| 220 { |
|
| 221 for t in $TOOLCHAIN |
|
| 222 do |
|
| 223 if [ "$t" = "$1" ]; then |
|
| 224 return 1 |
|
| 225 fi |
|
| 226 done |
|
| 227 return 0 |
|
| 228 } |
|
| 229 |
|
| 230 |
233 |
| 231 # generate vars.mk |
234 # generate vars.mk |
| 232 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
235 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
| 233 prefix=$prefix |
236 prefix=$prefix |
| 234 exec_prefix=$exec_prefix |
237 exec_prefix=$exec_prefix |