Skip to content

Commit

Permalink
Update to minizip-ng 4.0.7 and zlib-ng 2.2.1-r2 (#5)
Browse files Browse the repository at this point in the history
* Update to minizip-ng 4.0.7 submodule

* Update to zlib-ng 2.2.1-r2

* Update build scripts for new library version
Fix windows symbol generation
Rework cmake builds
  • Loading branch information
RyeMutt authored Aug 9, 2024
1 parent fd12b22 commit 9fc435a
Show file tree
Hide file tree
Showing 106 changed files with 73 additions and 34,090 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
name: Build
on: [push]
on:
pull_request:
push:
branches: [main]
tags: [v*]
jobs:
build:
strategy:
matrix:
os: [windows-2022, macos-11, ubuntu-22.04]
os: [windows-2022, macos-12, ubuntu-22.04]
addrsize: ["64"]
include:
- os: windows-2022
addrsize: "32"
runs-on: ${{ matrix.os }}
steps:
- name: Setup Homebrew Packages
if: ${{ runner.os == 'macOS' }}
shell: bash
run: brew install ninja
- name: Setup Apt Packages
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install ninja-build
- uses: secondlife/action-autobuild@v4
with:
addrsize: ${{ matrix.addrsize }}
Expand All @@ -20,5 +31,3 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: secondlife/action-autobuild-release@v3
with:
public: true
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "minizip-ng"]
path = minizip-ng
url = https://github.com/zlib-ng/minizip-ng.git
20 changes: 10 additions & 10 deletions autobuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>dacc5f3fb307c4d1292ed1ffb1d595d83599062d</string>
<string>3a6593c71c59ace76d1349483759fcde4b719a76</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-zlib-ng/releases/download/v1.2.11.zlib-ng.32fd361/zlib_ng-1.2.11.zlib-ng.32fd361-darwin64-32fd361.tar.zst</string>
<string>https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.1-r2/zlib_ng-2.2.1-r2-darwin64-10324415171.tar.zst</string>
</map>
<key>name</key>
<string>darwin64</string>
Expand All @@ -37,11 +37,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>fba88375e12454ae19f4528e11ffc7ddf7d879ec</string>
<string>fbadeb0b8c771cb06c0055c9fab6d40c6764dacd</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-zlib-ng/releases/download/v1.2.11.zlib-ng.32fd361/zlib_ng-1.2.11.zlib-ng.32fd361-linux64-32fd361.tar.zst</string>
<string>https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.1-r2/zlib_ng-2.2.1-r2-linux64-10324415171.tar.zst</string>
</map>
<key>name</key>
<string>linux64</string>
Expand All @@ -65,18 +65,18 @@
<key>archive</key>
<map>
<key>hash</key>
<string>ccfca9451063e2d0e95baa73b1ad2054d3e38907</string>
<string>0094031715662be626f5106ff6c814f4fc3dacfa</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-zlib-ng/releases/download/v1.2.11.zlib-ng.32fd361/zlib_ng-1.2.11.zlib-ng.32fd361-windows64-32fd361.tar.zst</string>
<string>https://github.com/secondlife/3p-zlib-ng/releases/download/v2.2.1-r2/zlib_ng-2.2.1-r2-windows64-10324415171.tar.zst</string>
</map>
<key>name</key>
<string>windows64</string>
</map>
</map>
<key>version</key>
<string>1.2.11.zlib-ng.32fd361</string>
<string>2.2.1-r2</string>
</map>
</map>
<key>package_description</key>
Expand All @@ -93,6 +93,8 @@
<string>LICENSES/minizip-ng.txt</string>
<key>name</key>
<string>minizip-ng</string>
<key>use_scm_version</key>
<boolean>true</boolean>
<key>platforms</key>
<map>
<key>common</key>
Expand Down Expand Up @@ -187,14 +189,12 @@
</map>
<key>manifest</key>
<array>
<string>lib/release/libminizip.lib</string>
<string>lib/release/minizip.lib</string>
</array>
<key>name</key>
<string>windows</string>
</map>
</map>
<key>version_file</key>
<string>VERSION.txt</string>
</map>
<key>type</key>
<string>autobuild</string>
Expand Down
127 changes: 43 additions & 84 deletions build-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,21 @@ source_environment_tempfile="$stage/source_environment.sh"
# remove_cxxstd
source "$(dirname "$AUTOBUILD_VARIABLES_FILE")/functions"

VERSION_HEADER_FILE="$MINIZLIB_SOURCE_DIR/mz.h"
version=$(sed -n -E 's/#define MZ_VERSION[ ]+[(]"([0-9.]+)"[)]/\1/p' "${VERSION_HEADER_FILE}")
build=${AUTOBUILD_BUILD_ID:=0}
echo "${version}.${build}" > "${stage}/VERSION.txt"

