updated build.sh to build PM4 binaries for gh actions

This commit is contained in:
Dylan K. Taylor 2020-12-20 22:03:21 +00:00 committed by Dylan K. Taylor
parent c5693598aa
commit 2ba47a80a4
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -14,10 +14,68 @@ sudo apt update && sudo apt install -y \
curl -sSL https://www.php.net/distributions/php-$VERSION.tar.gz | tar -xz
INSTALL_DIR="$(pwd)/bin/php7"
function build_leveldb {
local LEVELDB_VERSION="$1"
echo "Building LevelDB"
rm -rf "./leveldb-mcpe" || true
rm -rf "./leveldb-mcpe-build" || true
mkdir "./leveldb-mcpe"
curl -fsSL "https://github.com/pmmp/leveldb/archive/$LEVELDB_VERSION.tar.gz" | tar -zx
mv "./leveldb-$LEVELDB_VERSION" leveldb-mcpe-build
cd leveldb-mcpe-build
CFLAGS="-fPIC" CXXFLAGS="-fPIC" cmake . \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DCMAKE_PREFIX_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DLEVELDB_BUILD_TESTS=OFF \
-DLEVELDB_BUILD_BENCHMARKS=OFF \
-DLEVELDB_SNAPPY=OFF \
-DLEVELDB_ZSTD=OFF \
-DLEVELDB_TCMALLOC=OFF \
-DCMAKE_BUILD_TYPE=Release
make -j4 install
cd ..
}
build_leveldb 84348b9b826cc280cde659185695d2170b54824c
cd php-$VERSION
cd ext/
curl -sSL https://github.com/pmmp/pthreads/archive/2bcd8b8c10395d58b8a9bc013e3a5328080c867f.tar.gz | tar -xz
curl -sSL https://github.com/php/pecl-file_formats-yaml/archive/2.2.0.tar.gz | tar -xz
# 1: extension name
# 2: extension version
# 3: URL to get .tar.gz from
# 4: Name of extracted directory to move
function get_extension_tar_gz {
curl -sSL "$3" | tar -zx
mv "$4" "$1"
}
# 1: extension name
# 2: extension version
# 3: github user name
# 4: github repo name
# 5: version prefix (optional)
function get_github_extension {
get_extension_tar_gz "$1" "$2" "https://github.com/$3/$4/archive/$5$2.tar.gz" "$4-$2"
}
get_github_extension pthreads 2bcd8b8c10395d58b8a9bc013e3a5328080c867f pmmp pthreads
get_github_extension yaml 2.2.0 php pecl-file_formats-yaml
get_github_extension leveldb 2e3f740b55af1eb6dfc648dd451bcb7d6151c26c pmmp php-leveldb
get_github_extension chunkutils2 5a4dcd6ed74e0db2ca9a54948d4f3a065e386db5 pmmp ext-chunkutils2
get_github_extension morton 0.1.2 pmmp ext-morton
get_github_extension igbinary 3.1.4 igbinary igbinary
get_github_extension ds 2ddef84d3e9391c37599cb716592184315e23921 php-ds ext-ds
rm -rf crypto
git clone --recursive https://github.com/bukka/php-crypto.git crypto
cd crypto
git checkout -qf 5f26ac91b0ba96742cc6284cd00f8db69c3788b2
git submodule update --init --recursive
cd ..
cd ..
CFLAGS="$CFLAGS -march=x86-64"
@ -49,6 +107,12 @@ CXXFLAGS="$CXXFLAGS -march=x86-64"
--with-zlib \
--with-zip \
--with-gmp \
--with-openssl
--with-openssl \
--with-leveldb="$INSTALL_DIR" \
--enable-igbinary \
--enable-morton \
--enable-chunkutils2 \
--enable-ds \
--with-crypto \
make -j8 install