File: mkwindist

package info (click to toggle)
gretl 2016d-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 48,620 kB
  • ctags: 22,779
  • sloc: ansic: 345,830; sh: 4,648; makefile: 2,712; xml: 570; perl: 364
file content (424 lines) | stat: -rwxr-xr-x 13,000 bytes parent folder | download
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
#!/bin/sh

# Shell script to make gretl Windows installer

BUILDTYPE=$1
ARCH=$2

if [ "x${BUILDTYPE}" = "x" ] ; then
  echo "mkwindist: argument must be 'cross' or 'native'"
  exit 1
fi

if [ "x${ARCH}" = "x" ] ; then
  X64="no"
else
  X64="yes"
fi

TOPDIR=".."
THISDIR=`pwd`
MPI=yes
OPENBLAS=yes

########## CONFIGURE HERE ###################

if [ "$BUILDTYPE" = "cross" ] ; then
  WINFILES=/home/cottrell/stats/esl/win32
  ADDONS=/home/cottrell/src/build/addons
  HLPDIR=${TOPDIR}/share
  DOCDIR=${TOPDIR}/build/doc/tex
  if [ $X64 = "yes" ] ; then
    SYSBASE=/opt/win64/x86_64-w64-mingw32
  else
    SYSBASE=/opt/win32/i686-pc-mingw32
  fi
  INNO_CMD="wine c:/innodir/ISCC.exe"
else
  WINFILES=/mingw/winbuild
  ADDONS=${WINFILES}/gretl-addons
  HLPDIR=${WINFILES}/help
  DOCDIR=${WINFILES}/doc
  SYSBASE=c:/mingw
  # C:/Program Files/Inno Setup 5/ISCC.exe
  INNO_CMD="c:/progra~1/innose~1/iscc.exe"
fi

SYSBIN=${SYSBASE}/bin
SYSTRANS=${SYSBASE}/share/locale
SYSTHEME=${SYSBASE}/share/themes
SYSSV=${SYSBASE}/share/gtksourceview-2.0
if [ $X64 = "yes" ] ; then
  GPDIST=${WINFILES}/gp51w64.tar.gz
else
  GPDIST=${WINFILES}/gp51w32.tar.gz
fi

#############################################

# function: add content of unexploded tar package
# the single argument is the path to the tarball
function process_tarball {
    echo "adding content of $1"
    tar tvfz $1 | awk '{ print $3" "$4" "$5" "$6 }' | \
       grep -v ^0 >> MANIFEST
    tar xfz $1
}

# function: add content of an addon zip file
# the single argument is the path to the file
function process_addon {
    echo "adding content of $1"
    unzip -l $1 | awk '{ print $1" 20"$2" "$3" gretl/functions/"$4 }' | \
     grep -ve "^0\|^Arc\|^Len\|\bfile" | grep -v ^'-' >> ../../MANIFEST
    unzip $1
}

# function: add individual file to package
# arg1 is path to file to add, arg2 is where to put it
function add_file {
    finfo=`ls -l $1 | awk '{ print $5" "$6" "$7 }'`
    cp -p $1 windist/$2
    echo $2
    echo "$finfo $2" >> windist/MANIFEST
}

# start of script proper