# CMake configuration options for all platforms
config=( \
-DBUILD_SHARED_LIBS=OFF \
-DMZ_BUILD_TESTS=ON \
-DMZ_BUILD_UNIT_TESTS=ON \
-DMZ_BZIP2=OFF \
-DMZ_COMPAT=ON \
-DMZ_FETCH_LIBS=OFF \
-DMZ_FORCE_FETCH_LIBS=OFF \
-DMZ_ICONV=OFF \
-DMZ_LIBBSD=OFF \
-DMZ_LIBCOMP=OFF \
-DMZ_LZMA=OFF \
-DMZ_OPENSSL=OFF \
-DMZ_PKCRYPT=OFF \
-DMZ_SIGNING=OFF \
-DMZ_WZAES=OFF \
-DMZ_ZSTD=OFF \
)
Expand All @@ -63,13 +59,19 @@ pushd "$MINIZLIB_SOURCE_DIR"
windows*)
load_vsvars

cmake -G "$AUTOBUILD_WIN_CMAKE_GEN" -A "$AUTOBUILD_WIN_VSPLATFORM" . \
-DCMAKE_C_FLAGS:STRING="$LL_BUILD_RELEASE" \
-DCMAKE_CXX_FLAGS:STRING="$LL_BUILD_RELEASE" \
"${config[@]}" \
-DZLIB_INCLUDE_DIRS="$(cygpath -m $stage)/packages/include/zlib-ng/" \
-DZLIB_LIBRARIES="$(cygpath -m $stage)/packages/lib/release/zlib.lib"
opts="$(replace_switch /Zi /Z7 $LL_BUILD_RELEASE)"
plainopts="$(remove_switch /GR $(remove_cxxstd $opts))"

mkdir -p "build"
pushd "build"
cmake $(cygpath -m ${top}/${MINIZLIB_SOURCE_DIR}) -G "Ninja Multi-Config" \
-DCMAKE_C_FLAGS:STRING="$plainopts" \
-DCMAKE_CXX_FLAGS:STRING="$opts" \
"${config[@]}" \
-DCMAKE_INSTALL_PREFIX=$(cygpath -m $stage) \
-DCMAKE_INSTALL_LIBDIR="$(cygpath -m "$stage/lib/release")" \
-DZLIB_INCLUDE_DIR="$(cygpath -m "$stage/packages/include/zlib-ng/")" \
-DZLIB_LIBRARY="$(cygpath -m "$stage/packages/lib/release/zlib.lib")"

cmake --build . --config Release

Expand All @@ -78,42 +80,32 @@ pushd "$MINIZLIB_SOURCE_DIR"
ctest -C Release
fi

mkdir -p "$stage/lib/release"
cp -a "Release/libminizip.lib" "$stage/lib/release/"
cmake --install . --config Release

