Skip to content

Commit 4d0fef8

Browse files
authoredApr 11, 2021
Buildbot changes to allow out-of-tree builds (#11180)
* Do proper out-of-tree builds with buildbot * Don't write to bin/ for cross builds * This allows safely building multiple builds from the same source dir, e.g. with the buildbot. * Disable Gettext (by default) and Freetype (entirely) for server builds
1 parent 4b8209d commit 4d0fef8

File tree

3 files changed

+47
-45
lines changed

3 files changed

+47
-45
lines changed
 

Diff for: ‎src/CMakeLists.txt

+8-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if(NOT USE_CURL)
5555
endif()
5656

5757

58-
option(ENABLE_GETTEXT "Use GetText for internationalization" TRUE)
58+
option(ENABLE_GETTEXT "Use GetText for internationalization" ${BUILD_CLIENT})
5959
set(USE_GETTEXT FALSE)
6060

6161
if(ENABLE_GETTEXT)
@@ -120,13 +120,13 @@ endif()
120120
option(ENABLE_FREETYPE "Enable FreeType2 (TrueType fonts and basic unicode support)" TRUE)
121121
set(USE_FREETYPE FALSE)
122122

123-
if(ENABLE_FREETYPE)
123+
if(BUILD_CLIENT AND ENABLE_FREETYPE)
124124
find_package(Freetype)
125125
if(FREETYPE_FOUND)
126126
message(STATUS "Freetype enabled.")
127127
set(USE_FREETYPE TRUE)
128128
endif()
129-
endif(ENABLE_FREETYPE)
129+
endif()
130130

131131
option(ENABLE_CURSES "Enable ncurses console" TRUE)
132132
set(USE_CURSES FALSE)
@@ -526,8 +526,11 @@ if(USE_CURL)
526526
endif()
527527

528528

529-
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
530-
529+
# When cross-compiling assume the user doesn't want to run the executable anyway,
530+
# otherwise place it in <source dir>/bin/ since Minetest can only run from there.
531+
if(NOT CMAKE_CROSSCOMPILING)
532+
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
533+
endif()
531534

532535
if(BUILD_CLIENT)
533536
add_executable(${PROJECT_NAME} ${client_SRCS} ${extra_windows_SRCS})

Diff for: ‎util/buildbot/buildwin32.sh

+20-20
Original file line numberDiff line numberDiff line change
@@ -85,36 +85,36 @@ cd $libdir
8585
[ -d luajit ] || unzip -o $packagedir/luajit-$luajit_version.zip -d luajit
8686
[ -d leveldb ] || unzip -o $packagedir/libleveldb-$leveldb_version.zip -d leveldb
8787

88-
# Get minetest
89-
cd $builddir
90-
if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
91-
cd /$EXISTING_MINETEST_DIR # must be absolute path
88+
# Set source dir, downloading Minetest as needed
89+
if [ -n "$EXISTING_MINETEST_DIR" ]; then
90+
sourcedir="$( cd "$EXISTING_MINETEST_DIR" && pwd )"
9291
else
93-
[ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT)
94-
cd $CORE_NAME
92+
sourcedir=$PWD/$CORE_NAME
93+
[ -d $CORE_NAME ] && { pushd $CORE_NAME; git pull; popd; } || \
94+
git clone -b $CORE_BRANCH $CORE_GIT $CORE_NAME
95+
if [ -z "$NO_MINETEST_GAME" ]; then
96+
[ -d games/$GAME_NAME ] && { pushd games/$GAME_NAME; git pull; popd; } || \
97+
git clone -b $GAME_BRANCH $GAME_GIT games/$GAME_NAME
98+
fi
9599
fi
96-
git_hash=$(git rev-parse --short HEAD)
97100

98-
# Get minetest_game
99-
if [ "x$NO_MINETEST_GAME" = "x" ]; then
100-
cd games
101-
[ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT)
102-
cd ..
103-
fi
101+
git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
102+
103+
# Build the thing
104+
cd $builddir
105+
[ -d build ] && rm -rf build
106+
mkdir build
107+
cd build
104108

105109
irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';')
106110
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
107111
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')
108112

