Skip to content
Permalink
Browse files

Build scripts updated for 2.0 release

  • Loading branch information...
gyunaev
gyunaev committed Dec 13, 2015
1 parent e63378d commit d1a457f5768be221c14eb0bb5e1cb1df21ac455e
Showing with 178 additions and 75 deletions.
  1. +96 −65 build-release.sh
  2. +10 −2 build-win32-mingw.sh
  3. +46 −6 nsis/create_installer.sh
  4. +26 −2 nsis/installer.nsis
@@ -2,12 +2,7 @@

RELEASEDIR="releases"

# Path to (cross-platform) mingw compiler
MINGWPATH=/usr/toolchains/windows-x86-mingw-qtsdl/bin
QMAKE=i686-pc-mingw32-qmake

FILE_VERSION="src/version.h"
RPM_ARCH="i586"
RPM_OUTDIR="$HOME/rpmbuild/RPMS/"

# Get current version
@@ -36,65 +31,101 @@ rm -rf "$BUILDDIR/example"
# Source package without examples
tar zcf "$OUTDIR/$BUILDDIR.tar.gz" $BUILDDIR || exit 1

# Making an RPM
rm -rf "$BUILDDIR/buildroot"
mkdir -p "$BUILDDIR/buildroot/usr/bin"
mkdir -p "$BUILDDIR/buildroot/usr/share/applications"
mkdir -p "$BUILDDIR/buildroot/usr/share/pixmaps"
cp packages/karlyriceditor.desktop "$BUILDDIR/buildroot/usr/share/applications"
cp packages/karlyriceditor.png "$BUILDDIR/buildroot/usr/share/pixmaps"

# Prepare a spec file
sed "s/^Version: [0-9.]\\+/Version: $CURRENTVER/" packages/rpm.spec > $BUILDDIR/rpm.spec

# Build a 64-bit version
(cd "$BUILDDIR" && qmake -r -spec linux-g++-64 && make -j4) || exit 1
strip --strip-all "$BUILDDIR/bin/karlyriceditor" -o "$BUILDDIR/buildroot/usr/bin/karlyriceditor" || exit 1

