Sun, 24 Jan 2016 12:08:57 +0100
added gridwidth layout option (GTK)
0 | 1 | #!/bin/bash |
2 | # | |
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
4 | # | |
5 | # Copyright 2011 Olaf Wintermann. All rights reserved. | |
6 | # | |
7 | # Redistribution and use in source and binary forms, with or without | |
8 | # modification, are permitted provided that the following conditions are met: | |
9 | # | |
10 | # 1. Redistributions of source code must retain the above copyright notice, | |
11 | # this list of conditions and the following disclaimer. | |
12 | # | |
13 | # 2. Redistributions in binary form must reproduce the above copyright | |
14 | # notice, this list of conditions and the following disclaimer in the | |
15 | # documentation and/or other materials provided with the distribution. | |
16 | # | |
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
27 | # POSSIBILITY OF SUCH DAMAGE. | |
28 | # | |
29 | ||
30 | OS=`uname -s` | |
31 | OS_VERSION=`uname -r` | |
105
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
32 | PREFIX=/opt/toolkit |
0 | 33 | |
34 | # | |
35 | # parse arguments | |
36 | # | |
37 | for ARG in $@ | |
38 | do | |
39 | if [[ $ARG == --prefix=* ]]; then | |
40 | PREFIX=${ARG:9} | |
41 | elif [[ $ARG == --toolkit=* ]]; then | |
42 | # todo: check for invalid toolkit | |
43 | TOOLKIT=${ARG:10} | |
44 | elif [ $ARG = "--help" ]; then | |
45 | # todo: print help text | |
46 | echo "no help yet" | |
47 | exit 0 | |
48 | fi | |
49 | done | |
50 | ||
51 | # | |
52 | # check_pkgconfig_lib() | |
53 | # | |
54 | # arg1: display package name | |
55 | # arg2: pkg-config package name | |
56 | # | |
57 | check_pkgconfig_lib() | |
58 | { | |
59 | printf "checking for " | |
60 | printf $1 | |
61 | printf "... " | |
62 | pkg-config $2 | |
63 | RESULT=$? | |
64 | if [ $RESULT -eq 0 ]; then | |
65 | echo "ok" | |
66 | else | |
67 | echo "not found" | |
68 | echo | |
69 | echo "missing package" $1 | |
70 | exit -1 | |
71 | fi | |
72 | } | |
73 | ||
74 | ||
75 | # | |
76 | # check OS and libraries | |
77 | # | |
78 | ||
79 | printf "checking for toolchain... " | |
80 | if [ $OS = SunOS ]; then | |
81 | BUILD_CONFIG=suncc | |
82 | echo "suncc" | |
83 | fi | |
84 | ||
85 | if [ $OS = Linux ]; then | |
86 | BUILD_CONFIG=gcc | |
87 | echo "gcc" | |
88 | fi | |
89 | ||
105
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
90 | if [ $OS = FreeBSD ]; then |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
91 | BUILD_CONFIG=clang |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
92 | echo "clang" |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
93 | fi |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
94 | |
0 | 95 | if [ $OS = Darwin ]; then |
96 | BUILD_CONFIG=osx | |
97 | echo "gcc" | |
98 | fi | |
99 | ||
79
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
100 | echo $OS | grep -q "MINGW" |
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
101 | if [ $? -eq 0 ]; then |
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
102 | BUILD_CONFIG=mingw |
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
103 | echo "mingw" |
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
104 | fi |
0 | 105 | |
105
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
106 | if [ -z "BUILD_CONFIG" ]; then |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
107 | BUILD_CONFIG=gcc |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
108 | echo "gcc" |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
109 | fi |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
110 | |
79
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
111 | |
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
112 | #if [ $OS != Darwin ]; then |
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
113 | # check_pkgconfig_lib "libxml2" "libxml-2.0" |
052224670baf
configure script updated
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
114 | #fi |
0 | 115 | |
116 | if [ -z $TOOLKIT ]; then | |
117 | printf "checking for gui library... " | |
118 | if [ $OS = SunOS ]; then | |
119 | if [ $OS_VERSION = 5.10 ]; then | |
120 | TOOLKIT=gtk2legacy | |
121 | else | |
122 | TOOLKIT=gtk2 | |
123 | fi | |
124 | echo "gtk2" | |
125 | elif [ $OS = Darwin ]; then | |
126 | TOOLKIT=cocoa | |
127 | echo "Cocoa" | |
128 | else | |
129 | pkg-config gtk+-3.0 | |
130 | RESULT=$? | |
131 | if [ $RESULT -eq 0 ]; then | |
132 | TOOLKIT=gtk3 | |
133 | echo "gtk3" | |
134 | else | |
135 | pkg-config gtk+-2.0 | |
136 | RESULT=$? | |
137 | if [ $RESULT -eq 0 ]; then | |
105
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
138 | TOOLKIT=gtk2 |
0 | 139 | echo "gtk2" |
140 | else | |
105
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
141 | which qmake-qt4 > /dev/null |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
142 | RESULT=$? |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
143 | if [ $RESULT -eq 0 ]; then |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
144 | TOOLKIT=qt4 |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
145 | echo "qt4" |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
146 | else |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
147 | echo "not found" |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
148 | exit 1 |
86d729874ff4
added FreeBSD support and fixed gtk2 build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
79
diff
changeset
|
149 | fi |
0 | 150 | fi |
151 | fi | |
152 | fi | |
153 | fi | |
154 | ||
155 | ||
156 | # generate config.mk | |
157 | ||
158 | cat > config.mk << __EOF__ | |
159 | # | |
160 | # config.mk generated by configure | |
161 | # | |
162 | ||
163 | PREFIX = ${PREFIX} | |
164 | ||
165 | include \$(BUILD_ROOT)/make/${BUILD_CONFIG}.mk | |
166 | ||
167 | __EOF__ | |
168 | ||
169 | # toolkit config | |
170 | make/configure_${TOOLKIT}.sh | |
171 | ||
172 | ||
173 | echo "configure finished" | |
174 | echo | |
175 | echo " PREFIX: $PREFIX" | |
176 | echo " BUILD_CONFIG: $BUILD_CONFIG" | |
177 | echo " TOOLKIT: $TOOLKIT" | |
178 | echo | |
179 |