mkdir -p "$stage/include/minizip-ng"
cp -a *.h "$stage/include/minizip-ng"
mkdir -p $stage/include/minizip-ng
mv $stage/include/minizip/*.h "$stage/include/minizip-ng/"
popd
;;

# ------------------------- darwin, darwin64 -------------------------
darwin*)
mkdir -p "build"
pushd "build"

opts="${TARGET_OPTS:--arch $AUTOBUILD_CONFIGURE_ARCH $LL_BUILD_RELEASE}"

# As of version 3.0.2 (2023-05-18), we get:
# clang: warning: overriding '-mmacosx-version-min=10.13' option
# with '-target x86_64-apple-macos11.7' [-Woverriding-t-option]
# We didn't specify -target explicitly before; try setting it.
# (_find and _test_re from build-variables/functions script)
if idx=$(_find _test_re "-mmacosx-version-min=.*" $opts)
then
optarray=($opts)
versw="${optarray[$idx]}"
minver="${versw#*=}"
optarray+=(-target "x86_64-apple-macos$minver")
opts="${optarray[*]}"
fi
export MACOSX_DEPLOYMENT_TARGET="$LL_BUILD_DARWIN_DEPLOY_TARGET"

mkdir -p "$stage/lib/release"
rm -rf Resources/ ../Resources tests/Resources/
opts="${TARGET_OPTS:--arch $AUTOBUILD_CONFIGURE_ARCH $LL_BUILD_RELEASE}"

cmake ../${MINIZLIB_SOURCE_DIR} -GXcode \
cmake ${top}/${MINIZLIB_SOURCE_DIR} -G "Ninja Multi-Config" \
-DCMAKE_C_FLAGS:STRING="$(remove_cxxstd $opts)" \
-DCMAKE_CXX_FLAGS:STRING="$opts" \
"${config[@]}" \
-DCMAKE_INSTALL_PREFIX=$stage \
-DZLIB_INCLUDE_DIRS="$stage/packages/include/zlib-ng/" \
-DZLIB_LIBRARIES="$stage/packages/lib/release/libz.a"
-DCMAKE_INSTALL_LIBDIR="$stage/lib/release" \
-DZLIB_INCLUDE_DIR="${stage}/packages/include/zlib-ng/" \
-DZLIB_LIBRARY="${stage}/packages/lib/release/libz.a" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
-DCMAKE_OSX_ARCHITECTURES="x86_64"

cmake --build . --config Release

Expand All @@ -122,81 +114,48 @@ pushd "$MINIZLIB_SOURCE_DIR"
ctest -C Release
fi

mkdir -p "$stage/lib/release"
cp -a Release/libminizip*.a* "${stage}/lib/release/"
cmake --install . --config Release

mkdir -p "$stage/include/minizip-ng"
cp -a *.h "$stage/include/minizip-ng"
mkdir -p $stage/include/minizip-ng
mv $stage/include/minizip/*.h "$stage/include/minizip-ng/"
popd
;;

# -------------------------- linux, linux64 --------------------------
linux*)

# Linux build environment at Linden comes pre-polluted with stuff that can
# seriously damage 3rd-party builds. Environmental garbage you can expect
# includes:
#
# DISTCC_POTENTIAL_HOSTS arch root CXXFLAGS
# DISTCC_LOCATION top branch CC
# DISTCC_HOSTS build_name suffix CXX
# LSDISTCC_ARGS repo prefix CFLAGS
# cxx_version AUTOBUILD SIGN CPPFLAGS
#
# So, clear out bits that shouldn't affect our configure-directed build
# but which do nonetheless.
#
unset DISTCC_HOSTS CC CXX CFLAGS CPPFLAGS CXXFLAGS

# Prefer gcc-4.6 if available.
if [[ -x /usr/bin/gcc-4.6 && -x /usr/bin/g++-4.6 ]]; then
export CC=/usr/bin/gcc-4.6
export CXX=/usr/bin/g++-4.6
fi

# Prefer out of source builds
rm -rf build
mkdir -p build
pushd build
pushd "build"

# Default target per autobuild build --address-size
opts="${TARGET_OPTS:--m$AUTOBUILD_ADDRSIZE $LL_BUILD_RELEASE}"

# Handle any deliberate platform targeting
if [ ! "${TARGET_CPPFLAGS:-}" ]; then
# Remove sysroot contamination from build environment
unset CPPFLAGS
else
# Incorporate special pre-processing flags
export CPPFLAGS="$TARGET_CPPFLAGS"
fi

cmake ${top}/${MINIZLIB_SOURCE_DIR} -G"Unix Makefiles" \
cmake ${top}/${MINIZLIB_SOURCE_DIR} -G"Ninja" \
-DCMAKE_C_FLAGS:STRING="$(remove_cxxstd $opts)" \
-DCMAKE_CXX_FLAGS:STRING="$opts" \
"${config[@]}" \
-DCMAKE_INSTALL_PREFIX=$stage \
-DZLIB_INCLUDE_DIRS="$stage/packages/include/zlib-ng/" \
-DZLIB_LIBRARIES="$stage/packages/lib/release/libz.a"
-DCMAKE_INSTALL_LIBDIR="$stage/lib/release" \
-DZLIB_INCLUDE_DIR="${stage}/packages/include/zlib-ng/" \
-DZLIB_LIBRARY="${stage}/packages/lib/release/libz.a"

cmake --build . --parallel 8 --config Release
cmake --build . --config Release

# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" -eq 0 ]; then
ctest -C Release
fi

mkdir -p "$stage/lib/release"
cp -a libminizip*.a* "${stage}/lib/release/"

mkdir -p "$stage/include/minizip-ng"
cp -a ${top}/${MINIZLIB_SOURCE_DIR}/*.h "$stage/include/minizip-ng"
cmake --install . --config Release

popd
mkdir -p $stage/include/minizip-ng
mv $stage/include/minizip/*.h "$stage/include/minizip-ng/"
popd
;;
esac

mkdir -p "$stage/LICENSES"
cp LICENSE "$stage/LICENSES/minizip-ng.txt"
cp ${top}/${MINIZLIB_SOURCE_DIR}/LICENSE "$stage/LICENSES/minizip-ng.txt"
popd

mkdir -p "$stage"/docs/minizip-ng/
Expand Down
1 change: 1 addition & 0 deletions minizip-ng
Submodule minizip-ng added at fe5fed
1 change: 0 additions & 1 deletion minizip-ng/.github/FUNDING.yml

This file was deleted.

51 changes: 0 additions & 51 deletions minizip-ng/.github/workflows/codeql-analysis.yml

This file was deleted.

Loading

0 comments on commit 9fc435a

Please sign in to comment.