Skip to content

Commit

Permalink
Minor fixes in build (mostly Qt4 32-bit removal from autobuild)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyunaev committed Oct 5, 2016
1 parent 4cf3651 commit 3876af8
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 110 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
2016-10-05 tim <gyunaev@ulduzsoft.com>
- Version 7.7 released (there were no 7.6)
- Windows build now uses Qt 5.5 and VS2013; both 32-bit and 64-bit Windows versions are released

2016-07-30 tim <gyunaev@ulduzsoft.com>
- Added a Ctrl-I shortcut which copies the URL of currently opened page to clipboard
- Minor bugfixes
Expand Down
214 changes: 104 additions & 110 deletions build-release.sh
@@ -1,133 +1,127 @@
#!/bin/sh

RELEASEDIR="releases"
# Export the source code
BUILD_RPM64=1
BUILD_RPM32=1
BUILD_WINDOWS=1

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

FILE_VERSION="src/version.h"
RPM_OUTDIR="$HOME/rpmbuild/RPMS/"
RPM_OUTDIR="/home/tim/rpmbuild/RPMS"

# Get current 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-9]\+\)/\1/p' $FILE_VERSION`
VERSION_MAJOR=`sed -n 's/^\#define\s\+APP_VERSION_MAJOR\s\+\([0-9a-z]\+\)/\1/p' $FILE_VERSION`
VERSION_MINOR=`sed -n 's/^\#define\s\+APP_VERSION_MINOR\s\+\"\?\([0-9a-z]\+\)\"\?/\1/p' $FILE_VERSION`
CURRENTVER="$VERSION_MAJOR.$VERSION_MINOR"

OUTDIR="$RELEASEDIR/$CURRENTVER"

if [ ! -d "$OUTDIR" ]; then
mkdir -p "$OUTDIR" || exit 1
fi

BUILDDIR="karlyriceditor-$CURRENTVER"
BUILDDIR="$PACKAGE-$CURRENTVER"
RELEASEDIR="release-$CURRENTVER"

if [ -d "$BUILDDIR" ]; then
rm -rf "$BUILDDIR"
fi

svn export . "$BUILDDIR/" || exit 1
if [ -d "$RELEASEDIR" ]; then
rm -rf "$RELEASEDIR"
fi

# Example package
tar zcf examples.tar.gz "$BUILDDIR/example" || exit 1
rm -rf "$BUILDDIR/example"
mkdir "$RELEASEDIR" || exit 1

# Source package without examples
tar zcf "$OUTDIR/$BUILDDIR.tar.gz" $BUILDDIR || exit 1

# win32
sh build-win32-mingw.sh -nsis || exit 1
mv build.win32/nsis/InstallKarLyricEditor*.exe $OUTDIR/
rm -rf "build.win32"
# Source package
svn export . "$BUILDDIR/" || exit 1
tar zcf "$RELEASEDIR/$PACKAGE-$CURRENTVER.tar.gz" $BUILDDIR || exit 1


# 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
echo "No library $lib found"
exit
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"
for target in qt5-32 qt5-64 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="QtDBus QtXml QtGui QtCore QtNetwork QtWebKit"
RPMSUFFIX="qt4"
;;

qt5-*)
QMAKE=qmake-qt5
QTLIBS="Qt5WebKitWidgets Qt5PrintSupport Qt5WebKit Qt5Widgets Qt5Xml Qt5DBus Qt5Network Qt5Gui Qt5Core GL"
RPMSUFFIX="qt5"
;;

*)
echo "Invalid target"
exit 1
esac

# Get the arch
case $target in
*-32)
QMAKESPEC="linux-g++-32"
RPMARCH="i586"
LINKLIBS="pthread chm zip $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
echo "No library $lib found"
exit
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 the RPM root
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/*.desktop "$BUILDDIR/buildroot/usr/share/applications"
cp packages/*.png "$BUILDDIR/buildroot/usr/share/pixmaps"
strip --strip-all "$BUILDDIR/bin/kchmviewer" -o "$BUILDDIR/buildroot/usr/bin/kchmviewer" || 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/kchmviewer-$CURRENTVER-1.$RPMARCH.rpm "$RELEASEDIR/kchmviewer-$CURRENTVER-1.${RPMARCH}-${RPMSUFFIX}.rpm" || exit 1
rm -rf "$BUILDDIR"
done

rm -rf /home/tim/rpmbuild
echo "Done! Version $CURRENTVER released!"

4 changes: 4 additions & 0 deletions src/src.pro
Expand Up @@ -130,4 +130,8 @@ greaterThan(QT_MAJOR_VERSION, 4) {
}
} else {
message("Qt4 is not supported anymore, please do not report any errors")
QT += webkit webkitwidgets
DEFINES += USE_WEBKIT
SOURCES += viewwindow_webkit.cpp dataprovider_qwebkit.cpp
HEADERS += dataprovider_qwebkit.h viewwindow_webkit.h
}

0 comments on commit 3876af8

Please sign in to comment.