Skip to content

Commit

Permalink
First shot at updating to libdeflate 1.17, closes #156
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Mar 13, 2023
1 parent a3d38e6 commit 71b9f9d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
43 changes: 22 additions & 21 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OPENSSL_VERSION="1.1.1t"
LIBZIP_VERSION="1.9.2"
SQLITE3_YEAR="2023"
SQLITE3_VERSION="3410100" #3.41.1
LIBDEFLATE_VERSION="0d1779a071bcc636e5156ddb7538434da7acad22" #1.14
LIBDEFLATE_VERSION="bd925ae68e99f65d69f20181cb845aaba5c8f098" #1.17

EXT_PTHREADS_VERSION_PM4="4.2.1"
EXT_PTHREADS_VERSION_PM5="5.3.0"
Expand All @@ -25,7 +25,7 @@ EXT_XDEBUG_VERSION="fbd5d9cb9e18502992e017925a34b7232755f34f" #fork of xdebug us
EXT_IGBINARY_VERSION="3.2.14"
EXT_CRYPTO_VERSION="0.3.2"
EXT_RECURSIONGUARD_VERSION="0.1.0"
EXT_LIBDEFLATE_VERSION="0.1.0"
EXT_LIBDEFLATE_VERSION="0.2.0"
EXT_MORTON_VERSION="0.1.2"
EXT_XXHASH_VERSION="0.1.1"

Expand Down Expand Up @@ -920,32 +920,33 @@ function build_libdeflate {
write_library libdeflate "$LIBDEFLATE_VERSION"
local libdeflate_dir="./libdeflate-$LIBDEFLATE_VERSION"

if [ "$DO_STATIC" == "yes" ]; then
local CMAKE_LIBDEFLATE_EXTRA_FLAGS="-DLIBDEFLATE_BUILD_STATIC_LIB=ON -DLIBDEFLATE_BUILD_SHARED_LIB=OFF"
else
local CMAKE_LIBDEFLATE_EXTRA_FLAGS="-DLIBDEFLATE_BUILD_STATIC_LIB=OFF -DLIBDEFLATE_BUILD_SHARED_LIB=ON"
fi

if cant_use_cache "$libdeflate_dir"; then
rm -rf "$libdeflate_dir"
write_download
download_file "https://github.com/ebiggers/libdeflate/archive/$LIBDEFLATE_VERSION.tar.gz" "libdeflate" | tar -zx >> "$DIR/install.log" 2>&1
cd "$libdeflate_dir"
mark_cache
else
write_caching
cd "$libdeflate_dir"
fi
if [ "$DO_STATIC" == "yes" ]; then
echo -n " checking..."
cmake . \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DCMAKE_PREFIX_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_LIBDIR=lib \
$CMAKE_GLOBAL_EXTRA_FLAGS \
-DLIBDEFLATE_BUILD_GZIP=OFF \
$CMAKE_LIBDEFLATE_EXTRA_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
make -j $THREADS libdeflate.a >> "$DIR/install.log" 2>&1
echo -n " manually copying installation files for static build..."
cp ./libdeflate.a "$INSTALL_DIR/lib"
cp ./libdeflate.h "$INSTALL_DIR/include"
make -j $THREADS >> "$DIR/install.log" 2>&1 && mark_cache
else
echo -n " compiling..."
PREFIX="$INSTALL_DIR" make -j $THREADS install >> "$DIR/install.log" 2>&1
echo -n " cleaning..."
rm "$INSTALL_DIR/lib/libdeflate.a"
if [ "$(uname -s)" == "Darwin" ]; then
#libdeflate makefile doesn't set this correctly
install_name_tool -id "$INSTALL_DIR/lib/libdeflate.0.dylib" "$INSTALL_DIR/lib/libdeflate.0.dylib"
fi
write_caching
cd "$libzip_dir"
fi
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
cd ..
echo " done!"
}
Expand Down Expand Up @@ -1116,7 +1117,7 @@ RANLIB=$RANLIB CFLAGS="$CFLAGS $FLAGS_LTO" CXXFLAGS="$CXXFLAGS $FLAGS_LTO" LDFLA
--with-yaml \
--with-openssl \
--with-zip \
--with-libdeflate="$INSTALL_DIR" \
--with-libdeflate \
$HAS_LIBJPEG \
$HAS_GD \
--with-leveldb="$INSTALL_DIR" \
Expand Down
23 changes: 15 additions & 8 deletions windows-compile-vs.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set MSBUILD_CONFIGURATION=RelWithDebInfo
set LIBYAML_VER=0.2.5
set PTHREAD_W32_VER=3.0.0
set LEVELDB_MCPE_VER=1c7564468b41610da4f498430e795ca4de0931ff
set LIBDEFLATE_VER=0d1779a071bcc636e5156ddb7538434da7acad22
set LIBDEFLATE_VER=bd925ae68e99f65d69f20181cb845aaba5c8f098

