win: Update bundle scripts

Build a single EXE version (issue 2)
This commit is contained in:
Alexander Kojevnikov 2012-08-29 21:27:13 -07:00
parent e88efbe959
commit 592b9055db
8 changed files with 109 additions and 104 deletions

3
.gitignore vendored
View File

@ -1,7 +1,9 @@
*.a
*.exe
*.msi
*.o
*.xz
*.zip
*~
.DS_Store
.deps
@ -19,6 +21,7 @@ depcomp
dist/osx/Spek.app
dist/osx/Spek.dmg
dist/osx/spek.modules
dist/win/Spek
dist/win/spek.wxs
install-sh
intltool-extract.in

View File

@ -7,9 +7,6 @@ SUBDIRS = \
tests
EXTRA_DIST = \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
dist/osx/DS_Store \
dist/osx/Info.plist \
dist/osx/README.md \
@ -19,13 +16,18 @@ EXTRA_DIST = \
dist/osx/launcher.sh \
dist/osx/spek.bundle \
dist/osx/spek.modules \
dist/win/README.md \
dist/win/banner.bmp \
dist/win/bundle.bat \
dist/win/bundle.sh \
dist/win/dialog.bmp \
dist/win/fix-msi.js \
dist/win/spek.ico \
dist/win/spek.rc \
dist/win/spek.wxs
dist/win/spek.wxs \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
DISTCLEANFILES = \
intltool-extract \

View File

