/
dist_bin.sh
executable file
·120 lines (111 loc) · 2.64 KB
/
dist_bin.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
#!/bin/sh
# make a binary only distribution
OS=`uname -s`
package=maxent
COMPRESS=touch # do nothing by default
if [ -x /usr/bin/upx ]; then
COMPRESS=/usr/bin/upx
fi
if [ -x /usr/local/bin/upx ]; then
COMPRESS=/usr/local/bin/upx
fi
if [ `echo $CC | grep mingw` ]; then
OS=XMINGW32
if [ -x /usr/local/mingw32/bin/upx.exe ]; then
COMPRESS="wine -- /usr/local/mingw32/bin/upx.exe"
fi
fi
build_unix() {
platform=$1
./configure --enable-static
make
tmp_dir=`mktemp -d /tmp/tmp_build.XXXXXX`
cd src/opt
strip maxent
$COMPRESS maxent
cd -
cp README LICENSE src/opt/maxent $tmp_dir
cd $tmp_dir
tar cf ${package}-${platform}-static.tar README LICENSE maxent
gzip ${package}-${platform}-static.tar
cd -
mv $tmp_dir/${package}-${platform}-static.tar.gz .
rm -rf $tmp_dir
echo "Done!"
}
build_cygwin() {
./configure --enable-static
make
tmp_dir=`mktemp -d /tmp/tmp_build.XXXXXX`
cd src/opt
strip maxent.exe
cd -
cp README LICENSE src/opt/maxent.exe $tmp_dir
cp /usr/bin/cygwin1.dll $tmp_dir
cd $tmp_dir
zip -j ${package}-cygwin-static.zip README LICENSE maxent.exe cygwin1.dll
cd -
mv $tmp_dir/${package}-cygwin-static.zip .
rm -rf $tmp_dir
echo "Done!"
}
build_mingw() {
./configure --enable-static
make
tmp_dir='tmp_build'
rm -rf $tmp_dir
mkdir $tmp_dir
cd src/opt
strip maxent.exe
$COMPRESS maxent.exe
cd -
cp README LICENSE src/opt/maxent.exe $tmp_dir
cd $tmp_dir
tar zcf ${package}-mingw32-static.tar.gz README LICENSE maxent.exe
mv ${package}-mingw32-static.tar.gz ..
cd -
rm -rf $tmp_dir
echo "Done!"
}
build_cross_mingw() {
STRIP=/usr/local/bin/mingw32-strip
./configure --prefix=/usr/local/mingw32/ --host=i386-pc-mingw32 --enable-static
make
tmp_dir=`mktemp -d /tmp/tmp_build.XXXXXX`
cd src/opt
$STRIP maxent.exe
$COMPRESS maxent.exe
cd -
cp README LICENSE src/opt/maxent.exe $tmp_dir
cd $tmp_dir
zip -j ${package}-mingw32-static.zip README LICENSE maxent.exe
mv ${package}-mingw32-static.zip ..
cd -
rm -rf $tmp_dir
echo "Done! See /tmp for result file."
}
case $OS in
FreeBSD)
echo "Building FreeBSD binaries"
build_unix freebsd
;;
Linux)
echo "Building Linux binaries"
build_unix linux
;;
CYGWIN*)
echo "Building Cygwin binaries"
build_cygwin
;;
MINGW32*)
echo "Building MingW32 binaries"
build_mingw
;;
XMINGW32*)
echo "Building Cross MingW32 binaries"
build_cross_mingw
;;
*)
echo "Sorry your OS is not supported yet"
;;
esac