set PHP_PTHREADS_VER_PM4=4.2.1
set PHP_PTHREADS_VER_PM5=5.3.0
Expand All @@ -33,7 +33,7 @@ set PHP_LEVELDB_VER=317fdcd8415e1566fc2835ce2bdb8e19b890f9f3
set PHP_CRYPTO_VER=0.3.2
set PHP_RECURSIONGUARD_VER=0.1.0
set PHP_MORTON_VER=0.1.2
set PHP_LIBDEFLATE_VER=0.1.0
set PHP_LIBDEFLATE_VER=0.2.0
set PHP_XXHASH_VER=0.1.1
REM fork of xdebug to work around https://github.com/xdebug/xdebug/pull/878
set PHP_XDEBUG_VER=fbd5d9cb9e18502992e017925a34b7232755f34f
Expand Down Expand Up @@ -194,12 +194,19 @@ call :get-zip https://github.com/ebiggers/libdeflate/archive/%LIBDEFLATE_VER%.zi
move libdeflate-%LIBDEFLATE_VER% libdeflate >>"%log_file%" 2>&1
cd /D libdeflate

call :pm-echo "Compiling..."
nmake /f Makefile.msc >>"%log_file%" 2>&1 || exit 1
call :pm-echo "Copying files..."
copy libdeflate.dll "%DEPS_DIR%\bin\libdeflate.dll" >>"%log_file%" 2>&1 || exit 1
copy libdeflate.lib "%DEPS_DIR%\lib\libdeflate.lib" >>"%log_file%" 2>&1 || exit 1
copy libdeflate.h "%DEPS_DIR%\include\libdeflate.h" >>"%log_file%" 2>&1 || exit 1
call :pm-echo "Generating build configuration..."
cmake -G "%CMAKE_TARGET%" -A "%ARCH%"^
-DCMAKE_PREFIX_PATH="%DEPS_DIR%"^
-DCMAKE_INSTALL_PREFIX="%DEPS_DIR%"^
-DLIBDEFLATE_BUILD_GZIP=OFF^
-DLIBDEFLATE_BUILD_SHARED_LIB=ON^
-DLIBDEFLATE_BUILD_STATIC_LIB=OFF^
. >>"%log_file%" 2>&1 || exit 1
call :pm-echo "Compiling"
msbuild ALL_BUILD.vcxproj /p:Configuration=%MSBUILD_CONFIGURATION% /m >>"%log_file%" 2>&1 || exit 1
call :pm-echo "Installing files..."
msbuild INSTALL.vcxproj /p:Configuration=%MSBUILD_CONFIGURATION% >>"%log_file%" 2>&1 || exit 1
copy %MSBUILD_CONFIGURATION%\deflate.pdb "%DEPS_DIR%\bin\deflate.pdb" >>"%log_file%" 2>&1 || exit 1

cd /D "%DEPS_DIR%"

Expand Down

0 comments on commit 71b9f9d

Please sign in to comment.