Skip to content

Commit

Permalink
zlib.sh: drop convoluted local fix for upstream RC build bug [ci skip]
Browse files Browse the repository at this point in the history
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): madler/zlib#677
  • Loading branch information
vszakats committed Aug 19, 2023
1 parent e2031e4 commit d5051a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 32 deletions.
16 changes: 0 additions & 16 deletions _build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 4 additions & 16 deletions zlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit d5051a9

Please sign in to comment.