109-
# Build the thing
110-
[ -d _build ] && rm -Rf _build/
111-
mkdir _build
112-
cd _build
113-
cmake .. \
113+
cmake -S $sourcedir -B . \
114+
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
114115
-DCMAKE_INSTALL_PREFIX=/tmp \
115116
-DVERSION_EXTRA=$git_hash \
116117
-DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
117-
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
118118
\
119119
-DENABLE_SOUND=1 \
120120
-DENABLE_CURL=1 \
@@ -170,7 +170,7 @@ cmake .. \
170170

171171
make -j$(nproc)
172172

173-
[ "x$NO_PACKAGE" = "x" ] && make package
173+
[ -z "$NO_PACKAGE" ] && make package
174174

175175
exit 0
176176
# EOF

Diff for: ‎util/buildbot/buildwin64.sh

+19-20
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ cd $builddir
6060
[ -e $packagedir/openal_stripped.zip ] || wget http://minetest.kitsunemimi.pw/openal_stripped64.zip \
6161
-c -O $packagedir/openal_stripped.zip
6262

63-
6463
# Extract stuff
6564
cd $libdir
6665
[ -d irrlicht ] || unzip -o $packagedir/irrlicht-$irrlicht_version.zip -d irrlicht
@@ -75,32 +74,32 @@ cd $libdir
7574
[ -d luajit ] || unzip -o $packagedir/luajit-$luajit_version.zip -d luajit
7675
[ -d leveldb ] || unzip -o $packagedir/libleveldb-$leveldb_version.zip -d leveldb
7776

78-
# Get minetest
79-
cd $builddir
80-
if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
81-
cd /$EXISTING_MINETEST_DIR # must be absolute path
77+
# Set source dir, downloading Minetest as needed
78+
if [ -n "$EXISTING_MINETEST_DIR" ]; then
79+
sourcedir="$( cd "$EXISTING_MINETEST_DIR" && pwd )"
8280
else
83-
[ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT)
84-
cd $CORE_NAME
81+
sourcedir=$PWD/$CORE_NAME
82+
[ -d $CORE_NAME ] && { pushd $CORE_NAME; git pull; popd; } || \
83+
git clone -b $CORE_BRANCH $CORE_GIT $CORE_NAME
84+
if [ -z "$NO_MINETEST_GAME" ]; then
85+
[ -d games/$GAME_NAME ] && { pushd games/$GAME_NAME; git pull; popd; } || \
86+
git clone -b $GAME_BRANCH $GAME_GIT games/$GAME_NAME
87+
fi
8588
fi
86-
git_hash=$(git rev-parse --short HEAD)
8789

88-
# Get minetest_game
89-
if [ "x$NO_MINETEST_GAME" = "x" ]; then
90-
cd games
91-
[ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT)
92-
cd ..
93-
fi
90+
git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
91+
92+
# Build the thing
93+
cd $builddir
94+
[ -d build ] && rm -rf build
95+
mkdir build
96+
cd build
9497

9598
irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';')
9699
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
97100
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')
98101

99-
# Build the thing
100-
[ -d _build ] && rm -Rf _build/
101-
mkdir _build
102-
cd _build
103-
cmake .. \
102+
cmake -S $sourcedir -B . \
104103
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
105104
-DCMAKE_INSTALL_PREFIX=/tmp \
106105
-DVERSION_EXTRA=$git_hash \
@@ -160,7 +159,7 @@ cmake .. \
160159

161160
make -j$(nproc)
162161

163-
[ "x$NO_PACKAGE" = "x" ] && make package
162+
[ -z "$NO_PACKAGE" ] && make package
164163

165164
exit 0
166165
# EOF

0 commit comments

Comments
 (0)
Please sign in to comment.