@@ -6,6 +6,7 @@ BUILD_DIR_ROOT="${MY_DIR}/lzsbuild"
66OS=$( uname -s)
77LZS_BUILD_DIR=" ${BUILD_DIR_ROOT} /lib/${OS} "
88DEPS_BASE_BUILD_DIR=" ${BUILD_DIR_ROOT} /deps/${OS} "
9+ ZLIB_DIR=" external/zlib"
910
1011if [ " ${OS} " == " Darwin" ]; then
1112 DEPS_BUILD_DIR=" ${DEPS_BASE_BUILD_DIR} /native"
@@ -29,6 +30,7 @@ CONFIGURATION="RelWithDebInfo"
2930REBUILD=" no"
3031VERBOSE=" no"
3132USE_XZ=" no"
33+ USE_ZLIBNG=" no"
3234
3335# The color block is pilfered from the dotnet installer script
3436#
@@ -77,6 +79,7 @@ where OPTIONS are one or more of:
7779 -m|--cmake PATH use cmake at PATH instead of the default of '${CMAKE} '
7880
7981 -x|--xz use the XZ library for LZMA support (default: ${USE_XZ} )
82+ -g|--zlib-ng use the zlib-ng library instead of zlib (default: ${USE_ZLIBNG}
8083 -c|--configuration NAME build using configuration NAME instead of the default of '${CONFIGURATION} '
8184 -j|--jobs NUM run at most this many build jobs in parallel
8285 -v|--verbose make cmake and ninja verbose
@@ -233,6 +236,8 @@ while (( "$#" )); do
233236
234237 -x|--xz) USE_XZ=" yes" ; shift ;;
235238
239+ -g|--zlib-ng) USE_ZLIBNG=" yes" ; shift ;;
240+
236241 -v|--verbose) VERBOSE=" yes" ; shift ;;
237242
238243 -r|--rebuild) REBUILD=" yes" ; shift ;;
@@ -254,6 +259,14 @@ if [ -z "${NINJA}" ]; then
254259 die ninja binary must be specified
255260fi
256261
262+ if [ " ${USE_ZLIBNG} " == " no" ]; then
263+ ZLIB_CMAKELISTS_PATH=" ${ZLIB_DIR} /CMakeLists.txt"
264+ if ! $( grep ' lzs: disable-examples' " ${ZLIB_CMAKELISTS_PATH} " > /dev/null 2>&1 ) ; then
265+ print_banner Applying zlib patch
266+ $( cd " ${ZLIB_DIR} " ; git apply " ${MY_DIR} /zlib-changes.patch" )
267+ fi
268+ fi
269+
257270if [ " ${REBUILD} " == " yes" ]; then
258271 rm -rf " ${BUILD_DIR_ROOT} "
259272 rm -rf " ${ARTIFACTS_DIR_ROOT} "
0 commit comments