mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	smtk-import: add windows building to travis-ci
Prepare the building script to suport travis or set other automated builds, while keeping other options to manual builds. In before_install script, create needed directories, and dowload mdbtools sources. Add smtk2ssrf build script to travisbuild.sh Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
This commit is contained in:
		
							parent
							
								
									d303a589e6
								
							
						
					
					
						commit
						f6cee2ca7e
					
				
					 3 changed files with 71 additions and 48 deletions
				
			
		| 
						 | 
				
			
			@ -5,16 +5,25 @@
 | 
			
		|||
# the source tree and, please, refer to said script for instructions on how to
 | 
			
		||||
# build.
 | 
			
		||||
#
 | 
			
		||||
# Subsurface *MUST* have been built before running that script, as the importer
 | 
			
		||||
# Subsurface *MUST* have been built before running this script, as the importer
 | 
			
		||||
# links against libsubsurface_corelib.a library.
 | 
			
		||||
# Although is possible to build the latest git version of the importer against
 | 
			
		||||
# whichever other version of subsurface, this should be avoided, and both
 | 
			
		||||
# versions, subsurface and smtk-import should be the same.
 | 
			
		||||
#
 | 
			
		||||
# Flags and options:
 | 
			
		||||
# -a (--auto):	    Mark the buils as "automatic". This assumes we are building
 | 
			
		||||
#		    in a automated environment (e.g. travis-ci) and doesn't try
 | 
			
		||||
#		    to change the git tag or repo. -t and -r flags are useless
 | 
			
		||||
#		    if -a has been set. Building in travis-ci is detected and so
 | 
			
		||||
#		    the flag is not necessary there.
 | 
			
		||||
# -i (--installer): Packs a windows installer. This should always be used.
 | 
			
		||||
# -t (--tag):       Defines which git version we want to build. Defaults to
 | 
			
		||||
#                   latest. E.g. -t v4.6.4
 | 
			
		||||
# -r (--repo):	    Set the repo you want to target for the build. If you are
 | 
			
		||||
#                   working on a github fork, you will usually have an "origin"
 | 
			
		||||
#		    and a "fork" repo, this enables choosing which repo you want
 | 
			
		||||
#		    to pull from.
 | 
			
		||||
# -b (--build):     Values: debug or release. Defines the build we want to do.
 | 
			
		||||
# -d (--dir):	    Specify a directory where a copy of the installer will be
 | 
			
		||||
#                   placed. This is a *must* if the script runs in a VM, and
 | 
			
		||||
| 
						 | 
				
			
			@ -22,13 +31,18 @@
 | 
			
		|||
#
 | 
			
		||||
# Examples: (provided Subsurface has been previously cross built)
 | 
			
		||||
#
 | 
			
		||||
# For most pourposes, including travis builds, just
 | 
			
		||||
# smtk2ssrf-mxe-build.sh -i
 | 
			
		||||
# should be used.
 | 
			
		||||
#
 | 
			
		||||
# smtk2ssrf-mxe-build.sh -i -t master
 | 
			
		||||
# This will build an release installer of smtk2ssrf placed in a directory under
 | 
			
		||||
# This will build a release installer of smtk2ssrf placed in a directory under
 | 
			
		||||
# the win-build directory where it has been launched, named smtk-import. It will
 | 
			
		||||
# build git latest master regardless of subsurface's cross built version.
 | 
			
		||||
#
 | 
			
		||||
# smtk2ssrf-mxe-build.sh -b debug
 | 
			
		||||
# This will build *just* a windows binary (no packing) of the latest master.
 | 
			
		||||
# Use with care, this flag *must* match subsurface's build one.
 | 
			
		||||
#
 | 
			
		||||
# smtk2ssrf-mxe-build.sh -i -t v4.6.4 -b relase -d /mnt/data
 | 
			
		||||
# As I'm building in a fedora-25 docker VM, this should bring up a release
 | 
			
		||||
| 
						 | 
				
			
			@ -49,6 +63,7 @@ DEFAULT="\033[0m"
 | 
			
		|||
 | 
			
		||||
SSRF_TAG=""
 | 
			
		||||
