Skip to content

Commit 39c54e1

Browse files
pyrollorubenwardy
authored andcommittedJun 21, 2019
Improve buildbot script
PR created under the employment of EvidenceBKidscode * Variables to set git repositories urls (allows to build from another repo) * Variables to set git branch to build from (allows to build from non-master branch) * Variables to change built name * Make -j uses the proper number of processors (autodetect) * Changed toolchain from win32 to adpat it to non-debian distros
1 parent e3738c2 commit 39c54e1

7 files changed

+57
-29
lines changed
 

‎.travis.yml

-12
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,10 @@ matrix:
3434
- env: PLATFORM=Win32
3535
compiler: gcc
3636
os: linux
37-
addons:
38-
apt:
39-
packages: ['gcc-mingw-w64-i686', 'g++-mingw-w64-i686', 'binutils-mingw-w64-i686']
40-
sources: &sources
41-
- ubuntu-toolchain-r-test
42-
- sourceline: 'deb http://mirrors.kernel.org/ubuntu xenial main universe'
4337

4438
- env: PLATFORM=Win64
4539
compiler: gcc
4640
os: linux
47-
addons:
48-
apt:
49-
packages: ['gcc-mingw-w64-x86-64', 'g++-mingw-w64-x86-64', 'binutils-mingw-w64-x86-64']
50-
sources: &sources
51-
- ubuntu-toolchain-r-test
52-
- sourceline: 'deb http://mirrors.kernel.org/ubuntu xenial main universe'
5341

5442
- env: PLATFORM=Unix
5543
compiler: clang

‎util/buildbot/buildwin32.sh

+25-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/bash
22
set -e
33