VERSION=$(grep GRETL_VERSION[^_] $TOPDIR/lib/src/version.h | \
     awk '{ print $NF}' | sed s/[\"\;]//g)

if [ -f windist/MANIFEST ] ; then
   cp windist/MANIFEST windist/MANIFEST.`date +%Y-%m-%d`
fi
if [ $X64 = "yes" ] ; then
  echo "VERSION $VERSION x64" > windist/MANIFEST
else
  echo "VERSION $VERSION" > windist/MANIFEST
fi
echo "DATE `date`" >> windist/MANIFEST
rm -rf windist/gretl

# make gretl directory structure
mkdir -p windist/gretl/data
mkdir -p windist/gretl/data/misc
mkdir -p windist/gretl/data/greene
mkdir -p windist/gretl/data/nist
mkdir -p windist/gretl/data/plotbars
mkdir -p windist/gretl/data/gnuplot
mkdir -p windist/gretl/functions
mkdir -p windist/gretl/functions/gig
mkdir -p windist/gretl/functions/ivpanel
mkdir -p windist/gretl/functions/SVAR
mkdir -p windist/gretl/functions/HIP
mkdir -p windist/gretl/scripts
mkdir -p windist/gretl/scripts/misc
mkdir -p windist/gretl/db
mkdir -p windist/gretl/doc
mkdir -p windist/gretl/helpfigs
mkdir -p windist/gretl/plugins
mkdir -p windist/gretl/plugins/data
mkdir -p windist/gretl/ui

mkdir -p windist/gretl/share/themes/Emacs/gtk-2.0-key
mkdir -p windist/gretl/share/themes/Default/gtk-2.0-key
mkdir -p windist/gretl/share/themes/MS-Windows/gtk-2.0
mkdir -p windist/gretl/share/themes/Raleigh/gtk-2.0
mkdir -p windist/gretl/share/themes/Clearlooks/gtk-2.0

mkdir -p windist/gretl/lib/gtk-2.0/modules
mkdir -p windist/gretl/lib/gtk-2.0/2.10.0/engines
mkdir -p windist/gretl/etc/gtk-2.0

# gretl and GTK translations
LANGS=`cat ${TOPDIR}/po/LINGUAS | grep -v ^#`
for lang in $LANGS ; do
  mkdir -p windist/gretl/locale/${lang}/LC_MESSAGES
  mkdir -p windist/gretl/share/locale/$lang/LC_MESSAGES
done

# put binaries in place
add_file gretlcli.exe gretl/gretlcli.exe
add_file gretl.exe gretl/gretl.exe
if [ $MPI = "yes" ] ; then
  add_file gretlmpi.exe gretl/gretlmpi.exe
fi

# home-made dynamic libs
for f in dlls/*.dll ; do
    add_file $f gretl/`basename $f`
done

# gretl plugins
for f in plugins/*.dll ; do
    add_file $f gretl/plugins/`basename $f`
done

# GTK and other basic dlls
for f in \
	intl.dll \
	libatk-1.0-0.dll \
	libcairo-2.dll \
	libcairo-gobject-2.dll \
	libcurl-4.dll \
	ssleay32.dll \
	libeay32.dll \
	libffi-6.dll \
	libfftw3-3.dll \
	libgailutil-18.dll \
	libgdk_pixbuf-2.0-0.dll \
	libgdk-win32-2.0-0.dll \
	libgio-2.0-0.dll \
	libglib-2.0-0.dll \
	libgmodule-2.0-0.dll \
	libgmp-10.dll \
	libgobject-2.0-0.dll \
	libgthread-2.0-0.dll \
	libgtksourceview-2.0-0.dll \
	libgtk-win32-2.0-0.dll \
	libiconv-2.dll \
	libmpfr-4.dll \
	libpango-1.0-0.dll \
	libpangocairo-1.0-0.dll \
	libpangowin32-1.0-0.dll \
	libxml2-2.dll \
	zlib1.dll \
	libpng16-16.dll \
	libreadline6.dll \
	libjson-glib-1.0-0.dll
do
    add_file ${SYSBIN}/$f gretl/$f
done

# extra dll for 64-bit build (statically linked for w32)
if [ $X64 = "yes" ] ; then
  add_file ${SYSBIN}/libpixman-1-0.dll gretl/libpixman-1-0.dll
fi

if [ $OPENBLAS = "yes" ] ; then
  add_file ${SYSBIN}/libopenblas.dll gretl/libopenblas.dll
else
  add_file ${SYSBIN}/libblas-3.dll gretl/libblas-3.dll
  add_file ${SYSBIN}/liblapack-3.dll gretl/liblapack-3.dll
fi

# system DLLs for threads/openmp, if required
# add_file ${SYSBIN}/mingwm10.dll gretl/mingwm10.dll
add_file ${SYSBIN}/pthreadGC2.dll gretl/pthreadGC2.dll

# cert for cURL
add_file ${WINFILES}/curl-ca-bundle.crt gretl/curl-ca-bundle.crt

# GTK theme files, standard
add_file $SYSTHEME/Emacs/gtk-2.0-key/gtkrc gretl/share/themes/Emacs/gtk-2.0-key/gtkrc
add_file $SYSTHEME/Default/gtk-2.0-key/gtkrc gretl/share/themes/Default/gtk-2.0-key/gtkrc
add_file $SYSTHEME/Raleigh/gtk-2.0/gtkrc gretl/share/themes/Raleigh/gtk-2.0/gtkrc
add_file $SYSTHEME/Clearlooks/gtk-2.0/gtkrc gretl/share/themes/Clearlooks/gtk-2.0/gtkrc

# GTK aux. files, gretl-specific
add_file $WINFILES/auxfiles/locale.alias gretl/share/locale/locale.alias
add_file $WINFILES/auxfiles/gtkrc gretl/share/themes/MS-Windows/gtk-2.0/gtkrc

add_file $SYSBASE/lib/gtk-2.0/modules/libgail.dll gretl/lib/gtk-2.0/modules/libgail.dll
add_file $SYSBASE/lib/gtk-2.0/2.10.0/engines/libpixmap.dll gretl/lib/gtk-2.0/2.10.0/engines/libpixmap.dll
add_file $SYSBASE/lib/gtk-2.0/2.10.0/engines/libwimp.dll gretl/lib/gtk-2.0/2.10.0/engines/libwimp.dll
add_file $SYSBASE/lib/gtk-2.0/2.10.0/engines/libclearlooks.dll gretl/lib/gtk-2.0/2.10.0/engines/libclearlooks.dll
add_file $SYSBASE/etc/gtk-2.0/im-multipress.conf gretl/etc/gtk-2.0/im-multipress.conf

# XML UI-definition files
for f in ${TOPDIR}/gui2/*.xml ; do
  add_file $f gretl/ui/`basename $f`
done

# data files for gtksourceview
mkdir -p windist/gretl/gtksourceview
add_file gretl.lang gretl/gtksourceview/gretl.lang
add_file ${TOPDIR}/gui2/gnuplot.lang gretl/gtksourceview/gnuplot.lang
add_file ${TOPDIR}/gui2/stata.lang gretl/gtksourceview/stata.lang
add_file ${TOPDIR}/gui2/gfnspec.lang gretl/gtksourceview/gfnspec.lang
add_file ${TOPDIR}/gui2/julia_sv2.lang gretl/gtksourceview/julia.lang
add_file ${SYSSV}/language-specs/R.lang gretl/gtksourceview/R.lang
add_file ${SYSSV}/language-specs/cpp.lang gretl/gtksourceview/cpp.lang
add_file ${SYSSV}/language-specs/octave.lang gretl/gtksourceview/octave.lang
add_file ${SYSSV}/language-specs/python.lang gretl/gtksourceview/python.lang
add_file ${SYSSV}/language-specs/def.lang gretl/gtksourceview/def.lang
add_file ${SYSSV}/language-specs/c.lang gretl/gtksourceview/c.lang
add_file ${SYSSV}/language-specs/gtk-doc.lang gretl/gtksourceview/gtk-doc.lang
add_file ${SYSSV}/language-specs/language2.rng gretl/gtksourceview/language2.rng
add_file ${SYSSV}/styles/classic.xml gretl/gtksourceview/classic.xml
add_file ${SYSSV}/styles/cobalt.xml gretl/gtksourceview/cobalt.xml
add_file ${SYSSV}/styles/kate.xml gretl/gtksourceview/kate.xml
add_file ${SYSSV}/styles/oblivion.xml gretl/gtksourceview/oblivion.xml
add_file ${SYSSV}/styles/tango.xml gretl/gtksourceview/tango.xml
add_file ${SYSSV}/styles/styles.rng gretl/gtksourceview/styles.rng
add_file ${TOPDIR}/share/styles/build.xml gretl/gtksourceview/build.xml
add_file ${TOPDIR}/share/styles/darkslate.xml gretl/gtksourceview/darkslate.xml
add_file ${TOPDIR}/share/styles/espresso.xml gretl/gtksourceview/espresso.xml
  
# release news file
add_file NEWS gretl/NEWS

# help files, license, logo
add_file ${HLPDIR}/gretlgui.hlp gretl/gretlgui_hlp.txt
add_file ${HLPDIR}/gretlcmd.hlp gretl/gretlcmd_hlp.txt
add_file ${HLPDIR}/gretlcli.hlp gretl/gretlcli_hlp.txt
add_file ${HLPDIR}/genrcli.hlp gretl/genrcli.hlp
add_file ${HLPDIR}/genrgui.hlp gretl/genrgui.hlp
add_file ${HLPDIR}/genrcli.hlp.it gretl/genrcli.hlp.it
add_file ${HLPDIR}/genrgui.hlp.it gretl/genrgui.hlp.it
add_file ${HLPDIR}/gretlhelp.refs gretl/gretlhelp.refs
for f in ${TOPDIR}/share/texfigs/*.png ; do
   add_file $f gretl/helpfigs/`basename $f`
done
for lang in es it pt ; do
  if test -f ${HLPDIR}/gretlgui.hlp.${lang} ; then \
     add_file ${HLPDIR}/gretlgui.hlp.${lang} gretl/gretlgui_hlp_${lang}.txt
  fi
  if test -f ${HLPDIR}/gretlcmd.hlp.${lang} ; then \
     add_file ${HLPDIR}/gretlcmd.hlp.${lang} gretl/gretlcmd_hlp_${lang}.txt
  fi
  if test -f ${HLPDIR}/gretlcli.hlp.${lang} ; then \
     add_file ${HLPDIR}/gretlcli.hlp.${lang} gretl/gretlcli_hlp_${lang}.txt
  fi
done
add_file ${TOPDIR}/COPYING gretl/COPYING
add_file ${TOPDIR}/pixmaps/gretl-logo.xpm gretl/gretl-logo.xpm

# PDF docs
for f in gretl-guide gretl-ref hansl-primer pkgbook gretl-keys ; do
    add_file ${DOCDIR}/$f.pdf gretl/doc/$f.pdf
done

# top-level data files
for f in ${TOPDIR}/share/data/*.gdt ; do
    add_file $f gretl/data/`basename $f`
done
for f in ${TOPDIR}/share/data/*.dtd ; do
    add_file $f gretl/data/`basename $f`
done
for f in ${TOPDIR}/share/data/descriptions ; do
    add_file $f gretl/data/`basename $f`
done

# Greene data files
for f in ${TOPDIR}/share/data/greene/*.gdt ; do
    add_file $f gretl/data/greene/`basename $f`
done
for f in ${TOPDIR}/share/data/greene/wg_descriptions ; do
    add_file $f gretl/data/greene/`basename $f`
done

# "misc" data files
for f in ${TOPDIR}/share/data/misc/*.gdt ; do
    add_file $f gretl/data/misc/`basename $f`
done
for f in ${TOPDIR}/share/data/misc/descriptions ; do
    add_file $f gretl/data/misc/`basename $f`
done

# Plot bars data files
for f in ${TOPDIR}/share/data/plotbars/*.txt ; do
    add_file $f gretl/data/plotbars/`basename $f`
done

# gnuplot colorname data
for f in ${TOPDIR}/share/data/gnuplot/*.txt ; do
    add_file $f gretl/data/gnuplot/`basename $f`
done

# NIST test data files
for f in ${TOPDIR}/tests/*.dat ; do
    add_file $f gretl/data/nist/`basename $f`
done

# top-level scripts
for f in ${TOPDIR}/share/scripts/*.inp ; do
    add_file $f gretl/scripts/`basename $f`
done
for f in ${TOPDIR}/share/scripts/*tions ; do
    add_file $f gretl/scripts/`basename $f`
done

# "misc" scripts
for f in ${TOPDIR}/share/scripts/misc/*.inp ; do
    add_file $f gretl/scripts/misc/`basename $f`
done
for f in ${TOPDIR}/share/scripts/misc/ps_descriptions ; do
    add_file $f gretl/scripts/misc/`basename $f`
done

# function package DTD and sample(s)
for f in ${TOPDIR}/share/functions/*.dtd ; do
    add_file $f gretl/functions/`basename $f`
done
for f in ${TOPDIR}/share/functions/*.gfn ; do
    add_file $f gretl/functions/`basename $f`
done
for f in ${TOPDIR}/share/functions/*.xml ; do
    add_file $f gretl/functions/`basename $f`
done

# database files
if [ "$BUILDTYPE" = "cross" ] ; then
  make -C ${TOPDIR}/build/share/bcih
  add_file ${TOPDIR}/build/share/bcih/fedstl.bin gretl/db/fedstl.bin
  add_file ${TOPDIR}/share/bcih/fedstl.idx gretl/db/fedstl.idx 
else
  make -C db
  add_file db/fedstl.bin gretl/db/fedstl.bin
  add_file ${TOPDIR}/share/bcih/fedstl.idx gretl/db/fedstl.idx 
fi

# translations (make sure they're up to date first)
make -C mo
for lang in $LANGS ; do
  add_file mo/$lang.mo gretl/locale/$lang/LC_MESSAGES/gretl.mo
  add_file $SYSTRANS/$lang/LC_MESSAGES/glib20.mo gretl/share/locale/$lang/LC_MESSAGES/glib20.mo
  add_file $SYSTRANS/$lang/LC_MESSAGES/gtk20.mo gretl/share/locale/$lang/LC_MESSAGES/gtk20.mo
done

# misc files
add_file ${TOPDIR}/plugin/data/urcdata.bin gretl/plugins/data/urcdata.bin
add_file ${TOPDIR}/plugin/data/dwdata.gz gretl/plugins/data/dwdata.gz
add_file gretl_website.url gretl/gretl_website.url
add_file ${TOPDIR}/win32/delold.bat gretl/delold.bat

# cd into distribution subdirectory
cd windist
WINDIST=`pwd`

if [ ! -f ${GPDIST} ] ; then
  echo "Couldn't find ${GPDIST}"
  exit 1
else
  process_tarball ${GPDIST}
fi

# add the approved gretl addons
cd gretl/functions
for f in gig ivpanel SVAR HIP ; do
  if [ ! -f ${ADDONS}/${f}/${f}.zip ] ; then
    echo "Couldn't find ${f}.zip"
    exit 1
  else
    process_addon ${ADDONS}/$f/$f.zip
  fi
done

cd $WINDIST

make gretl.iss

if [ $X64 = "yes" ] ; then
  EXENAME="gretl_install-64.exe"
else
  EXENAME="gretl_install.exe" 
fi

# make Inno installer
echo "Building gretl installer executable..."
${INNO_CMD} ./gretl.iss 2>errlog && \
mv Output/setup.exe Output/${EXENAME} && \
ls -l Output/${EXENAME}

touch dist.stamp