1 |
dpavlin |
237 |
#!/bin/bash |
2 |
|
|
|
3 |
|
|
# $Id: maketcltk,v 1.14 2003/04/28 16:03:43 kripke Exp $ |
4 |
|
|
# |
5 |
|
|
# sample how to build Tcl/Tk |
6 |
|
|
# we can build shared or static versions, |
7 |
|
|
# however, --disable-threads seems to break some tests ... |
8 |
|
|
# |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
# recommended wish build: |
12 |
|
|
# maketcltk -thr 8.3.5 tclx8.3.5 tix-8.1.4 blt2.4z tcllib-1.3 tclxml-2.6 |
13 |
|
|
# maketcltk -mingw 8.3.5 |
14 |
|
|
# make -C tkhtml |
15 |
|
|
|
16 |
|
|
# other examples |
17 |
|
|
# maketcltk -thr 8.4.2 oratcl-4-1-branch |
18 |
|
|
# maketcltk -thr 8.3.5 oratcl3.3 |
19 |
|
|
# maketcltk 8.3.4 oratcl3.3 |
20 |
|
|
# |
21 |
|
|
|
22 |
|
|
# for dir in tcl tclx tix blt incrtcl oratcl; do |
23 |
|
|
# http://belnet.dl.sourceforge.net/sourceforge/$dir |
24 |
|
|
# done |
25 |
|
|
|
26 |
|
|
|
27 |
|
|
unset TCLLIBPATH |
28 |
|
|
CC=gcc; export CC |
29 |
|
|
|
30 |
|
|
calledas="$0 $*" |
31 |
|
|
|
32 |
|
|
base=`pwd`/ |
33 |
|
|
case "$1" in |
34 |
|
|
-base) base="$2"; shift 2;; |
35 |
|
|
esac |
36 |
|
|
|
37 |
|
|
mingw=false |
38 |
|
|
static=false |
39 |
|
|
case "$1" in |
40 |
|
|
-mingw) mingw=true; shift;; |
41 |
|
|
-a) static=true; shift;; |
42 |
|
|
*) [ -n "$WIN32" ] && mingw=true;; |
43 |
|
|
esac |
44 |
|
|
|
45 |
|
|
tclsubdir=unix |
46 |
|
|
other=win |
47 |
|
|
w= |
48 |
|
|
CFG=--enable-gcc |
49 |
|
|
if $mingw; then |
50 |
|
|
static=true |
51 |
|
|
tclsubdir=win |
52 |
|
|
other=unix |
53 |
|
|
w=.w |
54 |
|
|
if [ -d $HOME/mingw/bin ]; then |
55 |
|
|
PATH=$HOME/mingw/bin:$HOME/mingw/i386-mingw32msvc/bin:$PATH |
56 |
|
|
elif [ -d /opt/cross-tools/bin ]; then |
57 |
|
|
PATH=/opt/cross-tools/bin:/opt/cross-tools/i386-mingw32msvc/bin:$PATH |
58 |
|
|
else |
59 |
|
|
echo "could not find mingw installation. suggest you link $HOME/mingw to it">&2 |
60 |
|
|
exit 1 |
61 |
|
|
fi |
62 |
|
|
WIN32=yes |
63 |
|
|
export PATH WIN32 |
64 |
|
|
CFG="$CFG --cache-file=config.cross.cache --host=i386-mingw32msvc" |
65 |
|
|
CFG="$CFG --target=i386-mingw32msvc --build=i386-linux" |
66 |
|
|
fi |
67 |
|
|
|
68 |
|
|
case "$remake" in |
69 |
|
|
true);; |
70 |
|
|
*) remake=false;; |
71 |
|
|
esac |
72 |
|
|
|
73 |
|
|
thr=--disable-threads |
74 |
|
|
t= |
75 |
|
|
case "$1" in |
76 |
|
|
-thr) thr=--enable-threads; t=.t; shift;; |
77 |
|
|
esac |
78 |
|
|
|
79 |
|
|
ver=${1:-8.3.5} |
80 |
|
|
for arg; do |
81 |
|
|
case "$arg" in |
82 |
|
|
tclxml*) tclxml="$arg";; |
83 |
|
|
tclx*) tclx="$arg";; |
84 |
|
|
oratcl*) oratcl="$arg";; |
85 |
|
|
tix*) tix="$arg";; |
86 |
|
|
blt*) blt="$arg";; |
87 |
|
|
tcllib*) tcllib="$arg";; |
88 |
|
|
esac |
89 |
|
|
done |
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
makepkg () { |
94 |
|
|
echo "### makepkg $*" |
95 |
|
|
pfx=$1 |
96 |
|
|
pkg=$2 |
97 |
|
|
cfg=$3 |
98 |
|
|
shift 3 |
99 |
|
|
( |
100 |
|
|
$remake && ( cd $pkg/$other; make clean distclean; ) |
101 |
|
|
cd $pkg/$tclsubdir |
102 |
|
|
$remake && rm config.{cache,log,status} |
103 |
|
|
$remake && make distclean |
104 |
|
|
echo CC=gcc $cfg $CFG --prefix=$pfx $thr "$@" |
105 |
|
|
[ -f config.status ] || $cfg $CFG --prefix=$pfx $thr "$@" |
106 |
|
|
$remake && make clean |
107 |
|
|
make install |
108 |
|
|
);# popd |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
|
112 |
|
|
maketix () { |
113 |
|
|
echo "### maketix $*" |
114 |
|
|
pfx=$1 |
115 |
|
|
pkg=$2 |
116 |
|
|
shift 2 |
117 |
|
|
with="--with-tclconfig=$dir/lib --with-tkconfig=$dir/lib" |
118 |
|
|
# should be able to figure it out |
119 |
|
|
# with="$with --with-tclinclude=$dir/include --with-tkinclude=$dir/include" |
120 |
|
|
( |
121 |
|
|
$remake && ( cd $pkg/$other; make clean distclean; ) |
122 |
|
|
cd $pkg/$tclsubdir |
123 |
|
|
$remake && make distclean |
124 |
|
|
echo CC=gcc ./configure --prefix=$pfx $thr $with "$@" |
125 |
|
|
[ -f config.status ] || ./configure --prefix=$pfx $thr $with "$@" |
126 |
|
|
# figure out subdir |
127 |
|
|
case "$pfx" in |
128 |
|
|
*8.4*) subdir=tk8.4;; |
129 |
|
|
*) subdir=tk8.3;; |
130 |
|
|
esac |
131 |
|
|
echo "# tix subdir $subdir" |
132 |
|
|
cd $subdir |
133 |
|
|
$remake && make distclean |
134 |
|
|
echo CC=gcc ./configure $CFG --prefix=$pfx $thr $with "$@" |
135 |
|
|
./configure $CFG --prefix=$pfx $thr $with "$@" |
136 |
|
|
make install |
137 |
|
|
cd .. |
138 |
|
|
make install |
139 |
|
|
);# popd |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
makeblt () { |
143 |
|
|
echo "### makeblt $*" |
144 |
|
|
pfx=$1 |
145 |
|
|
pkg=$2 |
146 |
|
|
shift 2 |
147 |
|
|
( |
148 |
|
|
cd $pkg |
149 |
|
|
$remake && rm config.{cache,log,status} |
150 |
|
|
# make distclean |
151 |
|
|
echo CC=gcc ./configure $CFG --prefix=$pfx $thr "$@" |
152 |
|
|
[ -f config.status ] || ./configure $CFG --prefix=$pfx $thr "$@" |
153 |
|
|
$remake && make clean |
154 |
|
|
make ;# important to make first, else bltsh is missing! |
155 |
|
|
make install |
156 |
|
|
);# popd |
157 |
|
|
} |
158 |
|
|
|
159 |
|
|
makexml () { |
160 |
|
|
echo "### makexml $*" |
161 |
|
|
pfx=$1 |
162 |
|
|
pkg=$2 |
163 |
|
|
shift 2 |
164 |
|
|
( |
165 |
|
|
cd $pkg |
166 |
|
|
$remake && rm config.{cache,log,status} |
167 |
|
|
$remake && make distclean |
168 |
|
|
echo CC=gcc ./configure $CFG --prefix=$pfx $thr "$@" |
169 |
|
|
[ -f config.status ] || ./configure $CFG --prefix=$pfx $thr "$@" |
170 |
|
|
$remake && make clean |
171 |
|
|
make install |
172 |
|
|
);# popd |
173 |
|
|
} |
174 |
|
|
|
175 |
|
|
makeall () { |
176 |
|
|
sfx=$1 |
177 |
|
|
shr=$2 |
178 |
|
|
dir=$base$ver$sfx |
179 |
|
|
mkdir $dir |
180 |
|
|
echo "### $calledas" |
181 |
|
|
if [ -d "tk$ver" ]; then |
182 |
|
|
mktk=true |
183 |
|
|
usetk="--enable-tk --with-tk=$dir/lib" |
184 |
|
|
else |
185 |
|
|
mktk=false |
186 |
|
|
usetk="--disable-tk --without-tk" |
187 |
|
|
fi |
188 |
|
|
echo tail -f $dir/makeall.log |
189 |
|
|
$remake && [ -f $dir/makeall.log ] && mv $dir/makeall.log $dir/makeall.log.old |
190 |
|
|
exec >>$dir/makeall.log 2>&1 |
191 |
|
|
echo "### $calledas" |
192 |
|
|
makepkg $dir tcl$ver ./configure $shr |
193 |
|
|
$mktk && makepkg $dir tk$ver ./configure $shr --with-tcl=$dir/lib |
194 |
|
|
[ -n "$tclx" ] && makepkg $dir $tclx ./configure $shr \ |
195 |
|
|
--with-tcl=$dir/lib $usetk |
196 |
|
|
[ -n "$oratcl" ] && makepkg $dir $oratcl ../configure $shr --with-tcl=$dir/lib |
197 |
|
|
if $mktk; then |
198 |
|
|
[ -n "$tkhtml" ] && maketkhtml $dir $tkhtml |
199 |
|
|
[ -n "$tix" ] && maketix $dir "$tix" $shr |
200 |
|
|
[ -n "$blt" ] && makeblt $dir "$blt" $shr \ |
201 |
|
|
--with-tcl=$dir/lib --with-tk=$dir/lib |
202 |
|
|
fi |
203 |
|
|
if [ -n "$tcllib" ]; then |
204 |
|
|
echo "### tcllib $tcllib" |
205 |
|
|
(cd $tcllib && ./install.sh $dir) |
206 |
|
|
fi |
207 |
|
|
if [ -n "$tclxml" ]; then |
208 |
|
|
ver=${tclxml#tclxml} |
209 |
|
|
makexml $dir "$tclxml" $shr --with-tcl=$dir/lib |
210 |
|
|
[ -d "tcldom-$ver" ] \ |
211 |
|
|
&& makexml $dir "tcldom-$ver" $shr --with-tcl=$dir/lib |
212 |
|
|
if false; then # requires gnome libxslt, libxml2 |
213 |
|
|
cat $dir/lib/TcldomConfig.sh $dir/lib/TclxmlConfig.sh \ |
214 |
|
|
>$dir/lib/tcldomxmlConfig.sh |
215 |
|
|
[ -d "tclxslt-$ver" ] \ |
216 |
|
|
&& makexml $dir "tclxslt-$ver" $shr --with-tcl=$dir/lib |
217 |
|
|
fi |
218 |
|
|
fi |
219 |
|
|
} |
220 |
|
|
|
221 |
|
|
if $static; then # only used for building binary dist ... |
222 |
|
|
makeall $w$t.a --disable-shared |
223 |
|
|
else |
224 |
|
|
makeall $w$t.so --enable-shared |
225 |
|
|
fi |