Skip to content

Commit

Permalink
CI: MXE make download instead of APT repository
Browse files Browse the repository at this point in the history
  • Loading branch information
bb010g committed Jul 31, 2020
1 parent c0764e2 commit 71db3e5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 67 deletions.
38 changes: 15 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,40 +65,32 @@ matrix:
os: linux
dist: bionic # 18.04 LTS
script: ".travis/linux-mxe/build.sh"
env:
- MXE_PATH="/usr/lib/mxe"
- MXE_HOST="x86_64-pc-linux-gnu"
- MXE_TARGET="i686-w64-mingw32.shared"
- PATH="$MXE_PATH/usr/bin:$PATH"
- MXE_HOST_PFX="$MXE_PATH/usr/$MXE_HOST/bin/$MXE_TARGET"
- MXE_CROSS_PFX="$MXE_PATH/usr/bin/$MXE_TARGET"
- WINEARCH="win32"
# add the MXE DLLs to Wine's path
- WINEPATH="$MXE_PATH/usr/$MXE_TARGET/bin${WINEPATH:+:$WINEPATH}"
before_install:
- sudo git clone "https://github.com/mxe/mxe" "$MXE_PATH"
- (cd "$MXE_PATH" && sudo make MXE_TARGETS="$MXE_TARGET"
download-{bzip2,cmake,curl,gcc,gettext,jpeg,libpng,libxml2,lzma,nsis,pkgconf,sdl,sdl_mixer,sdl_net,sdl_ttf,smpeg2,sqlite,zlib})
addons:
apt:
update: true
sources:
- sourceline: 'deb [arch=amd64] http://mirror.mxe.cc/repos/apt bionic main'
key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x86B72ED9'
# for xvfb
- sourceline: 'deb http://archive.ubuntu.com/ubuntu bionic universe'
- sourceline: 'deb http://archive.ubuntu.com/ubuntu bionic-updates universe'
packages:
- mxe-i686-w64-mingw32.shared-bzip2
- mxe-i686-w64-mingw32.shared-cc
- mxe-i686-w64-mingw32.shared-curl
- mxe-i686-w64-mingw32.shared-gettext
- mxe-i686-w64-mingw32.shared-jpeg
- mxe-i686-w64-mingw32.shared-libpng
- mxe-i686-w64-mingw32.shared-libxml2
- mxe-i686-w64-mingw32.shared-lzma
- mxe-i686-w64-mingw32.shared-nsis
- mxe-i686-w64-mingw32.shared-sdl
- mxe-i686-w64-mingw32.shared-sdl-mixer
- mxe-i686-w64-mingw32.shared-sdl-net
- mxe-i686-w64-mingw32.shared-sdl-ttf
- mxe-i686-w64-mingw32.shared-smpeg2
- mxe-i686-w64-mingw32.shared-sqlite
- mxe-i686-w64-mingw32.shared-zlib
- ninja-build
- wine-stable
- wine32
- xvfb
before_install:
- ( shopt dotglob; sudo rm -rf /usr/local/cmake/* )
- >-
curl --retry 2 --retry-delay 30 'https://cmake.org/files/v3.13/cmake-3.13.4-Linux-x86_64.tar.gz' |
sudo tar -xz -C /usr/local/cmake --strip-components 1

deploy:
provider: releases
Expand Down
50 changes: 8 additions & 42 deletions .travis/linux-mxe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,19 @@

set -ex

# needed for cmake to find some programs
export PATH="/usr/lib/mxe/usr/bin:$PATH"

mkdir build && cd build
mkdir -p /tmp/xmoto

MXE_PATH=/usr/lib/mxe
MXE_TARGET="i686-w64-mingw32.shared"

is_broken_symlink() {
if [ -L "$1" ] && [ ! -e "$1" ]; then
return 0
else
return 1
fi
}

relink() {
for prog in "$@"; do
if is_broken_symlink "$MXE_HOST_PFX-$prog"; then
sudo rm "$MXE_HOST_PFX-$prog"
sudo ln -s "$MXE_CROSS_PFX-$prog" "$MXE_HOST_PFX-$prog"
fi
done
}

MXE_HOST_PFX="$MXE_PATH/usr/x86_64-pc-linux-gnu/bin/$MXE_TARGET"
MXE_CROSS_PFX="$MXE_PATH/usr/bin/$MXE_TARGET"

# add the mxe DLLs to wine's path
export WINEPATH="$MXE_PATH/usr/$MXE_TARGET/bin${WINEPATH:+:${WINEPATH}}"
export WINEARCH=win32
mkdir -p /tmp/xminstall

echo "MXE_PATH: $MXE_PATH"
echo "MXE HOST PREFIX: $MXE_HOST_PFX"
echo "MXE CROSS PREFIX: $MXE_CROSS_PFX"
echo "WINEPATH: $WINEPATH"

relink "gcc" "g++"

"$MXE_CROSS_PFX-cmake" \
-D CMAKE_INSTALL_PREFIX=/tmp/xmoto \
"$MXE_TARGET-cmake" -D CMAKE_INSTALL_PREFIX=/tmp/xminstall \
-D XMOTO_PACK=manual \
-D CMAKE_BUILD_TYPE=Release ..
-D CMAKE_BUILD_TYPE=Release -G Ninja ..

make -j"$(nproc)"
ninja

Xvfb :0 -screen 0 1024x768x16 &
xvfb_pid=$!
Expand All @@ -57,7 +24,7 @@ sleep 5
echo "pidof Xvfb:"
pidof Xvfb

make xmoto_pack
ninja xmoto_pack

# not that any reasonable PID 1 responds to SIGTERM anyway ;)
if [ "$xvfb_pid" -gt 1 ]; then
Expand All @@ -67,10 +34,10 @@ fi
# aaand if the graceful termination doesn't work..
jobs -p | xargs -r kill -9

#make install
#ninja install

"$MXE_CROSS_PFX"-cpack -G "NSIS"
"$MXE_CROSS_PFX"-cpack -G "ZIP"
"$MXE_TARGET"-cpack -G "NSIS"
"$MXE_TARGET"-cpack -G "ZIP"

fix_pkg_name() {
if [ -z "$1" ] || [ -z "$2" ]; then
Expand All @@ -88,4 +55,3 @@ for pkg in xmoto-*.exe; do fix_pkg_name "$pkg" "win32-setup"; done
mkdir artifacts
mv xmoto-*.exe artifacts/
mv xmoto-*.zip artifacts/

1 change: 0 additions & 1 deletion .travis/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ cpack -G "RPM"
mkdir artifacts
mv xmoto-*.deb artifacts/
mv xmoto-*.rpm artifacts/

1 change: 0 additions & 1 deletion .travis/macos/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ sudo \

mkdir artifacts
mv xmoto-*.dmg artifacts/

0 comments on commit 71db3e5

Please sign in to comment.