4+
CORE_GIT=https://github.com/minetest/minetest
5+
CORE_BRANCH=master
6+
CORE_NAME=minetest
7+
GAME_GIT=https://github.com/minetest/minetest_game
8+
GAME_BRANCH=master
9+
GAME_NAME=minetest_game
10+
411
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
512
if [ $# -ne 1 ]; then
613
echo "Usage: $0 <build directory>"
@@ -12,7 +19,18 @@ builddir="$( cd "$builddir" && pwd )"
1219
packagedir=$builddir/packages
1320
libdir=$builddir/libs
1421

15-
toolchain_file=$dir/toolchain_mingw.cmake
22+
# Test which win32 compiler is present
23+
which i586-mingw32msvc-windres > /dev/null 2>&1 && toolchain_file=$dir/toolchain_i586-mingw32msvc.cmake
24+
which i686-w64-mingw32-windres > /dev/null 2>&1 && toolchain_file=$dir/toolchain_i646-w64-mingw32.cmake
25+
26+
if [ -z "$toolchain_file" ]
27+
then
28+
echo "Unable to determine which mingw32 compiler to use"
29+
exit 1
30+
else
31+
echo "Using $toolchain_file"
32+
fi
33+
1634
irrlicht_version=1.8.4
1735
ogg_version=1.3.2
1836
vorbis_version=1.3.5
@@ -70,22 +88,22 @@ cd $libdir
7088
# Get minetest
7189
cd $builddir
7290
if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
73-
ln -s $EXISTING_MINETEST_DIR minetest
91+
ln -s $EXISTING_MINETEST_DIR $CORE_NAME
7492
else
75-
[ -d minetest ] && (cd minetest && git pull) || (git clone https://github.com/minetest/minetest)
93+
[ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT)
7694
fi
77-
cd minetest
95+
cd $CORE_NAME
7896
git_hash=$(git rev-parse --short HEAD)
7997

8098
# Get minetest_game
8199
cd games
82100
if [ "x$NO_MINETEST_GAME" = "x" ]; then
83-
[ -d minetest_game ] && (cd minetest_game && git pull) || (git clone https://github.com/minetest/minetest_game)
101+
[ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT)
84102
fi
85103
cd ../..
86104

87105
# Build the thing
88-
cd minetest
106+
cd $CORE_NAME
89107
[ -d _build ] && rm -Rf _build/
90108
mkdir _build
91109
cd _build
@@ -149,7 +167,7 @@ cmake .. \
149167
-DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
150168
-DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
151169

152-
make -j2
170+
make -j$(nproc)
153171

154172
[ "x$NO_PACKAGE" = "x" ] && make package
155173

‎util/buildbot/buildwin64.sh

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/bash
22
set -e
33

4+
CORE_GIT=https://github.com/minetest/minetest
5+
CORE_BRANCH=master
6+
CORE_NAME=minetest
7+
GAME_GIT=https://github.com/minetest/minetest_game
8+
GAME_BRANCH=master
9+
GAME_NAME=minetest_game
10+
411
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
512
if [ $# -ne 1 ]; then
613
echo "Usage: $0 <build directory>"
@@ -12,7 +19,7 @@ builddir="$( cd "$builddir" && pwd )"
1219
packagedir=$builddir/packages
1320
libdir=$builddir/libs
1421

15-
toolchain_file=$dir/toolchain_mingw64.cmake
22+
toolchain_file=$dir/toolchain_x86_64-w64-mingw32.cmake
1623
irrlicht_version=1.8.4
1724
ogg_version=1.3.2
1825
vorbis_version=1.3.5
@@ -71,22 +78,22 @@ cd $libdir
7178
# Get minetest
7279
cd $builddir
7380
if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
74-
ln -s $EXISTING_MINETEST_DIR minetest
81+
ln -s $EXISTING_MINETEST_DIR $CORE_NAME
7582
else
76-
[ -d minetest ] && (cd minetest && git pull) || (git clone https://github.com/minetest/minetest)
83+
[ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT)
7784
fi
78-
cd minetest
85+
cd $CORE_NAME
7986
git_hash=$(git rev-parse --short HEAD)
8087

8188
# Get minetest_game
8289
cd games
8390
if [ "x$NO_MINETEST_GAME" = "x" ]; then
84-
[ -d minetest_game ] && (cd minetest_game && git pull) || (git clone https://github.com/minetest/minetest_game)
91+
[ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT)
8592
fi
8693
cd ../..
8794

8895
# Build the thing
89-
cd minetest
96+
cd $CORE_NAME
9097
[ -d _build ] && rm -Rf _build/
9198
mkdir _build
9299
cd _build
@@ -150,7 +157,7 @@ cmake .. \
150157
-DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
151158
-DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
152159

153-
make -j2
160+
make -j$(nproc)
154161

155162
[ "x$NO_PACKAGE" = "x" ] && make package
156163

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# name of the target operating system
2+
SET(CMAKE_SYSTEM_NAME Windows)
3+
4+
# which compilers to use for C and C++
5+
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
6+
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
7+
SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
8+
9+
# here is the target environment located
10+
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
11+
12+
# adjust the default behaviour of the FIND_XXX() commands:
13+
# search headers and libraries in the target environment, search
14+
# programs in the host environment
15+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
17+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

‎util/travis/before_install.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ elif [[ $PLATFORM == "Win32" ]]; then
2020
sudo apt-get update
2121
sudo apt-get install p7zip-full
2222
wget http://minetest.kitsunemimi.pw/mingw-w64-i686_7.1.1_ubuntu14.04.7z -O mingw.7z
23-
sed -e "s|%PREFIX%|i686-w64-mingw32|" \
24-
-e "s|%ROOTPATH%|/usr/i686-w64-mingw32|" \
25-
< util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw.cmake
23+
# buildwin32.sh detects the installed toolchain automatically
2624
sudo 7z x -y -o/usr mingw.7z
2725
elif [[ $PLATFORM == "Win64" ]]; then
2826
sudo apt-get update

0 commit comments

Comments
 (0)
Please sign in to comment.