From d5051a91d39156bf1ce7bdaa7b4247d9a3e8141a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 19 Aug 2023 20:17:57 +0000 Subject: [PATCH] zlib.sh: drop convoluted local fix for upstream RC build bug [ci skip] Use a less convoluted, shorter workaround instead. It appears that zlib is either uninterested in accepting bugfixes, or thinks that the correct fix might be wrong, or may break compatibility with 20+ year old CMake releases, or possibly breaking some old, undefined system, or may hit a niche bug somebody heard about, and/or just afraid to make any changes, or even let its CI run on them. PR (abandoned): https://github.com/madler/zlib/pull/677 --- _build.sh | 16 ---------------- zlib.sh | 20 ++++---------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/_build.sh b/_build.sh index 1667ee631..040cd370e 100755 --- a/_build.sh +++ b/_build.sh @@ -722,22 +722,6 @@ build_single_target() { export NM="${_BINUTILS_PREFIX}nm${_BINUTILS_SUFFIX}" export RANLIB="${_BINUTILS_PREFIX}ranlib${_BINUTILS_SUFFIX}" - # In some environments, we need to pair up llvm-windres with the mingw-w64 - # include dir, and/or we need to pass it the target platform. Some builds - # do not (yet) support adding custom options. Add a wrapper for these - # builds that calls llvm-windres with the necessary custom options. - export _RC_WRAPPER='' - if [ "${_CC}" = 'llvm' ] && \ - [ "${_TOOLCHAIN}" != 'llvm-mingw' ] && \ - [ -n "${_RCFLAGS_GLOBAL}" ]; then - _RC_WRAPPER="$(pwd)/llvm-windres-wrapper" - { - echo '#!/bin/sh -e' - echo "'${RC}' ${_RCFLAGS_GLOBAL} \"\$@\"" - } > "${_RC_WRAPPER}" - chmod +x "${_RC_WRAPPER}" - fi - # ar wrapper to normalize created libs if [ "${CW_DEV_CROSSMAKE_REPRO:-}" = '1' ]; then export AR_NORMALIZE diff --git a/zlib.sh b/zlib.sh index 79e707d7a..087b6633e 100755 --- a/zlib.sh +++ b/zlib.sh @@ -22,17 +22,6 @@ _VER="$1" options="${options} -DBUILD_SHARED_LIBS=OFF" options="${options} -DZLIB_COMPAT=ON" options="${options} -DZLIB_ENABLE_TESTS=OFF" - else - # Unset this to use an alternative workaround which does not need our - # _RC_WRAPPER trickery: - zlib_use_rc_wrapper='1' - - if [ "${zlib_use_rc_wrapper}" = '1' ]; then - # FIXME (upstream): zlib v1.3 prevents passing custom RCFLAGS to - # the RC command. Use our wrapper as a workaround. - # PR: https://github.com/madler/zlib/pull/677 - [ -n "${_RC_WRAPPER}" ] && export RC="${_RC_WRAPPER}" - fi fi # shellcheck disable=SC2086 @@ -42,11 +31,10 @@ _VER="$1" make --directory="${_BLDDIR}" --jobs="${_JOBS}" install "DESTDIR=$(pwd)/${_PKGDIR}" - if [ "${_NAM}" = 'zlib' ] && \ - [ "${zlib_use_rc_wrapper}" != '1' ]; then - # Building shared lib has issues compiling resources: - # PR: https://github.com/madler/zlib/pull/677 - # Workaround to build static only and install manually: + if [ "${_NAM}" = 'zlib' ]; then + # zlib's RC compilation is broken as of v1.3 (2023-08-18) with broken CMake + # option to disable shared libs. `install` wants to build all targets. + # Workaround: Build static only and install manually. make --directory="${_BLDDIR}" --jobs="${_JOBS}" zlibstatic mkdir -p "${_PP}/include"