RELEASE="Release"
 | 
			
		||||
AUTO="${TRAVIS:-false}"
 | 
			
		||||
 | 
			
		||||
# this is important, if we are building in a VM or if we want to get a copy
 | 
			
		||||
# of the installer elsewhere out of the building tree.
 | 
			
		||||
| 
						 | 
				
			
			@ -84,10 +99,12 @@ echo -e "$BLUE---> Building in$LIGHT_GRAY $BUILDDIR ...$DEFAULT"
 | 
			
		|||
# check for arguments and set options
 | 
			
		||||
if [ $# -eq 0 ]; then
 | 
			
		||||
	echo -e "$BLUE---> No arguments given."
 | 
			
		||||
	echo -e "---> Building actual git commit and Release type without installer $DEFAULT"
 | 
			
		||||
	echo -e "---> Building current git commit and Release type without installer $DEFAULT"
 | 
			
		||||
else
 | 
			
		||||
	while [ $# -gt 0 ]; do
 | 
			
		||||
		case $1 in
 | 
			
		||||
			-a|--auto)	AUTO="true"
 | 
			
		||||
					;;
 | 
			
		||||
			-t|--tag)	SSRF_TAG="$2"
 | 
			
		||||
					shift;;
 | 
			
		||||
			-i|--installer)	INSTALLER="installer"
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +118,7 @@ else
 | 
			
		|||
		esac
 | 
			
		||||
		shift
 | 
			
		||||
	done
 | 
			
		||||
	echo -e "$BLUE---> Subsurface tagged to:$LIGHT_GRAY $SSRF_TAG"
 | 
			
		||||
	echo -e "$BLUE---> Subsurface tagged to:$LIGHT_GRAY ${SSRF_TAG:-latest}"
 | 
			
		||||
	echo -e "$BLUE---> Building type:$LIGHT_GRAY $RELEASE"
 | 
			
		||||
	echo -e "$BLUE---> Installer set to:$LIGHT_GRAY $INSTALLER $DEFAULT"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			@ -126,44 +143,44 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH_i686_w64_mingw32_static":"$PKG_CONFIG_P
 | 
			
		|||
 | 
			
		||||
#
 | 
			
		||||
# mdbtools
 | 
			
		||||
# build from sources. If build fails, fallback to prebuilt mxe binaries.
 | 
			
		||||
#
 | 
			
		||||