@ -51,7 +51,7 @@ GETTEXT_PACKAGE=spek
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package])
AC_SUBST(GETTEXT_PACKAGE)
AM_GNU_GETTEXT_VERSION([0.18.1])
AM_GNU_GETTEXT([external])
AM_PO_SUBDIRS
AC_CONFIG_FILES([
Makefile

View File

@ -1,5 +1,4 @@
Spek release checklist
==============================================================================
# Spek release checklist
* Bump the version number in configure.ac.
* `cd po && make update-po && tx push -s`.

26
dist/win/README.md vendored Normal file
View File

@ -0,0 +1,26 @@
# Building the Windows installer
This is done in two steps:
* Cross-compiling spek.exe using [MXE](http://mxe.cc/)
* Building the MSI package under Windows
For the first step you can use any Unix-y environment. Set up
[MXE](http://mxe.cc/#tutorial), you can use the code from
[this repository](https://github.com/alexkay/mxe/tree/spek) or the official one.
Build Spek dependencies:
```
% make pthreads ffmpeg wxwidgets
```
Build Spek, adjusting `bundle.sh` variables as necessary:
```
% ./dist/win/bundle.sh
```
For the second step, you will need a Windows box with
[WiX](http://wix.sourceforge.net/) installed. Copy over the entire `dist/win`
directory and run `bundle.bat`.

21
dist/win/bundle.bat vendored Normal file
View File

@ -0,0 +1,21 @@
rem This script will build an MSI installer for Win32.
rem Check README.md in this directory for instructions.
set WIX_PATH=c:\Program Files\Windows Installer XML v3.5\bin
del spek.msi
rem Generate a wxs for files in Spek
move Spek\spek.exe .\
"%WIX_PATH%"\heat dir Spek -gg -ke -srd -cg Files -dr INSTALLLOCATION -template fragment -o files.wxs
move spek.exe Spek\
rem Make the MSI package
"%WIX_PATH%"\candle spek.wxs files.wxs
"%WIX_PATH%"\light -ext WixUIExtension.dll -b Spek spek.wixobj files.wixobj -o spek.msi
start /wait fix-msi.js spek.msi
rem Clean up
del files.wxs
del *.wixobj
del *.wixpdb

125
dist/win/bundle.sh vendored
View File

@ -1,95 +1,54 @@
#!/usr/bin/env bash
#!/bin/sh
# This script will build a ZIP archive and an MSI installer for Win32.
# It requires a fully functioning MinGW/MSYS environment.
# The script also depends on 7z and WiX.
# This script will cross-compile spek.exe, make a ZIP archive and prepare files
# for building an MSI installer under Windows.
# Check README.md in this directory for instructions.
WIX_PATH=c:/Program\ Files/Windows\ Installer\ XML\ v3.5/bin
SZ_PATH=c:/Program\ Files/7-Zip
# Adjust these variables if necessary.
HOST=i686-pc-mingw32
LANGUAGES="cs da de eo es fr it ja nl pl pt_BR ru sv uk zh_CN zh_TW"
MAKE=gmake
MXE=$(realpath $(dirname $0)/../../../mxe/usr/i686-pc-mingw32)
STRIP=$(which i686-pc-mingw32-strip)
UPX=$(which upx)
WINDRES=$(which i686-pc-mingw32-windres)
WX_CONFIG="$MXE"/bin/wx-config
ZIP=$(which zip)
pushd $(dirname $0)/../..
rm -fr dist/win/Spek
mkdir dist/win/Spek
rm dist/win/spek.{msi,zip}
cd $(dirname $0)/../..
rm -fr dist/win/build && mkdir dist/win/build
# Compile the resource file
windres dist/win/spek.rc -O coff -o dist/win/spek.res
"$WINDRES" dist/win/spek.rc -O coff -o dist/win/spek.res
mkdir -p src/dist/win && cp dist/win/spek.res src/dist/win/
CFLAGS="-mwindows" LDFLAGS="dist/win/spek.res" ./configure --prefix=${PWD}/dist/win/Spek && make && make install
# Compile and strip spek.exe
LDFLAGS="dist/win/spek.res" ./configure \
--host="$HOST" \
--with-wx-config="$WX_CONFIG" \
--prefix=${PWD}/dist/win/build && \
"$MAKE" && \
"$MAKE" install
"$STRIP" dist/win/build/bin/spek.exe
"$UPX" dist/win/build/bin/spek.exe
cd dist/win/Spek
urls=(\
# GTK+ and its dependencies
"http://ftp.gnome.org/pub/gnome/binaries/win32/atk/1.32/atk_1.32.0-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/gdk-pixbuf/2.22/gdk-pixbuf_2.22.1-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.1-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+_2.24.0-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.28/pango_1.28.3-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo_1.10.2-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/expat_2.0.1-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/fontconfig_2.8.0-2_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/freetype_2.4.4-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/hicolor-icon-theme_0.10-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng_1.4.3-1_win32.zip" \
"http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib_1.2.5-2_win32.zip" \
)
for url in ${urls[*]}
do
wget $url
if [ $? != 0 ]; then
echo "Can't get $url"
popd
exit 1
fi
name=$(basename $url)
"$SZ_PATH"/7z x -y $name
rm $name
# Copy files to the bundle
cd dist/win
rm -fr Spek && mkdir Spek
cp build/bin/spek.exe Spek/
for lang in $LANGUAGES; do
mkdir -p Spek/"$lang"
cp build/lib/locale/"$lang"/LC_MESSAGES/spek.mo Spek/"$lang"/
cp "$MXE"/share/locale/"$lang"/LC_MESSAGES/wxstd.mo Spek/"$lang"/
done
# ffmpeg configure options:
# ./configure --disable-static --enable-shared --enable-gpl --enable-version3 --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-swscale --disable-postproc --enable-pthreads --disable-encoders --disable-muxers --disable-devices --disable-filters --enable-memalign-hack --enable-runtime-cpudetect --disable-debug --prefix=/usr
cp /usr/bin/avcodec-53.dll bin/
cp /usr/bin/avformat-53.dll bin/
cp /usr/bin/avutil-51.dll bin/
# Clean up
mv bin/spek.exe ../
mkdir share/locale_
mv share/locale/{cs,da,de,eo,es,fr,it,ja,nl,pl,pt_BR,ru,sv,uk,zh_CN,zh_TW} share/locale_/
rm -fr share/locale
mv share/locale_ share/locale
rm -fr doc
rm -fr presets
rm -fr manifest
rm bin/*.exe
# Set the default GTK theme
echo "gtk-theme-name = \"MS-Windows\"" > etc/gtk-2.0/gtkrc
cd ..
# Generate a wxs for files in Spek
"$WIX_PATH"/heat dir Spek -gg -ke -srd -cg Files -dr INSTALLLOCATION -template fragment -o files.wxs
# Make the MSI package
"$WIX_PATH"/candle spek.wxs files.wxs
"$WIX_PATH"/light -ext WixUIExtension.dll -b Spek spek.wixobj files.wixobj -o spek.msi
start fix-msi.js spek.msi
# Clean up
rm *.res
rm *.wixobj
rm *.wixpdb
rm -fr build
# Create a zip archive
mv spek.exe Spek/bin/
cp spek.ico Spek/
"$SZ_PATH"/7z a spek.zip Spek
rm -f spek.zip
"$ZIP" -r spek.zip Spek
popd
cd ../..
# Clean up
rm -fr src/dist
rm dist/win/spek.res

23
dist/win/spek.wxs.in vendored
View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?define ProductName = "Spek" ?>
<?define Manufacturer = "Spek Project" ?>
<?define ProductVersion = "@VERSION@.0" ?>
<?define ProductVersion = "@VERSION@" ?>
<?define UpgradeCode = "46D51DDF-5749-45E2-818B-1ACADF21C0D9" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.ProductName)" Language="0"
@ -32,7 +32,7 @@
<Icon Id="ProgramIcon" SourceFile="spek.ico"/>
<DirectoryRef Id="ProgramMenuSubfolder">
<Component Id="StartMenuShortcut" Guid="165DF12B-D970-49BC-B07B-880B62ABC308">
<Shortcut Id="StartMenuShortcut" Name="$(var.ProductName)" Icon="ProgramIcon" Target="[INSTALLLOCATION]bin\spek.exe" WorkingDirectory="bin"/>
<Shortcut Id="StartMenuShortcut" Name="$(var.ProductName)" Icon="ProgramIcon" Target="[INSTALLLOCATION]spek.exe" WorkingDirectory="INSTALLLOCATION"/>
<Shortcut Id="UninstallProduct" Name="Uninstall $(var.ProductName)" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]"/>
<RemoveFolder Id="ProgramMenuSubfolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
@ -40,7 +40,7 @@
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcut" Guid="ACCE1EDB-87E3-4FE5-B2BF-93113E767381">
<Shortcut Id="DesktopShortcut" Name="$(var.ProductName)" Icon="ProgramIcon" Target="[INSTALLLOCATION]bin\spek.exe" WorkingDirectory="bin"/>
<Shortcut Id="DesktopShortcut" Name="$(var.ProductName)" Icon="ProgramIcon" Target="[INSTALLLOCATION]spek.exe" WorkingDirectory="INSTALLLOCATION"/>
<RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
@ -54,27 +54,28 @@
<Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
<Component Id="Main" Guid="CD5121AD-F799-4796-9DB8-0C24CA0A4C8E">
<File Id="spek.ico" Name="spek.ico" Source="spek.ico" />
<File Id="spek.exe" Name="spek.exe" Source="spek.exe" />
<!-- Capabilities keys for Vista/7 "Set Program Access and Defaults" -->
<RegistryValue Root="HKLM" Key="SOFTWARE\Spek\Capabilities" Name="ApplicationDescription" Value="Acoustic Spectrum Analyser" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Spek\Capabilities" Name="ApplicationIcon" Value="[#spek.ico]" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Spek\Capabilities" Name="ApplicationName" Value="Spek" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Spek\Capabilities\DefaultIcon" Value="[#spek.ico]" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Spek\Capabilities\shell\open\command" Value="&quot;[INSTALLLOCATION]bin\spek.exe&quot; &quot;%1&quot;" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Spek\Capabilities\shell\open\command" Value="&quot;[INSTALLLOCATION]spek.exe&quot; &quot;%1&quot;" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\RegisteredApplications" Name="Spek" Value="SOFTWARE\Spek\Capabilities" Type="string" />
<!-- App Paths to support Start,Run -> "spek" -->
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spek.exe" Value="[INSTALLLOCATION]bin\spek.exe" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spek.exe" Name="Path" Value="[INSTALLLOCATION]bin" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spek.exe" Value="[INSTALLLOCATION]spek.exe" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spek.exe" Name="Path" Value="[INSTALLLOCATION]" Type="string" />
<!-- Extend to the "open with" list + Win7 jump menu pinning -->
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\spek.exe" Value="Acoustic Spectrum Analyser" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\spek.exe" Name="FriendlyAppName" Value="Spek" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\spek.exe\DefaultIcon" Value="[#spek.ico]" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\spek.exe\shell\open\command" Value="&quot;[INSTALLLOCATION]bin\spek.exe&quot; &quot;%1&quot;" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\spek.exe\shell\open\command" Value="&quot;[INSTALLLOCATION]spek.exe&quot; &quot;%1&quot;" Type="string" />
<!-- Spek.Audio class -->
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Spek.Audio" Value="Spek Audio File" KeyPath="yes" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Spek.Audio" Name="FriendlyTypeName" Value="Spek Audio File" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Spek.Audio\DefaultIcon" Value="[#spek.ico]" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Spek.Audio\shell" Value="open" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Spek.Audio\shell\open\command" Value="&quot;[INSTALLLOCATION]bin\spek.exe&quot; &quot;%1&quot;" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Spek.Audio\shell\open\command" Value="&quot;[INSTALLLOCATION]spek.exe&quot; &quot;%1&quot;" Type="string" />
<!-- Associate with file extensions -->
<?foreach ext in "3gp;aac,aif;aifc;aiff;amr;awb;ape;au;dts;flac;gsm;m4a;m4p;mp3;mp4;mp+;mpc;mpp;oga;ogg;ra;ram;snd;wav;wma;wv"?>
<RegistryValue Root="HKLM" Key="SOFTWARE\Spek\Capabilities\FileAssociations" Name=".$(var.ext)" Value="Spek.Audio" Type="string" />
@ -83,17 +84,11 @@
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\.$(var.ext)\OpenWithProgids" Name="Spek.Audio" Value="" Type="string" />
<?endforeach?>
</Component>
<Directory Id="bin" Name="bin">
<Component Id="Spek" Guid="EC0CA007-EC9E-44E2-B9DE-AE91D3C8EF70">
<File Id="spek.exe" Name="spek.exe" Source="spek.exe" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="All" Title="$(var.ProductName)" Level="1">
<ComponentRef Id="Main" />
<ComponentRef Id="Spek" />
<ComponentGroupRef Id="Files" />
<ComponentRef Id="StartMenuShortcut" />
<ComponentRef Id="DesktopShortcut" />