forked from patthoyts/kitgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
executable file
·252 lines (217 loc) · 7.65 KB
/
config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#set -x
args="$*"
verbose=0; case $1 in -v) verbose=1; shift ;; esac
root=`dirname $1`
base=`basename $1`
shift
case $root in .) root=8.4;; esac
path=$root/$base
if test ! -d $root
then echo "error: directory '$root' does not exist"; exit 1; fi
for v in allenc allmsgs aqua b64 cli dyn gui ppc mk \
gcov gprof sym thread tzdata univ x86
do eval $v=0; done
while test $# != 0
do eval $1=1; shift; done
#for v in thread allenc allmsgs tzdata cli dyn gui aqua x86 ppc univ
# do eval val=$`echo $v`; echo $v = "$val"; done
make=$path/Makefile
mach=`uname`
plat=unix
upx=`which upx`
echo "Configuring $make for $mach."
mkdir -p $path
case $cli-$dyn-$gui in 0-0-0) cli=1 dyn=1 gui=1 ;; esac
( echo "# Generated `date` for $mach:"
echo "# `basename $0` $args"
echo
case $mach in
Darwin)
sed -i '' 's/?=.so/?=.dylib/g' makefile.include
case $aqua in
1) echo "GUI_OPTS = -framework Carbon -framework IOKit" ;;
*) echo "GUI_OPTS = -L/usr/X11R6/lib -lX11 -weak-lXss -lXext" ;;
esac
# https://core.tcl-lang.org/tk/info/85f316beb15108ac43b03fa6c8608e31f3ae5f92
# https://core.tcl-lang.org/tk/info/3bc8ae4e71530ed8
echo "SHARED_BUILD=0"
echo "LDFLAGS = -F/System/Library/Frameworks -framework CoreFoundation -framework AppKit -framework QuartzCore -ObjC"
echo "LDSTRIP = -x"
case $b64-$univ-$ppc-$x86 in
0-0-0-0) ;;
0-0-1-0) echo "CFLAGS += -arch ppc" ;;
0-0-0-1) echo "CFLAGS += -arch x86" ;;
0-?-?-?) echo "CFLAGS += -arch ppc -arch i386" ;;
1-0-1-0) echo "CFLAGS += -arch ppc64" ;;
1-0-0-1) echo "CFLAGS += -arch x86_64" ;;
1-?-?-?) echo "CFLAGS += -arch ppc64 -arch x86_64" ;;
esac
echo "CFLAGS += -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" \
"-mmacosx-version-min=10.6"
case $aqua in 1)
echo "TK_OPTS = --enable-aqua"
echo "TKDYN_OPTS = --enable-aqua" ;;
esac
[ -x "$upx" ] || upx=':'
echo "UPX = $upx"
;;
Linux)
echo "CC = ${CC:=gcc}"
echo "CXX = ${CXX:=gcc}"
echo "LDFLAGS = -ldl -lm -lfontconfig"
echo "LDXXFLAGS = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic"
echo "GUI_OPTS = -L/usr/X11R6/lib -lX11 -lXss"
if [ $root != "8.4" ]; then
echo "GUI_OPTS += -lXft -lXext"
fi
case $b64 in 1)
echo "CFLAGS += -m64" ;;
esac
[ -x "$upx" ] || upx=':'
echo "UPX = $upx"
;;
*BSD)
echo "CC = ${CC:=gcc}"
echo "CFLAGS += -I/usr/X11R6/include"
echo "LDFLAGS = -lm"
echo "GUI_OPTS = -L/usr/X11R6/lib -lX11 -lXss"
case $b64 in 1)
echo "CFLAGS += -m64" ;;
esac
;;
MINGW*)
echo "CC = ${CC:=gcc}"
echo 'LDFLAGS = build/lib/dde1*/*tcldde1*.a build/lib/reg1*/*tclreg1*.a'
[ $root != "8.4" ] && echo 'LDFLAGS += -lws2_32'
if [ ${root#8.} -ge 6 ]; then
echo 'LDFLAGS += -lnetapi32'
echo 'LDFLAGS += build/lib/*tclstub8*.a'
fi
echo 'GUI_OPTS = -lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32'
echo 'GUI_OPTS += -lole32 -loleaut32 -luuid'
echo 'GUI_OPTS += build/tk/wish.res.o -mwindows'
echo 'CLIOBJ = $(OBJ) $(OUTDIR)/tclAppInit.o $(OUTDIR)/tclkitsh.res.o'
echo 'DYNOBJ = $(CLIOBJ) $(OUTDIR)/tkdyn/wish.res.o'
echo 'GUIOBJ = $(OBJ) $(OUTDIR)/winMain.o $(OUTDIR)/tclkit.res.o'
echo 'PRIV = install-headers install-private-headers'
echo 'EXE = .exe'
[ -x $upx ] && echo "UPX = $upx"
plat=win
;;
SunOS)
echo "CC = ${CC:=gcc}"
echo "CXX = ${CXX:=gcc}"
echo "CFLAGS += -I/usr/openwin/include"
echo "LDFLAGS = -ldl -lsocket -lnsl -lm"
echo "LDXXFLAGS = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic"
echo "GUI_OPTS = -L/usr/openwin/lib -lX11 -lXext"
if [ $root != "8.4" ]; then
echo "GUI_OPTS += -L/usr/sfw/lib -lXft -lfreetype -lz -lfontconfig -lXrender"
fi
case $b64 in 1)
echo "CFLAGS += -m64" ;;
esac
;;
*) echo "warning: no settings known for '$mach'" >&2 ;;
esac
echo "PLAT = $plat"
echo "KITFLAGS ="
case $plat in unix)
echo "PRIV = install-headers install-private-headers" ;;
esac
case $b64 in 1)
echo "TCL_OPTS += --enable-64bit"
echo "TK_OPTS += --enable-64bit"
echo "VFS_OPTS += --enable-64bit"
echo "VLERQ_OPTS += --enable-64bit"
echo "MK_OPTS += --enable-64bit"
echo "ITCL_OPTS += --enable-64bit"
;;
esac
#case $verbose in 1) kitopts=" -d" ;; esac
case $allenc in 1) kitopts="$kitopts -e" ;; esac
case $allmsgs in 1) kitopts="$kitopts -m" ;; esac
case $tzdata in 1) kitopts="$kitopts -z" ;; esac
case $thread in
1) case $mach in Linux|SunOS|*BSD)
echo "LDFLAGS += -lpthread" ;;
esac
echo "TCL_OPTS = --enable-threads"
echo "KIT_OPTS = -t$kitopts" ;;
0) echo "KIT_OPTS =$kitopts" ;;
esac
case $plat in win) echo "TCL_OPTS += --with-encoding=utf-8" ;; esac
case $tzdata in 1) echo "TCL_OPTS += --with-tzdata" ;; esac
case $gprof in 1)
echo "CFLAGS += -pg"
sym=1 ;;
esac
case $gcov in 1)
echo "CFLAGS += -fprofile-arcs -ftest-coverage -O0"
echo "LDFLAGS += -lgcov"
sym=1 ;;
esac
case $sym in 1)
echo "STRIP = :"
echo
echo "TCL_OPTS += --enable-symbols"
echo "THREADDYN_OPTS += --enable-symbols"
echo "TK_OPTS += --enable-symbols"
echo "TKDYN_OPTS += --enable-symbols"
echo "VFS_OPTS += --enable-symbols"
echo "VLERQ_OPTS += --enable-symbols"
echo "MK_OPTS += --enable-symbols"
echo "ITCL_OPTS += --enable-symbols"
echo ;;
esac
case $cli in 1) targets="$targets tclkit-cli" ;; esac
case $dyn in 1) targets="$targets tclkit-dyn" ;; esac
case $gui in 1) targets="$targets tclkit-gui" ;; esac
case $mk in
1) case $cli in 1) targets="$targets tclkitsh" ;; esac
case $dyn in 1) targets="$targets tclkit" ;; esac
case $gui in 1) targets="$targets tclkit" ;; esac
;;
esac
case $thread in
1) echo "all: threaded$targets" ;;
0) echo "all:$targets" ;;
esac
case $mach in MINGW*)
echo
echo "tclkit-cli: tclkit-cli.exe"
echo "tclkit-dyn: tclkit-dyn.exe"
echo "tclkit-gui: tclkit-gui.exe"
case $mk in 1) echo "tclkitsh: tclkitsh.exe"
echo "tclkit: tclkit.exe" ;;
esac
esac
echo
echo "include ../../makefile.include"
) >$make
case $verbose in 1)
echo
echo "Contents of $make:"
echo "======================================================================="
cat $make
echo "======================================================================="
echo
echo "To build, run these commands:"
echo " cd $path"
echo " make"
echo
echo "This produces the following executable(s):"
case $cli in 1) echo " $path/tclkit-cli (command-line)" ;; esac
case $dyn in 1) echo " $path/tclkit-dyn (Tk as shared lib)" ;; esac
case $gui in 1) echo " $path/tclkit-gui (Tk linked statically)" ;; esac
case $mk in 1)
case $cli in 1) echo " $path/tclkitsh (old-style command line)" ;; esac
case $dyn in 1) echo " $path/tclkit (old-style with Tk)" ;; esac
case $gui in 1) echo " $path/tclkit (old-style with Tk)" ;; esac
;;
esac
echo
echo "To remove all intermediate builds, use 'make clean'."
echo "To remove all executables as well, use 'make distclean'."
echo
esac