File: mingw32-dist.sh

package info (click to toggle)
enigma 1.20-dfsg.1-2.2
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 64,696 kB
  • sloc: xml: 153,614; cpp: 63,581; ansic: 31,088; sh: 4,825; makefile: 1,858; yacc: 288; perl: 84; sed: 16
file content (242 lines) | stat: -rwxr-xr-x 6,680 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# This file creates a w32 binary release
#
VERSION=1.20
DDIR="`pwd`/Enigma-$VERSION"
SDIR=..
BDIR=..
DLLDEFAULTS="SDL SDL_image SDL_mixer SDL_ttf jpeg zlib1 libfreetype-6 libogg-0 libpng12-0 libvorbis-0 libvorbisfile-3 mikmod libcurl-4"

if [ "$ENIGMADEVDLLS" != "" ]; then
  DLLS=$ENIGMADEVDLLS
else
  DLLS=$DLLDEFAULTS
fi

STRIP=
if [ "$STRIP" = "" ]; then
  STRIP=strip
fi

if [ "$ENIGMADEVCROSSPREFIX" != "" ]; then
  PATH="$ENIGMADEVCROSSPREFIX/bin:$PATH"
fi

# copy text file with newline convertion if necessary
function cptext {
    $NLCVT dos2unix $SDIR/$1 >$DDIR/$2 2> /dev/null
    if test $? -ne 0; then
        $NLCVT unix2dos $SDIR/$1 >$DDIR/$2
    else
        cp $SDIR/$1 $DDIR/$2
    fi
}

function cpfile {
	cp $SDIR/$1 $DDIR/$2
}

function cpbuiltfile {
	cp $BDIR/$1 $DDIR/$2
}

# copy files of an extention with newline convertion to lf if necessary
function cplffiles {
    for f in `(cd $SDIR/$1 && ls *.$3)`; do
        $NLCVT dos2unix $SDIR/$1/$f >$DDIR/$2/$f 2> /dev/null
        if test $? -ne 0; then
            cp $SDIR/$1/$f $DDIR/$2/$f
        fi
    done
}