# Build a 64-bit RPM
rpmbuild -bb --target=x86_64 --buildroot `pwd`"/$BUILDDIR/buildroot/" $BUILDDIR/rpm.spec || exit 1
mv $RPM_OUTDIR/x86_64/*.rpm "$OUTDIR/" || exit 1

# Clean up
pushd "$BUILDDIR"
make distclean

for lib in crypto avformat avcodec swscale avresample avutil SDL QtGui QtCore; do

libpath=`find /lib /usr/lib/ -name lib$lib\* | sort -r | head -n1`
if [ -z "$libpath" ]; then
echo "No library $lib found"
exit
fi

ln -s $libpath "src/lib$lib.so"
# win32
sh build-win32-mingw.sh -nsis || exit 1
mv build.win32/nsis/InstallKarLyricEditor*.exe $OUTDIR/ || exit 1
rm -rf "build.win32"

# Linux RPMs
for target in qt5-32 qt5-64 qt4-32 qt4-64; do

echo "Building for $target"
rm -rf "$BUILDDIR"
svn export . "$BUILDDIR/" || exit 1

# Get the Qt version
case $target in
qt4-*)
QMAKE=qmake
QTLIBS="QtGui QtCore"
RPMSUFFIX="qt4"
;;

qt5-*)
QMAKE=qmake-qt5
QTLIBS="Qt5Widgets Qt5Gui Qt5Core"
RPMSUFFIX="qt5"
;;

*)
echo "Invalid target"
exit 1
esac

# Get the arch
case $target in
*-32)
QMAKESPEC="linux-g++-32"
RPMARCH="i586"
LINKLIBS="pthread crypto avformat avcodec swscale avresample avutil SDL $QTLIBS"

;;

*-64)
QMAKESPEC="linux-g++-64"
RPMARCH="x86_64"
;;

*)
echo "Invalid arch"
exit 1
esac

# Hack the libs
if [ -n "$LINKLIBS" ]; then
pushd $BUILDDIR

# Link the libraries so the linker finds the 32-bit libs instead of 64-bit ones
for lib in $LINKLIBS; do

libpath=`find /lib /usr/lib/ -maxdepth 1 -name lib$lib.so | sort -r | head -n1`
if [ -z "$libpath" ]; then
libpath=`find /lib /usr/lib/ -maxdepth 1 -name lib$lib.so\.[0-9] | sort -r | head -n1`
if [ -z "$libpath" ]; then
libpath=`find /lib /usr/lib/ -maxdepth 1 -name lib$lib.so\.[0-9.]* | sort -r | head -n1`

if [ -z "$libpath" ]; then
echo "No library $lib found"
exit
fi
fi
fi

ln -s $libpath "src/lib$lib.so"
done
popd
fi

# Build it
(cd "$BUILDDIR" && $QMAKE -r -spec $QMAKESPEC "CONGIF+=release" && make -j4) || exit 1

# Making an RPM
rm -rf "$BUILDDIR/buildroot"
mkdir -p "$BUILDDIR/buildroot/usr/bin"
mkdir -p "$BUILDDIR/buildroot/usr/share/applications"
mkdir -p "$BUILDDIR/buildroot/usr/share/pixmaps"
cp packages/karlyriceditor.desktop "$BUILDDIR/buildroot/usr/share/applications"
cp packages/karlyriceditor.png "$BUILDDIR/buildroot/usr/share/pixmaps"
strip --strip-all "$BUILDDIR/bin/karlyriceditor" -o "$BUILDDIR/buildroot/usr/bin/karlyriceditor" || exit 1

# Prepare a spec file
sed "s/^Version: [0-9.]\\+/Version: $CURRENTVER/" packages/rpm.spec > $BUILDDIR/rpm.spec

# Build an RPM
rpmbuild -bb --target=$RPMARCH --buildroot `pwd`"/$BUILDDIR/buildroot/" $BUILDDIR/rpm.spec || exit 1
mv $RPM_OUTDIR/$RPMARCH/karlyriceditor-$CURRENTVER-1.$RPMARCH.rpm "$OUTDIR/karlyriceditor-$CURRENTVER-1.${RPMARCH}-${RPMSUFFIX}.rpm" || exit 1
rm -rf "$BUILDDIR"
done
popd

# Build a 32-bit version
rm -rf "$BUILDDIR/buildroot"
mkdir -p "$BUILDDIR/buildroot/usr/bin"
mkdir -p "$BUILDDIR/buildroot/usr/share/applications"
mkdir -p "$BUILDDIR/buildroot/usr/share/pixmaps"
cp packages/karlyriceditor.desktop "$BUILDDIR/buildroot/usr/share/applications"
cp packages/karlyriceditor.png "$BUILDDIR/buildroot/usr/share/pixmaps"

(cd "$BUILDDIR" && qmake -r -spec linux-g++-32 && make -j4) || exit 1
strip --strip-all "$BUILDDIR/bin/karlyriceditor" -o "$BUILDDIR/buildroot/usr/bin/karlyriceditor" || exit 1

# Build a 32-bit RPM
rpmbuild -bb --target=i586 --buildroot `pwd`"/$BUILDDIR/buildroot/" $BUILDDIR/rpm.spec || exit 1
mv $RPM_OUTDIR/i586/*.rpm "$OUTDIR/" || exit 1


rm -rf "$BUILDDIR"

# Win32 build
svn export . "$BUILDDIR/" || exit 1
export PATH=$MINGWPATH:$PATH
(cd $BUILDDIR && $QMAKE -r "CONFIG += release" && make -j4) || exit 1

# installer
(cd $BUILDDIR/nsis && sh create_installer.sh "$CURRENTVER") || exit 1
mv $BUILDDIR/nsis/*.exe "$OUTDIR/"

rm -rf /home/tim/rpmbuild
echo "Done! Version $CURRENTVER released!"
@@ -2,7 +2,10 @@

# Path to (cross-platform) mingw compiler
MINGWPATH=/usr/toolchains/windows-x86-complete
QMAKE=$MINGWPATH/i686-pc-mingw32/qt4-static/bin/qmake

# We cannot build statically because Webkit is not statically linkable
QMAKE=$MINGWPATH/i686-w64-mingw32.static/qt4-shared/bin/qmake


BUILDDIR="build.win32"

@@ -17,4 +20,9 @@ cd "$BUILDDIR"

# Compile it
export PATH=$MINGWPATH/bin:$PATH
$QMAKE -r "CONFIG += release" && make -j4 || exit 1
$QMAKE -r "CONFIG -= release_and_debug" "CONFIG += release" && make -j4 || exit 1

if [ "x$1" == "x-nsis" ]; then
(cd nsis && sh create_installer.sh) || exit 1
fi

@@ -1,21 +1,61 @@
#!/bin/sh

# Version
if [ -z "$1" ]; then
echo "Usage: $0 <version>"
exit 1
fi
# File to get the version from
FILE_VERSION=../src/version.h

# Get current, and save the next version
VERSION_MAJOR=`sed -n 's/^\#define\s\+APP_VERSION_MAJOR\s\+\([0-9]\+\)/\1/p' $FILE_VERSION`
VERSION_MINOR=`sed -n 's/^\#define\s\+APP_VERSION_MINOR\s\+\"\?\([0-9a-z]\+\)\"\?/\1/p' $FILE_VERSION`
VERSION="$VERSION_MAJOR.$VERSION_MINOR"


# Qt libs
QT=/usr/toolchains/windows-x86-complete/i686-w64-mingw32.static/qt4-shared/
QTPATH=${QT}/bin
QTPLUGPATH=${QT}/plugins

# Start the mojo
QTLIBS="QtGui4.dll QtCore4.dll QtSvg4.dll"
QTPLUGINS="imageformats/qgif4.dll imageformats/qico4.dll imageformats/qjpeg4.dll imageformats/qmng4.dll imageformats/qsvg4.dll \
imageformats/qtiff4.dll iconengines/qsvgicon4.dll"

find . -type l -delete

for lib in $QTLIBS; do
if [ ! -f "$QTPATH/$lib" ]; then
echo "Error: file $QTPATH/$lib not found"
exit 1
fi

ln -s $QTPATH/$lib $lib || exit 1
echo "Added Qt library $lib"
done

for plug in $QTPLUGINS; do

if [ ! -f "$QTPLUGPATH/$plug" ]; then
echo "Error: plugin $QTPLUGPATH/$plug not found"
exit 1
fi

file=`basename $plug`

ln -s "$QTPLUGPATH/$plug" $file || exit 1
echo "Added Qt plugin $plug"
done


# Generated binary
BINARY=../src/bin/karlyriceditor.exe
cp $BINARY karlyriceditor.exe
export NSISDIR=/home/tim/bin/nsis

INSTNAME="InstallKarLyricEditor-$1.exe"
INSTNAME="InstallKarLyricEditor-$VERSION.exe"
echo "Creating $INSTNAME"

makensis installer.nsis || exit 1

# Remove stuff
rm karlyriceditor.exe
find . -type l -delete
mv InstallKarLyricEditor.exe $INSTNAME
@@ -67,8 +67,19 @@
SetOutPath "$INSTDIR"

; Our files
File karlyriceditor.exe
File karlyriceditor.exe.manifest
CreateDirectory "$INSTDIR\imageformats"
CreateDirectory "$INSTDIR\codecs"
CreateDirectory "$INSTDIR\iconengines"
File /oname=$INSTDIR\imageformats\qgif4.dll qgif4.dll
File /oname=$INSTDIR\imageformats\qico4.dll qico4.dll
File /oname=$INSTDIR\imageformats\qjpeg4.dll qjpeg4.dll
File /oname=$INSTDIR\imageformats\qsvg4.dll qsvg4.dll
File /oname=$INSTDIR\imageformats\qtiff4.dll qtiff4.dll
File /oname=$INSTDIR\iconengines\qsvgicon4.dll qsvgicon4.dll
File QtGui4.dll
File QtCore4.dll
File karlyriceditor.exe
File karlyriceditor.exe.manifest

;Store installation folder
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Ulduzsoft\KarLyricEditor" "" "$INSTDIR"
@@ -91,6 +102,19 @@
Section "Uninstall"

; Our files
Delete "$INSTDIR\imageformats\qgif4.dll"
Delete "$INSTDIR\imageformats\qico4.dll"
Delete "$INSTDIR\imageformats\qjpeg4.dll"
Delete "$INSTDIR\imageformats\qmng4.dll"
Delete "$INSTDIR\imageformats\qsvg4.dll"
Delete "$INSTDIR\imageformats\qtiff4.dll"
Delete "$INSTDIR\iconengines\qsvgicon4.dll"
Delete "$INSTDIR\codecs\qcncodecs4.dll"
Delete "$INSTDIR\codecs\qjpcodecs4.dll"
Delete "$INSTDIR\codecs\qkrcodecs4.dll"
Delete "$INSTDIR\codecs\qtwcodecs4.dll"
Delete "$INSTDIR\QtGui4.dll"
Delete "$INSTDIR\QtCore4.dll"
Delete "$INSTDIR\karlyriceditor.exe"
Delete "$INSTDIR\karlyriceditor.exe.manifest"
Delete "$INSTDIR\uninst.exe"

0 comments on commit d1a457f

Please sign in to comment.
You can’t perform that action at this time.