Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor fixes in build (mostly Qt4 32-bit removal from autobuild)
- Loading branch information
Showing
3 changed files
with
112 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters