Separate directories for different builds

master
paradust7 2022-04-10 04:23:22 +00:00
parent cb60993e89
commit 94e47b8b28
16 changed files with 40 additions and 36 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
minetest/
build/
build-*/
sources/
install/
www/

View File

@ -1,6 +1,8 @@
#!/bin/bash -eux
rm -rf build install www
source common.sh
rm -rf "$BUILD_DIR" "$INSTALL_DIR" "$WWW_DIR"
# Emscripten comes with ports for most of these, but they don't compile
# with pthread support. Wipe the cache and build them ourselves.

View File

@ -17,16 +17,16 @@ if ! sha256sum sources/"$TARBALL" | grep -q 46d9a0400a33408fd992770b04a44a7434b3
exit 1
fi
pushd build
pushd "$BUILD_DIR"
rm -rf "$TARDIR"
tar -jxvf "$SRC_DIR/$TARBALL"
# Wrap socket ops
$SRC_DIR/webshims/src/emsocket/wrap.py "$TARDIR"
rm -rf curl-build
mkdir curl-build
pushd curl-build
rm -rf curl
mkdir curl
pushd curl
# For emsocket.h
export CFLAGS="-I${INSTALL_DIR}/include"
@ -43,7 +43,7 @@ emcmake cmake \
-DBUILD_CURL_EXE=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
../"$TARDIR"
"$BUILD_DIR/$TARDIR"
emmake make -j4
emmake make install

View File

@ -8,7 +8,7 @@ if [ ! -d sources/freetype ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf freetype
mkdir freetype

View File

@ -26,7 +26,7 @@ if [ ! -f sources/"$ZIPFILE" ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf "$ZIPDIR"
unzip "$SRC_DIR"/"$ZIPFILE"

View File

@ -8,7 +8,7 @@ if [ ! -d sources/libjpeg ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf libjpeg
mkdir -p libjpeg

View File

@ -16,7 +16,7 @@ if ! sha256sum sources/"$TARBALL" | grep -q 0eb4b4b9420a0f51db142ba3f9c64b333f82
exit 1
fi
pushd build
pushd "$BUILD_DIR"
rm -rf "$TARNAME"
tar -zxvf "$SRC_DIR/$TARBALL"

View File

@ -8,7 +8,7 @@ if [ ! -d sources/libpng ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf libpng
cp -a "$SRC_DIR/libpng" libpng

View File

@ -16,7 +16,7 @@ if ! sha256sum "sources/$TARBALL" | grep -q 0e982409a9c3fc82ee06e08205b1355e5c6a
exit 1
fi
pushd build
pushd "$BUILD_DIR"
rm -rf "$TARNAME"
tar -zxvf "$SRC_DIR/$TARBALL"

View File

@ -4,7 +4,7 @@ source common.sh
INCREMENTAL=${INCREMENTAL:-false}
pushd build
pushd "$BUILD_DIR"
if ! $INCREMENTAL; then
rm -rf minetest
fi
@ -14,7 +14,7 @@ pushd minetest
export EMSDK_EXTRA="-sUSE_SDL=2"
export CFLAGS="$CFLAGS $EMSDK_EXTRA"
export CXXFLAGS="$CXXFLAGS $EMSDK_EXTRA"
export LDFLAGS="$LDFLAGS $EMSDK_EXTRA -sPTHREAD_POOL_SIZE=20 -s EXPORTED_RUNTIME_METHODS=ccall,cwrap -s INITIAL_MEMORY=2093796544"
export LDFLAGS="$LDFLAGS $EMSDK_EXTRA -sPTHREAD_POOL_SIZE=20 -s EXPORTED_RUNTIME_METHODS=ccall,cwrap -s INITIAL_MEMORY=2013265920"
export LDFLAGS="$LDFLAGS -L$INSTALL_DIR/lib -lssl -lcrypto -lemsocket -lwebsocket.js"
# Used by CMakeFiles.txt in the webport
@ -32,7 +32,7 @@ if ! $INCREMENTAL; then
-DENABLE_SYSTEM_GMP=OFF \
-DRUN_IN_PLACE=TRUE \
-DENABLE_GLES=TRUE \
-DCMAKE_BUILD_TYPE="$BUILD_KIND" \
-DCMAKE_BUILD_TYPE="$MINETEST_BUILD_TYPE" \
-DZLIB_INCLUDE_DIR="$INSTALL_DIR/include" \
-DZLIB_LIBRARY="$INSTALL_DIR/lib/libz.a" \
-DJPEG_INCLUDE_DIR="$INSTALL_DIR/include" \

View File

@ -17,7 +17,7 @@ if ! sha256sum sources/"$TARBALL" | grep -q 40dceb51a4f6a5275bde0e6bf20ef4b91bfc
exit 1
fi
pushd build
pushd "$BUILD_DIR"
rm -rf "$TARDIR"
tar -zxvf "$SRC_DIR/$TARBALL"

View File

@ -8,7 +8,7 @@ if [ ! -f sources/sqlite.tar.gz ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf sqlite
tar -zxvf "$SRC_DIR/sqlite.tar.gz"

View File

@ -8,7 +8,7 @@ if [ ! -d sources/webshims ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf webshims
mkdir webshims
pushd webshims

View File

@ -8,7 +8,7 @@ if [ ! -d sources/zlib ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf zlib
cp -a "$SRC_DIR/zlib" zlib

View File

@ -13,7 +13,7 @@ if [ ! -d sources/zstd ]; then
popd
fi
pushd build
pushd "$BUILD_DIR"
rm -rf zstd
mkdir zstd

View File

@ -1,38 +1,39 @@
BASE_DIR="$(dirname -- "$(readlink -f -- "$0")")"
cd "$BASE_DIR"
mkdir -p sources build install
SRC_DIR="$BASE_DIR/sources"
BUILD_DIR="$BASE_DIR/build"
INSTALL_DIR="$BASE_DIR/install"
WWW_DIR="$BASE_DIR/www"
test -d "$SRC_DIR"
test -d "$BUILD_DIR"
test -d "$INSTALL_DIR"
# Debug / Release
export BUILD_KIND=Release
export BUILD_KIND="${BUILD_KIND:-release}"
case $BUILD_KIND in
Debug)
debug)
export MINETEST_BUILD_TYPE="Debug"
export COMMON_CFLAGS="-O0 -g -gsource-map --source-map-base=/dev/"
export COMMON_LDFLAGS="-sSAFE_HEAP=1 -sASSERTIONS=2 -sDEMANGLE_SUPPORT=1"
export BUILD_SUFFIX="-debug"
;;
Profile)
export BUILD_KIND="Release"
profile)
export MINETEST_BUILD_TYPE="Release"
export COMMON_CFLAGS="--profiling -O2 -g -gsource-map --source-map-base=/dev/"
export COMMON_LDFLAGS=""
export BUILD_SUFFIX="-profile"
;;
Release)
release)
export MINETEST_BUILD_TYPE="Release"
export COMMON_CFLAGS="-O2"
export COMMON_LDFLAGS=""
export BUILD_SUFFIX=""
;;
*)
echo "Unknown build: $BUILD_KIND"
echo "Unknown build kind: $BUILD_KIND"
exit 1
esac
SRC_DIR="$BASE_DIR/sources"
BUILD_DIR="$BASE_DIR/build$BUILD_SUFFIX"
INSTALL_DIR="$BASE_DIR/install"
WWW_DIR="$BASE_DIR/www"
mkdir -p "$SRC_DIR" "$BUILD_DIR" "$INSTALL_DIR"
export CFLAGS="$COMMON_CFLAGS -pthread -sUSE_PTHREADS=1 -fexceptions"
export CXXFLAGS="$COMMON_CFLAGS -pthread -sUSE_PTHREADS=1 -fexceptions"
export LDFLAGS="$COMMON_LDFLAGS -pthread -sUSE_PTHREADS=1 -fexceptions -sEXIT_RUNTIME"