forked from SmartisanTech/Wrench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-wine.sh
executable file
·144 lines (122 loc) · 3.24 KB
/
build-wine.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
#!/bin/bash
set -e
cd $(dirname $(readlink -f $0))
## start code-generator "^\\s *#\\s *"
# generate-getopt @build-snore
## end code-generator
## start generated code
TEMP=$(getopt -o h \
--long build-snore,help,no-build-snore \
-n $(basename -- $0) -- "$@")
build_snore=false
eval set -- "$TEMP"
while true; do
case "$1" in
--build-snore|--no-build-snore)
if test "$1" = --no-build-snore; then
build_snore=false
else
build_snore=true
fi
shift
;;
-h|--help)
set +x
echo
echo
echo Options and arguments:
printf "%06s" " "
printf %-24s '--[no-]build-snore'
echo
exit
shift
;;
--)
shift
break
;;
*)
die "internal error: $(. bt; echo; bt | indent-stdin)"
;;
esac
done
## end generated code
if test ! -e ~/src/github/Wrench/windows/binaries/libsnore-qt5.dll || test "$build_snore" = true; then
(
cd ~/src/github/Wrench/SnoreNotify
./build-wine.sh
)
fi
function deploy-wrench()
{
rsync windows/binaries/* ./release -v -L -r
rsync *.lua ./release -v
(
cd ./release
mkdir -p tmp
mv adb.exe the-true-adb.exe luac.exe lua.exe tmp/
qt-wine windeployqt --qmldir z:$HOME/src/github/Wrench/SnoreNotify/src/plugins/backends/snore -qml -quick .
mv tmp/* .
rmdir tmp
find . -iname '*.dll' -o -iname '*.exe' |xargs chmod +x
relative-link ~/src/github/Wrench/*.lua . -f
)
}
function make-release-tgz()
{
# rsync readme.* ./release/
rsync -a *.png ./release/
command rsync -a -d release/ download/release/ wrench-release --exclude="*.obj" \
--exclude="*.o" \
--exclude="*.cpp" \
--exclude="*.moc" \
--delete
set -x
if test "$DOING_WRENCH_RELEASE"; then
command rsync wrench-release/ $release_dir -a -L --delete --exclude=.git
exit
fi
cd $build_dir/release
myscr bash -c "WINEARCH=win32 WINEPREFIX=~/.wine2 SNORE_QML=z:$HOME/src/github/Wrench/SnoreNotify/src/plugins/backends/snore/notification.qml wine cmd /c ./Wrench.exe"
}
set -e
set -o pipefail
function wine() {
cat > build.bat<<EOF
set path=$(for x in ~/.wine/drive_c/Qt/Qt*/*/mingw*/bin; do
echo $x;
done |
perl -npe 'chomp; s!$ENV{HOME}/.wine/drive_c!c:!; s!$!;!')%path%
$@
EOF
command wine cmd.exe /c build.bat
}
build_dir=~/tmp/build-wrench-windows/fix-snore-symlink
mkdir -p $build_dir
release_dir=~/src/github/Wrench-windows
rsync * $build_dir -a --exclude release
rsync release $build_dir -a -L
cd $build_dir
if ! which i686-w64-mingw32-nm; then
sudo apt-get install mingw32
fi
(
cd lua
PATH=~/system-config/bin/mingw:$PATH make -j8 mingw
)
(
cd luamd5
PATH=~/system-config/bin/mingw/:$PATH make -j8 PLATFORM=mingw
)
for x in . download; do
(
cd $x
if test ! -e Makefile; then
wine qmake.exe
fi
wine mingw32-make.exe -j8 | perl -npe 's/\\/\//g'
)
done
deploy-wrench
set -x
make-release-tgz