forked from pantherb/setBfree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
x-win-bundle.sh
executable file
·176 lines (145 loc) · 4.99 KB
/
x-win-bundle.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/bash
: ${XARCH=i686} # or x86_64
: ${SRC=/usr/src}
: ${OUTDIR=/var/tmp}
if test "$XARCH" = "x86_64"; then
echo "Target: 64bit Windows (x86_64)"
XPREFIX=x86_64-w64-mingw32
HPREFIX=x86_64
WARCH=w64
else
echo "Target: 32 Windows (i686)"
XPREFIX=i686-w64-mingw32
HPREFIX=i386
WARCH=w32
fi
: ${PREFIX=$SRC/win-stack-$WARCH}
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
set -e
make \
XWIN=${XPREFIX} \
clean
make \
XWIN=${XPREFIX} \
CFLAGS="-I${PREFIX}/include -fvisibility=hidden -DNDEBUG -DPTW32_STATIC_LIB -msse -msse2 -mfpmath=sse -fomit-frame-pointer -O3 -mstackrealign -fno-finite-math-only -I${PREFIX}/src -DUSE_WEAK_JACK" \
LDFLAGS="-L${PREFIX}/lib -fvisibility=hidden" \
ENABLE_CONVOLUTION=no \
WEAKJACK="${PREFIX}/src/weakjack/weak_libjack.c" \
SUBDIRS="b_synth ui" \
$@
### package
PRODUCT_NAME=setBfree
XREGKEY=setbfree
if [ "$(id -u)" = "0" ]; then
apt-get -y install nsis curl
fi
GITVERSION=$(git describe --tags | sed 's/-g.*$//')
BUILDDATE=$(date -R)
BINVERSION=$(git describe --tags | sed 's/-g.*$//' | sed 's/-/./')
if test -z "$GITVERSION"; then
echo "*** Cannot query version information."
exit 1
fi
OUTFILE="${OUTDIR}/${PRODUCT_NAME}-${GITVERSION}-${WARCH}-Setup.exe"
################################################################################
DESTDIR=`mktemp -d`
trap 'rm -rf $DESTDIR' exit SIGINT SIGTERM
echo " === bundle to $DESTDIR"
mkdir -p $DESTDIR/share
mkdir -p ${DESTDIR}/b_synth.lv2
cp -v b_synth/*.ttl b_synth/*.dll "$DESTDIR/b_synth.lv2"
cp -v COPYING "$DESTDIR/share/"
cp -v ui/setBfreeUI.exe "$DESTDIR/"
cp -v doc/setbfree.ico "$DESTDIR/share/"
#cp -v doc/win_readme.txt "${DESTDIR}/README.txt"
echo " === complete"
du -sh $DESTDIR
################################################################################
echo " === Preparing Windows Installer"
NSISFILE="$DESTDIR/sbf.nsis"
if test "$WARCH" = "w64"; then
PGF=PROGRAMFILES64
CMF=COMMONFILES64
else
PGF=PROGRAMFILES
CMF=COMMONFILES
fi
if test -n "$QUICKZIP" ; then
cat > "$NSISFILE" << EOF
SetCompressor zlib
EOF
else
cat > "$NSISFILE" << EOF
SetCompressor /SOLID lzma
SetCompressorDictSize 32
EOF
fi
cat >> "$NSISFILE" << EOF
!include MUI2.nsh
Name "${PRODUCT_NAME}"
OutFile "${OUTFILE}"
RequestExecutionLevel admin
InstallDir "\$${PGF}\\${PRODUCT_NAME}"
InstallDirRegKey HKLM "Software\\RSS\\${XREGKEY}\\$WARCH" "Install_Dir"
!define MUI_ICON "share\\setbfree.ico"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_LICENSE "share\\COPYING"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "LV2 Plugin (required)" SecLV2
SectionIn RO
SetOutPath "\$${CMF}\\LV2"
File /r b_synth.lv2
SetOutPath "\$INSTDIR"
File /nonfatal README.txt
WriteRegStr HKLM SOFTWARE\\RSS\\${XREGKEY}\\$WARCH "Install_Dir" "\$INSTDIR"
WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${XREGKEY}" "DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${XREGKEY}" "UninstallString" '"\$INSTDIR\\uninstall.exe"'
WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${XREGKEY}" "NoModify" 1
WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${XREGKEY}" "NoRepair" 1
WriteUninstaller "\$INSTDIR\uninstall.exe"
SetShellVarContext all
CreateDirectory "\$SMPROGRAMS\\${PRODUCT_NAME}"
CreateShortCut "\$SMPROGRAMS\\${PRODUCT_NAME}\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0
SectionEnd
Section "JACK Application" SecJACK
SetOutPath \$INSTDIR
File setBfreeUI.exe
SetShellVarContext all
CreateDirectory "\$SMPROGRAMS\\${PRODUCT_NAME}"
CreateShortCut "\$SMPROGRAMS\\${PRODUCT_NAME}\\setBfree.lnk" "\$INSTDIR\\setBfreeUI.exe" "0" "\$INSTDIR\\setBfreeUI.exe" 0
SectionEnd
LangString DESC_SecLV2 \${LANG_ENGLISH} "${PRODUCT_NAME}.lv2 ${GITVERSION}\$\\r\$\\nLV2 Plugins.\$\\r\$\\n${BUILDDATE}"
LangString DESC_SecJACK \${LANG_ENGLISH} "Standalone JACK clients and start-menu shortcuts"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT \${SecLV2} \$(DESC_SecLV2)
!insertmacro MUI_DESCRIPTION_TEXT \${SecJACK} \$(DESC_SecJACK)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "Uninstall"
SetShellVarContext all
DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${XREGKEY}"
DeleteRegKey HKLM SOFTWARE\\RSS\\${XREGKEY}\\$WARCH
RMDir /r "\$${CMF}\\LV2\\b_synth.lv2"
Delete "\$INSTDIR\\setBfreeUI.exe"
Delete "\$INSTDIR\\README.txt"
Delete "\$INSTDIR\uninstall.exe"
RMDir "\$INSTDIR"
Delete "\$SMPROGRAMS\\${PRODUCT_NAME}\\*.*"
RMDir "\$SMPROGRAMS\\${PRODUCT_NAME}"
SectionEnd
EOF
#cat -n "$NSISFILE"
rm -f ${OUTFILE}
echo " === OutFile: $OUTFILE"
if test -n "$QUICKZIP" ; then
echo " === Building Windows Installer (fast zip)"
else
echo " === Building Windows Installer (lzma compression takes ages)"
fi
time makensis -V2 "$NSISFILE"
rm -rf $DESTDIR
ls -lh "$OUTFILE"