#
# Copy levels
#
function copy_levels
{
    echo "... copying levels"
    mkdir $DDIR/data/levels
    cp -p $SDIR/data/levels/*.png $DDIR/data/levels
    cplffiles data/levels data/levels lua
    cplffiles data/levels data/levels txt
    cplffiles data/levels data/levels xml
    for folder in `(cd $SDIR/data/levels && ls -F)| grep / `; do 
	mkdir $DDIR/data/levels/$folder; 
	cp -p $SDIR/data/levels/$folder/*.png $DDIR/data/levels/$folder
        cplffiles data/levels/$folder data/levels/$folder lua
        cplffiles data/levels/$folder data/levels/$folder txt
        cplffiles data/levels/$folder data/levels/$folder xml
    done
    for folder in `(cd $SDIR/data/levels/soko && ls -F)| grep / `; do 
	mkdir $DDIR/data/levels/soko/$folder; 
	cp -p $SDIR/data/levels/soko/$folder/*.png $DDIR/data/levels/soko/$folder
        cplffiles data/levels/soko/$folder data/levels/soko/$folder lua
        cplffiles data/levels/soko/$folder data/levels/soko/$folder txt
        cplffiles data/levels/soko/$folder data/levels/soko/$folder xml
    done
}

function copy_data
{
    echo "... copying data files"
    mkdir $DDIR/data
    cplffiles data data lua
    cplffiles data data xml
    for folder in `(cd $SDIR && ls -F data)| grep / | grep gfx`; do 
	mkdir $DDIR/data/$folder; 
	cp -p $SDIR/data/$folder/*.{png,jpg} $DDIR/data/$folder
    done
    mkdir $DDIR/data/gfx/flags25x15
    cp -p $SDIR/data/gfx/flags25x15/*.png $DDIR/data/gfx/flags25x15
    mkdir $DDIR/data/schemas
    cplffiles data/schemas data/schemas xsd
    cplffiles data/schemas data/schemas xml
    copy_levels
    mkdir $DDIR/data/fonts
    cp -p $SDIR/data/fonts/*.{bmf,png,txt,ttf} $DDIR/data/fonts
    mkdir $DDIR/data/music
    mkdir $DDIR/data/music/menu
    cp -p $SDIR/data/music/menu/*.{ogg,s3m} $DDIR/data/music/menu
    mkdir $DDIR/data/music
    mkdir $DDIR/data/music/game
    cp -p $SDIR/data/music/game/*.{ogg,s3m} $DDIR/data/music/game
    mkdir $DDIR/data/soundsets 
    mkdir $DDIR/data/soundsets/enigma 
    cp -p $SDIR/data/soundsets/enigma/*.wav $DDIR/data/soundsets/enigma
    
    echo "... copying locales:"
    mkdir $DDIR/data/locale
    for lang in de fr nl it es sv ru hu pt fi uk be el pl; do
    	echo "$lang.gmo"
	mkdir "$DDIR/data/locale/$lang"
	mkdir "$DDIR/data/locale/$lang/LC_MESSAGES"
    	cp -p $SDIR/po/$lang.gmo $DDIR/data/locale/$lang/LC_MESSAGES/enigma.mo
    done
}

#
# Copy documentation files
#
function copy_doc
{
    echo "... copying documentation"
    mkdir $DDIR/images $DDIR/images/flags25x15
    cptext README                       README
    cptext COPYING                      COPYING
    cptext CHANGES                      CHANGES
    cptext ACKNOWLEDGEMENTS 		ACKNOWLEDGEMENTS
    cptext doc/index.html 		index.html
    cptext doc/gpl.txt   		gpl.txt
    cptext doc/lgpl.txt 		lgpl.txt
    cptext doc/images/enigma.css	images/enigma.css
    cpfile doc/images/nav_enigma.gif	images/
    cpfile doc/images/nav_cornerul.gif	images/
    cpfile doc/images/nav_cornerur.gif	images/
    cpfile doc/images/favicon.png	images/
    cpfile doc/images/menu_bg.jpg	images/
    cpfile doc/images/flags25x15/*.png	images/flags25x15
    cptext etc/README-SDL.txt 	        README-SDL.txt
    cptext doc/reference/ant_lua.txt 	reference/ant_lua.txt
    cptext doc/reference/ConceptLuaAPI2.txt 	reference/ConceptLuaAPI2.txt
    cptext doc/reference/sounds.txt	reference/sounds.txt
    cptext doc/reference/soundset.lua   reference/soundset.lua
    cpfile doc/reference/lua2xml	reference/
    cpfile doc/reference/xml2lua	reference/
}

#
# Copy user manual
#
function copy_manual
{
    echo "... copying user manual"
    mkdir $DDIR/manual $DDIR/manual/images
    cpfile doc/manual/images/*.png manual/images
    cpbuiltfile doc/manual/*.html manual
}

#
# Copy reference manual
#
function copy_refman
{
    echo "... copying reference manual"
    mkdir $DDIR/reference $DDIR/reference/images
    cpfile doc/reference/images/*.png reference/images
    cpbuiltfile doc/reference/*.html reference
}

#
# Copy windows DLLs
#
function copy_dlls
{
    echo "... copying DLLs: $DLLS"
    for f in $DLLS; do
        ff="$f.dll"
        if [ -f $ff ]; then
            cp $ff $DDIR/
	else
	    echo "*** DLL missing: $ff ***"
	fi
    done
}

################
# Build Enigma #
################
(cd .. ; make all) >/dev/null

echo "----------------------------------------------------------------"
echo "                 Building Enigma-$VERSION.zip"
echo "----------------------------------------------------------------"


###############
# Find programs
###############

UPX=`which upx`
STRIPFULLPATH=`which $STRIP`
NLCVT="perl $SDIR/etc/nlcvt.pl"

if [ ! ${UPX} ]; then
  echo "*** Program not found: upx" 
  UPX="echo"
fi

if [ ! ${STRIPFULLPATH} ]; then
  echo "*** Program not found: strip"
  STRIP="echo"
fi

###################
# Copy everything #
###################
rm -rf $DDIR
mkdir $DDIR

copy_data
copy_manual
copy_refman
copy_doc

cp $BDIR/etc/enigma.nsi $DDIR/enigma.nsi
cp $BDIR/etc/enigma-inst-lang.nsh $DDIR/enigma-inst-lang.nsh
cp $BDIR/etc/enigma-inst-opt.ini $DDIR/enigma-inst-opt.ini
cp $BDIR/etc/enigma-inst-welcome.bmp $DDIR/enigma-inst-welcome.bmp
cp -p $BDIR/src/enigma.exe $DDIR/enigma.exe

copy_dlls
$STRIP "$DDIR/enigma.exe"
$UPX $DDIR/enigma.exe >/dev/null

rm -f Enigma-w32-$VERSION.zip
zip -r Enigma-w32-$VERSION.zip "Enigma-$VERSION" >/dev/null
rm -rf $DDIR

echo "----------------------------------------------------------------"
echo "                           DONE"
echo "----------------------------------------------------------------"