if [ ! -f "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib/libmdb.a ]; then
 | 
			
		||||
	echo -e "$BLUE---> Building mdbtools ... $DEFAULT "
 | 
			
		||||
	mkdir -p --verbose "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/include
 | 
			
		||||
	mkdir -p --verbose "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib
 | 
			
		||||
	cd "$BUILDDIR"
 | 
			
		||||
	[[ -d mdbtools ]] && rm -rf mdbtools
 | 
			
		||||
	mkdir -p mdbtools
 | 
			
		||||
	cd mdbtools
 | 
			
		||||
	if [ ! -f "$BASEDIR"/mdbtools/configure ] ; then
 | 
			
		||||
		( cd "$BASEDIR"/mdbtools
 | 
			
		||||
		autoreconf -v -f -i )
 | 
			
		||||
	fi
 | 
			
		||||
	"$BASEDIR"/mdbtools/configure  --host=i686-w64-mingw32.static \
 | 
			
		||||
			     --srcdir="$BASEDIR"/mdbtools \
 | 
			
		||||
			     --prefix="$BASEDIR"/mxe/usr/i686-w64-mingw32.static \
 | 
			
		||||
			     --enable-shared \
 | 
			
		||||
			     --disable-man \
 | 
			
		||||
			     --disable-gmdb2
 | 
			
		||||
	make $JOBS >/dev/null || aborting "Building mdbtools failed."
 | 
			
		||||
	make install
 | 
			
		||||
else
 | 
			
		||||
	echo -e "$BLUE---> Prebuilt mxe mdbtools ... $DEFAULT"
 | 
			
		||||
echo -e "$BLUE---> Building mdbtools ... $DEFAULT "
 | 
			
		||||
mkdir -p --verbose "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/include
 | 
			
		||||
mkdir -p --verbose "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib
 | 
			
		||||
cd "$BUILDDIR"
 | 
			
		||||
[[ -d mdbtools ]] && rm -rf mdbtools
 | 
			
		||||
mkdir -p mdbtools
 | 
			
		||||
cd mdbtools
 | 
			
		||||
if [ ! -f "$BASEDIR"/mdbtools/configure ] ; then
 | 
			
		||||
	( cd "$BASEDIR"/mdbtools
 | 
			
		||||
	autoreconf -v -f -i )
 | 
			
		||||
fi
 | 
			
		||||
"$BASEDIR"/mdbtools/configure CC=i686-w64-mingw32.static-gcc \
 | 
			
		||||
		     --host=i686-w64-mingw32.static \
 | 
			
		||||
		     --prefix="$BASEDIR"/mxe/usr/i686-w64-mingw32.static \
 | 
			
		||||
		     --enable-shared=no \
 | 
			
		||||
		     --disable-man \
 | 
			
		||||
		     --disable-gmdb2
 | 
			
		||||
make $JOBS >/dev/null && make install || \
 | 
			
		||||
	echo -e "$RED---> Building mdbtools failed ...$LIGHT_GRAY Trying to build with precompiled mxe binaries$DEFAULT"
 | 
			
		||||
 | 
			
		||||
# Subsurface
 | 
			
		||||
#
 | 
			
		||||
cd "$BASEDIR/subsurface"
 | 
			
		||||
git reset --hard master && echo -e "$BLUE---> Uncommited changes to Subsurface (if any) dropped$DEFAULT"
 | 
			
		||||
if [ ! -z "$GITREPO" ]; then
 | 
			
		||||
	git pull --rebase "$GITREPO" master || aborting "git pull failed, Subsurface not updated"
 | 
			
		||||
else
 | 
			
		||||
	git pull --rebase || aborting "git pull failed, Subsurface not updated"
 | 
			
		||||
fi
 | 
			
		||||
echo -e "$BLUE---> Subsurface updated$DEFAULT"
 | 
			
		||||
if [ "$AUTO" = "false" ]; then
 | 
			
		||||
	cd "$BASEDIR/subsurface"
 | 
			
		||||
	git reset --hard master && echo -e "$BLUE---> Uncommited changes to Subsurface (if any) dropped$DEFAULT"
 | 
			
		||||
	git checkout master
 | 
			
		||||
	if [ ! -z "$GITREPO" ]; then
 | 
			
		||||
		git pull --rebase "$GITREPO" master || aborting "git pull failed, Subsurface not updated"
 | 
			
		||||
	else
 | 
			
		||||
		git pull --rebase || aborting "git pull failed, Subsurface not updated"
 | 
			
		||||
	fi
 | 
			
		||||
	echo -e "$BLUE---> Subsurface updated$DEFAULT"
 | 
			
		||||
 | 
			
		||||
if [ "$SSRF_TAG" != "" ]; then
 | 
			
		||||
	git checkout "$SSRF_TAG" || aborting "Failed to checkout Subsurface's $SSRF_TAG."
 | 
			
		||||
	if [ "$SSRF_TAG" != "" ]; then
 | 
			
		||||
		git checkout "$SSRF_TAG" || aborting "Failed to checkout Subsurface's $SSRF_TAG."
 | 
			
		||||
	fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Every thing is ok. Go on.
 | 
			
		||||
| 
						 | 
				
			
			@ -188,24 +205,20 @@ mkdir -p "$STAGING_DIR"/plugins
 | 
			
		|||
 | 
			
		||||
for d in $QT_PLUGIN_DIRECTORIES
 | 
			
		||||
do
 | 
			
		||||
    cp -a "$d" "$STAGING_DIR"/plugins
 | 
			
		||||
    [[ -d $d ]] && cp -a "$d" "$STAGING_DIR"/plugins
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
for f in $EXTRA_MANUAL_DEPENDENCIES
 | 
			
		||||
do
 | 
			
		||||
    cp "$f" "$STAGING_DIR"
 | 
			
		||||
    [[ -f $f ]] && cp "$f" "$STAGING_DIR"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# this is absolutely hackish, but necessary. Libmdb (built or prebuilt) is linked against
 | 
			
		||||
# shared glib-2.0, but once and again we are trying to link against static lib.
 | 
			
		||||
mv -vf "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib/libglib-2.0.a "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib/libglib-2.0.a.bak || \
 | 
			
		||||
	echo -e "$BLUE------> libglib-2.0.a had been moved in a previous run$DEFAULT"
 | 
			
		||||
 | 
			
		||||
cd "$BUILDDIR"/smtk-import
 | 
			
		||||
mkdir -p staging
 | 
			
		||||
 | 
			
		||||
echo -e "$BLUE---> Building CMakeCache.txt$DEFAULT"
 | 
			
		||||
cmake	-DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
 | 
			
		||||
i686-w64-mingw32.shared-cmake \
 | 
			
		||||
	-DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
 | 
			
		||||
	-DPKG_CONFIG_EXECUTABLE="/usr/bin/pkg-config" \
 | 
			
		||||
	-DCMAKE_PREFIX_PATH="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5 \
 | 
			
		||||
	-DCMAKE_BUILD_TYPE=$RELEASE \
 | 
			
		||||
| 
						 | 
				
			
			@ -220,10 +233,6 @@ else
 | 
			
		|||
	make "$JOBS"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Undo previous hackery
 | 
			
		||||
echo -e "$BLUE---> Restoring system to initial state$DEFAULT"
 | 
			
		||||
mv -vf "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib/libglib-2.0.a.bak "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib/libglib-2.0.a
 | 
			
		||||
 | 
			
		||||
if [ ! -z "$DATADIR" ]; then
 | 
			
		||||
	echo -e "$BLUE---> Copying Smtk2ssrf installer to data folder$DEFAULT"
 | 
			
		||||
	cp -vf "$BUILDDIR"/smtk-import/smtk2ssrf-*.exe "$DATADIR"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ tar xJf ../mxe-994ad473.tar.xz
 | 
			
		|||
sudo mkdir -p /data/winqt551/
 | 
			
		||||
sudo ln -s ${TRAVIS_BUILD_DIR}/../mxe /data/winqt551/mxe-current
 | 
			
		||||
ls -l /data/winqt551/mxe-current/usr
 | 
			
		||||
sudo ln -s ${TRAVIS_BUILD_DIR}/../mxe /usr/src/mxe
 | 
			
		||||
 | 
			
		||||
# libdivecomputer uses the wrong include path for libusb
 | 
			
		||||
# the pkgconfig file for libusb already gives the include path as
 | 
			
		||||
| 
						 | 
				
			
			@ -74,3 +75,15 @@ if ! git checkout v5.0.0 ; then
 | 
			
		|||
	echo "can't check out v5.0.0 of grantlee -- giving up"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "Get mdbtools"
 | 
			
		||||
cd ${TRAVIS_BUILD_DIR}/..
 | 
			
		||||
git clone https://github.com/brianb/mdbtools.git
 | 
			
		||||
 | 
			
		||||
# get prebuilt mxe libraries for mdbtools and glib.
 | 
			
		||||
# do not overwrite upstream prebuilt mxe binaries if there is any coincidence.
 | 
			
		||||
wget https://www.dropbox.com/s/842skyusb96ii1u/mxe-static-minimal-994ad473.tar.xz
 | 
			
		||||
[[ ! -f mxe-static-minimal-994ad473.tar.xz ]] && exit 1
 | 
			
		||||
cd mxe
 | 
			
		||||
tar -xJf ../mxe-static-minimal-994ad473.tar.xz --skip-old-files
 | 
			
		||||
ls -al usr/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,3 +13,4 @@ mkdir win32
 | 
			
		|||
ls -l
 | 
			
		||||
cd win32
 | 
			
		||||
bash -ex ${TRAVIS_BUILD_DIR}/packaging/windows/mxe-based-build.sh installer
 | 
			
		||||
bash -ex ${TRAVIS_BUILD_DIR}/packaging/windows/smtk2ssrf-mxe-build.sh -i
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue