-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkncnrkit
executable file
·180 lines (140 loc) · 4.91 KB
/
mkncnrkit
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
#! /bin/sh
# Type ./mkncnrkit for build instructions
# Customize the following for your installation:
DQKIT=dqkit/dqkit
SDX="$DQKIT sdx.kit"
VERSION=1p1
REFLFIT=~/cvs/reflfit
ARCH=`uname -s`
WINDOWS=MINGW32_NT-5.0
if test x$ARCH = x$WINDOWS; then
# windows things
TCLLIB=/c/Tcl/lib
EXE=.exe
BINDRES=$REFLFIT/win/bindres.sh
RC=windres
NEED_TKTABLE=1
NEED_TKDND=1
else
host=`hostname`; host=${host%%.*}
TCLLIB=dqkit/install/$host/lib
fi
# package versions for directories in your install
# tree; note that we do some trimming of the tree
# that we copy so if you are changing version
# numbers, check the code below to make sure that
# everything is being deleted that needs to be.
BWIDGET=BWidget-1.7.0
TKTABLE=Tktable2.8
TKDND=tkdnd1.0
# tkcon is special since it is not usually distributed
# as a package but instead as a stand-alone binary. If
# you have at least version 2.4, we can make it into
# a package by adding a pkgIndex.tcl file. Point the
# variable TKCON to the location of your tkcon and set
# TKCONVER to the version number.
TKCON=tkcon.tcl
TKCONVER=2.4
# Show docs if no input
test x$1 != xdoit && less <<EOF && exit
ncnrpack is a starkit containing the following:
Tcl/Tk BLT Tktable BWidget Tkcon Tkdnd
Constructing it takes some effort. Once it is constructed,
then it can be used for a variety of NCNR programs, though
those too may need to be built from source.
You will need the following sources in the same directory:
dqkit0.4 (dqkit-sources-0.4.tar.gz, not dqkit-core-sources-0.4.tar.gz)
http://sourceforge.net/project/showfiles.php?group_id=99106
sdx.kit:
http://www.equi4.com/pub/sk/sdx.kit
$BWIDGET:
http://sourceforge.net/project/showfiles.php?group_id=12883
tkdnd1.0:
http://sourceforge.net/project/showfiles.php?group_id=13167
tkcon.tcl (latest):
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tkcon/tkcon/tkcon.tcl?rev=HEAD
Note there is mkstemp bug on IRIX systems which you may need
to patch to src/tclxxx tree of dqkit. Try building dqkit, and if
that fails, search google for:
"workaround for buggy(??) mkstemp() on IRIX systems"
To rebuild dqkit, do the following:
tar xzf dqkit-sources-0.4.tar.gz
cd dqkit
vi gen/buildkit
* comment out the line containing upx
* search for the string '[conf::x g++] -static' and remove '-static'
* include "IRIX64 { array set X {make gmake} }" near NetBSD
[osx] (cd noarch/include && ln -s ../../src/tk-8.4.5/xlib/X11 .)
gen/buildkit build -tk -tcl -blt -tktable
cp bin/*/* dqkit$EXE
cd ..
Next we need to extend to make $BWIDGET available:
tar xzf $BWIDGET.tar.gz
Presumably $TKDND is similar. I didn't build it myself for windows,
it doesn't work for me under linux.
Customize this file (mkncnrlib) to point to your tcl tree and
the correct versions of the various packages.
Once everything is ready, build the kit:
$REFLFIT/mkncnrkit doit
The resulting ncnrpack can now be used to wrap your own applications,
but you will have to make a copy before doing so.
E.g.,
mkdir myapp.vfs
echo "package require starkit;starkit::startup;puts hi" > myapp.vfs/main.tcl
cp ncnrpack$VERSION$EXE ncnrpack$EXE
ncnrpack sdx.kit wrap myapp$EXE -runtime ncnrpack$VERSION$EXE
./myapp
EOF
set -x
# clear out any old build kits
rm -rf ncnrpack$VERSION.vfs
# expose the base package tree
$SDX unwrap $DQKIT$EXE
mv dqkit.vfs ncnrpack$VERSION.vfs
kitlib=ncnrpack$VERSION.vfs/lib
# add bwidget (without docs)
mkdir $kitlib/$BWIDGET
cp $BWIDGET/*.tcl $kitlib/$BWIDGET
cp -r $BWIDGET/images $BWIDGET/lang $kitlib/$BWIDGET
cp $BWIDGET/{README,LICENSE}.txt $kitlib/$BWIDGET
# add TkTable (without docs or static lib)
if test -n "$NEED_TKTABLE" ; then
cp -r $TCLLIB/$TKTABLE $kitlib
rm -rf $kitlib/$TKTABLE/html
rm $kitlib/$TKTABLE/*.{a,lib}
fi
# add Tkcon (with pkgIndex.tcl)
mkdir $kitlib/tkcon$TKCONVER
cp $TKCON $kitlib/tkcon$TKCONVER
cat > $kitlib/tkcon$TKCONVER/pkgIndex.tcl <<EOF
package ifneeded tkcon $TKCONVER [subst {
namespace eval ::tkcon {}
set ::tkcon::PRIV(showOnStartup) 0
set ::tkcon::PRIV(protocol) {tkcon hide}
set ::tkcon::OPT(exec) ""
package require Tk
tclPkgSetup [list \$dir] tkcon $TKCONVER {
{tkcon.tcl source {tkcon dump idebug observe}}
}
}]
EOF
# add tkdnd (if needed, without docs)
if test -n "$NEED_TKDND" ; then
cp -r $TCLLIB/$TKDND $kitlib
rm -rf $kitlib/$TKDND/html
rm -rf $kitlib/$TKDND/demo
fi
## Now we need to recombine our kit into ncnrpack
# duplicate the kit so that you can use it to split itself
cp $DQKIT$EXE dqkitcopy$EXE
# split of the dqkit runtime
$SDX mksplit dqkitcopy$EXE
# recombine with the extended ncnrpack
$SDX wrap ncnrpack$VERSION$EXE -runtime dqkitcopy.head
rm dqkitcopy$EXE
## On windows we will want to rebrand this.
if test x$ARCH = x$WINDOWS ; then
(cd $REFLFIT/win && $RC ncnrpack.rc ncnrpack.res)
mv $REFLFIT/win/ncnrpack.res .
$BINDRES ncnrpack$VERSION.exe ncnrpack.res
fi