-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrossbuild-win-releases.sh
executable file
·160 lines (123 loc) · 4.45 KB
/
crossbuild-win-releases.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
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
#!/bin/bash
# script by thorsten kattanek
# excample: crossbuild-win-releases.sh ~/mxe
declare project_name=vgm_player
# Version
version=$(git describe --always --tags)
# check of variable $1
if [ $1 ]; then
declare mxe_path=$1
# check of exist path from variable $1
if [ ! -d $mxe_path ]; then
echo "Not exist the MXE path: " $1
exit
fi
else
echo "Please specify the MXE path (excample: crossbuild-win-releases.sh ~/mxe)"
exit
fi
export PATH=$mxe_path/usr/bin:$PATH
# check and create a public_release dir
if [ ! -d ./public_release ]; then
mkdir ./public_release;
else
rm -rf ./public_release/*
fi
cd public_release
# check of qmake for static i686 and x86_64
declare i686_qmake=$mxe_path/usr/i686-w64-mingw32.static/qt5/bin/qmake
declare x86_64_qmake=$mxe_path/usr/x86_64-w64-mingw32.static/qt5/bin/qmake
if [ ! -e $i686_cmake ]; then
echo "qmake for static i686 is not exist!"
else
declare i686_ok=true
fi
if [ ! -e $x86_64_cmake ]; then
echo "qmake for static x86_64 is not exist!"
else
declare x86_64_ok=true
fi
#### 32Bit Static
if [ $i686_ok ]; then
echo "Creating a i686-Static windows binary ..."
# check and create a build dir
declare build_i686_dir="./build-"$project_name"_"$version"_win_x32"
if [ ! -d $build_i686_dir ]; then
mkdir $build_i686_dir;
else
rm -rf $build_i686_dir/*
fi
# check and delete if exist a install dir
declare install_i686_dir=$PWD"/"$project_name"_"$version"_win_x32"
if [ -d $install_i686_dir ]; then
rm -rf $install_i686_dir/*
fi
echo "Install Dir: "
echo $install_i686_dir
mkdir $install_i686_dir
# compile ts files
lrelease ../vgm_player.pro
# execute qmake
cd $build_i686_dir
$i686_qmake PREFIX=$install_i686_dir ../..
make -j24
make install
cd ..
rm -rf $build_i686_dir
# Convert Unicode to Windows
echo "Convert Unicode TXT to Windows with awk..."
#mv $install_i686_dir/kommandozeilenparameter.txt $install_i686_dir/kommandozeilenparameter_unicode.txt
#awk 'sub("$", "\r")' $install_i686_dir/kommandozeilenparameter_unicode.txt > $install_i686_dir/kommandozeilenparameter.txt
#rm -f $install_i686_dir/kommandozeilenparameter_unicode.txt
#awk 'sub("$", "\r")' $install_i686_dir/LICENSE > $install_i686_dir/LICENSE.txt
#rm -f $install_i686_dir/LICENSE
# compress as 7z
echo "Release 32bit as 7z kompressed..."
7z a -t7z -m0=LZMA -mmt=24 -mx=9 -md=96m -mfb=256 $install_i686_dir".7z" $install_i686_dir
rm -rf $install_i686_dir
# SHA512 Hashwert erzeugen
sha512sum -b $project_name"_"$version"_win_x32.7z" >> $project_name"_"$version"_win_x32.7z.sha512"
fi
### 64Bit Static
if [ $x86_64_ok ]; then
echo "Creating a x86_64-Static windows binary ..."
# check and create a build dir
declare build_x86_64_dir="./build-"$project_name"_"$version"_win_x64"
if [ ! -d $build_x86_64_dir ]; then
mkdir $build_x86_64_dir;
else
rm -rf $build_x86_64_dir/*
fi
# check and delete if exist a install dir
declare install_x86_64_dir=$PWD"/"$project_name"_"$version"_win_x64"
if [ -d $install_x86_64_dir ]; then
rm -rf $install_x86_64_dir/*
fi
mkdir $install_x86_64_dir
# compile ts files
lrelease ../vgm_player.pro
# execute qmake
cd $build_x86_64_dir
$x86_64_qmake PREFIX=$install_x86_64_dir ../..
make -j24
make install
cd ..
rm -rf $build_x86_64_dir
# Convert Unicode to Windows
echo "Convert Unicode TXT to Windows with awk..."
#mv $install_x86_64_dir/kommandozeilenparameter.txt $install_x86_64_dir/kommandozeilenparameter_unicode.txt
#awk 'sub("$", "\r")' $install_x86_64_dir/kommandozeilenparameter_unicode.txt > $install_x86_64_dir/kommandozeilenparameter.txt
#rm -f $install_x86_64_dir/kommandozeilenparameter_unicode.txt
#awk 'sub("$", "\r")' $install_x86_64_dir/LICENSE > $install_x86_64_dir/LICENSE.txt
#rm -f $install_x86_64_dir/LICENSE
# compress as 7z
echo "Release 64bit as 7z kompressed..."
7z a -t7z -m0=LZMA -mmt=24 -mx=9 -md=96m -mfb=256 $install_x86_64_dir".7z" $install_x86_64_dir
rm -rf $install_x86_64_dir
# SHA512 Hashwert erzeugen
sha512sum -b $project_name"_"$version"_win_x64.7z" >> $project_name"_"$version"_win_x64.7z.sha512"
fi
cd ..
echo "--> Die fertigen Pakete befinden sich im Verzeichnis 'public_release' !"
echo ""
echo "E.N.D.E"