diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cfab31..414ca34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build on: push: pull_request: + workflow_dispatch: repository_dispatch: types: [run_build] @@ -12,6 +13,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + with: + python-version: '3.x' - name: Install dependencies run: | sudo apt-get update @@ -21,7 +24,7 @@ jobs: run: | git config --global user.email "builds@travis-ci.com" git config --global user.name "Travis CI" - mkdir build + mkdir -p build cd build cmake .. make -j$(nproc) tarball @@ -36,6 +39,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + with: + python-version: '3.x' - name: Install dependencies run: | sudo apt-get update @@ -45,7 +50,7 @@ jobs: run: | git config --global user.email "builds@travis-ci.com" git config --global user.name "Travis CI" - mkdir build + mkdir -p build cd build cmake .. make -j$(nproc) tarball @@ -56,24 +61,52 @@ jobs: name: vitasdk-linux-arm64 path: build/*.tar.bz2 build-macos: - runs-on: macos-12 + runs-on: macos-15-intel steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + brew install autoconf automake libtool texinfo - name: Build run: | git config --global user.email "builds@travis-ci.com" git config --global user.name "Travis CI" - brew install autoconf automake libtool - mkdir build + mkdir -p build cd build cmake .. - make -j$(nproc) tarball + make -j4 tarball + - name: Upload artifacts + if: ${{ success() }} + uses: actions/upload-artifact@v4 + with: + name: vitasdk-macos-x86_64 + path: build/*.tar.bz2 + build-macos-arm64: + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + brew install autoconf automake libtool texinfo + - name: Build + run: | + git config --global user.email "builds@travis-ci.com" + git config --global user.name "Travis CI" + mkdir -p build + cd build + cmake .. + make -j4 tarball - name: Upload artifacts if: ${{ success() }} uses: actions/upload-artifact@v4 with: - name: vitasdk-macos + name: vitasdk-macos-arm64 path: build/*.tar.bz2 build-windows: # TODO match as build-linux @@ -83,6 +116,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + with: + python-version: '3.x' - name: Install dependencies run: | sudo apt-get update @@ -94,7 +129,7 @@ jobs: git config --global user.name "Travis CI" unset CXX unset CC - mkdir build + mkdir -p build cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=toolchain-x86_64-w64-mingw32.cmake make -j$(nproc) tarball diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a1072b..2360d59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,9 +148,11 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi ExternalProject_Add_Step(zlib${suffix} delete_shared DEPENDEES install - COMMAND ${CMAKE_COMMAND} -E remove + COMMAND ${CMAKE_COMMAND} -E remove -f ${toolchain_deps_dir}/lib/libz.so ${toolchain_deps_dir}/lib/libz.so.1 + ${toolchain_deps_dir}/lib/libz.dylib + ${toolchain_deps_dir}/lib/libz.*.dylib COMMENT "Delete shared libraries, if present" ) endif() @@ -173,7 +175,8 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi GIT_REPOSITORY https://github.com/vitasdk/libzip GIT_TAG ${LIBZIP_TAG} ${GIT_SHALLOW_SUPPORT} - PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libzip.patch + PATCH_COMMAND git -C reset --hard HEAD && git -C clean -fd + COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libzip.patch CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${toolchain_deps_dir} ${toolchain_cmake_args} ${libzip_configure} -DZLIB_INCLUDE_DIR=${toolchain_deps_dir}/include @@ -185,6 +188,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi URL_HASH ${LIBELF_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libelf.patch + COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND autoreconf -i COMMAND CC=${cc_compiler} RANLIB=${ranlib} ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -195,9 +199,10 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi ) ExternalProject_add(libyaml${suffix} - URL http://pyyaml.org/download/libyaml/yaml-${LIBYAML_VERSION}.tar.gz + URL https://pyyaml.org/download/libyaml/yaml-${LIBYAML_VERSION}.tar.gz URL_HASH ${LIBYAML_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} + PATCH_COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh /config CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -208,25 +213,37 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi "CFLAGS=-DYAML_DECLARE_STATIC" ) + # GMP assembly causes issues on macOS - need to disable it and use PIC + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(gmp_asm_flag --disable-assembly) + set(gmp_env_command ${CMAKE_COMMAND} -E env "CFLAGS=-fPIC -fexceptions" "CXXFLAGS=-fPIC -fexceptions") + else() + set(gmp_asm_flag "") + set(gmp_env_command ${CMAKE_COMMAND} -E env "CFLAGS=-fexceptions" "CXXFLAGS=-fexceptions") + endif() + ExternalProject_add(gmp${suffix} - URL http://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2 + URL https://ftpmirror.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2 URL_HASH ${GMP_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} - CONFIGURE_COMMAND CPPFLAGS=-fexceptions ${compiler_flags} ${wrapper_command} /configure + PATCH_COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh + CONFIGURE_COMMAND ${gmp_env_command} ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} --prefix=${toolchain_deps_dir} --libdir=${toolchain_deps_dir}/lib --enable-cxx --disable-shared + ${gmp_asm_flag} BUILD_COMMAND ${compiler_flags} ${wrapper_command} $(MAKE) ) ExternalProject_add(mpfr${suffix} DEPENDS gmp${suffix} - URL http://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2 + URL https://ftpmirror.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2 URL_HASH ${MPFR_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} + PATCH_COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -238,9 +255,10 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi ExternalProject_add(mpc${suffix} DEPENDS gmp${suffix} mpfr${suffix} - URL https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz + URL https://ftpmirror.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz URL_HASH ${MPC_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} + PATCH_COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -257,6 +275,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi GIT_REPOSITORY https://github.com/Meinersbur/isl GIT_TAG isl-${ISL_VERSION} DOWNLOAD_DIR ${DOWNLOAD_DIR} + PATCH_COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND cd && ./autogen.sh COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -270,6 +289,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi URL https://github.com/libexpat/libexpat/releases/download/R_2_3_0/expat-${EXPAT_VERSION}.tar.bz2 URL_HASH ${EXPAT_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} + PATCH_COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh /conftools CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -294,13 +314,15 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi ) ExternalProject_Add(binutils${suffix} - URL https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz + URL https://ftpmirror.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz URL_HASH ${BINUTILS_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0001-vita.patch && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0002-fix-broken-reloc.patch && patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0003-fix-elf-vaddr.patch + && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/common/zlib-fdopen-macos.patch + && sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -319,10 +341,13 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi ) ExternalProject_Add(gdb${suffix} - URL https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz + URL https://ftpmirror.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz URL_HASH ${GDB_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gdb.patch + && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/common/zlib-fdopen-macos.patch + && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gdb-enum-fix.patch + && sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -459,10 +484,12 @@ endif() # Build a basic gcc compiler, needed to compile newlib ExternalProject_add(gcc-base DEPENDS gmp_${build_suffix} mpfr_${build_suffix} mpc_${build_suffix} isl_${build_suffix} libelf_${build_suffix} - URL http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz + URL https://ftpmirror.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz URL_HASH ${GCC_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-10.patch + && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0002-fix-macos-arm64.patch + && sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} # compile a native compiler so keep host == build @@ -557,10 +584,12 @@ ExternalProject_Add(newlib if(CMAKE_TOOLCHAIN_FILE) ExternalProject_add(gcc-complete DEPENDS newlib gmp_${build_suffix} mpfr_${build_suffix} mpc_${build_suffix} isl_${build_suffix} libelf_${build_suffix} - URL http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz + URL https://ftpmirror.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz URL_HASH ${GCC_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-10.patch + && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0002-fix-macos-arm64.patch + && sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND ${compiler_flags} ${toolchain_tools} ${wrapper_command} /configure --build=${build_native} @@ -613,10 +642,12 @@ ExternalProject_Add(pthread-embedded ExternalProject_add(gcc-final DEPENDS gmp_${target_suffix} mpfr_${target_suffix} mpc_${target_suffix} isl_${target_suffix} libelf_${target_suffix} DEPENDS newlib ${GCC_DEPENDS} pthread-embedded - URL http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz + URL https://ftpmirror.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz URL_HASH ${GCC_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-10.patch + && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0002-fix-macos-arm64.patch + && sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh CONFIGURE_COMMAND ${compiler_flags} ${toolchain_tools} ${compiler_target_tools} ${wrapper_command} /configure --build=${build_native} diff --git a/cmake/update_config_files.sh b/cmake/update_config_files.sh new file mode 100755 index 0000000..7f646bd --- /dev/null +++ b/cmake/update_config_files.sh @@ -0,0 +1,75 @@ +#!/bin/sh +# Update config.sub and config.guess for ARM64 support +set -e + +SOURCE_DIR=$1 + +if [ -z "$SOURCE_DIR" ]; then + echo "Error: No source directory provided" >&2 + echo "Usage: $0 " >&2 + exit 1 +fi + +if [ ! -d "$SOURCE_DIR" ]; then + echo "Error: Source directory does not exist: $SOURCE_DIR" >&2 + exit 1 +fi + +# Update on ARM64 platforms (macOS and Linux) - old config files don't recognize aarch64 +ARCH=$(uname -m) +OS=$(uname -s) + +# Check if we're on ARM64 (macOS uses "arm64", Linux uses "aarch64") +if [ "$ARCH" != "arm64" ] && [ "$ARCH" != "aarch64" ]; then + echo "Skipping config files update (not ARM64 platform: $ARCH)" + exit 0 +fi + +echo "Updating config.sub and config.guess in $SOURCE_DIR for ARM64 support ($OS $ARCH)" + +# Check if curl is available +if ! command -v curl >/dev/null 2>&1; then + echo "Error: curl command not found. Cannot download config files." >&2 + echo " Please install curl or manually update config.sub and config.guess" >&2 + exit 1 +fi + +# Remove old files if they exist and are read-only +[ -f "$SOURCE_DIR/config.sub" ] && chmod +w "$SOURCE_DIR/config.sub" 2>/dev/null +[ -f "$SOURCE_DIR/config.guess" ] && chmod +w "$SOURCE_DIR/config.guess" 2>/dev/null + +# Download latest config files from GNU config repository +CONFIG_BASE_URL='https://git.savannah.gnu.org/cgit/config.git/plain' + +# Try to download latest config.sub with timeout and retries +if ! curl -f -s -S -L --connect-timeout 30 --max-time 60 --retry 3 \ + -o "$SOURCE_DIR/config.sub" "$CONFIG_BASE_URL/config.sub"; then + echo "Warning: Failed to download config.sub from $CONFIG_BASE_URL/config.sub" >&2 + echo " Build might fail on ARM64 if config.sub doesn't support aarch64" >&2 +else + echo "Successfully downloaded config.sub" +fi + +# Try to download latest config.guess with timeout and retries +if ! curl -f -s -S -L --connect-timeout 30 --max-time 60 --retry 3 \ + -o "$SOURCE_DIR/config.guess" "$CONFIG_BASE_URL/config.guess"; then + echo "Warning: Failed to download config.guess from $CONFIG_BASE_URL/config.guess" >&2 + echo " Build might fail on ARM64 if config.guess doesn't recognize this platform" >&2 +else + echo "Successfully downloaded config.guess" +fi + +# Make them executable if they exist +if [ -f "$SOURCE_DIR/config.sub" ]; then + chmod +x "$SOURCE_DIR/config.sub" + echo "Made config.sub executable" +fi + +if [ -f "$SOURCE_DIR/config.guess" ]; then + chmod +x "$SOURCE_DIR/config.guess" + echo "Made config.guess executable" +fi + +echo "Config files update completed" +exit 0 + diff --git a/patches/common/zlib-fdopen-macos.patch b/patches/common/zlib-fdopen-macos.patch new file mode 100644 index 0000000..6dfc0f6 --- /dev/null +++ b/patches/common/zlib-fdopen-macos.patch @@ -0,0 +1,29 @@ +Remove obsolete Metrowerks CodeWarrior fdopen workaround from zlib + +This patch removes legacy code for the Metrowerks CodeWarrior compiler from the 1990s. +The code was attempting to work around missing or incompatible fdopen() implementations +on pre-macOS systems. Modern macOS (since OS X) provides standard POSIX fdopen() support, +making this workaround unnecessary and actually problematic as it can conflict with +system headers. + +This fix is needed for binutils, GDB, and GCC which all bundle their own copy of zlib. + +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -132,15 +132,6 @@ + + #if defined(MACOS) || defined(TARGET_OS_MAC) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn + diff --git a/patches/gcc/0002-fix-macos-arm64.patch b/patches/gcc/0002-fix-macos-arm64.patch new file mode 100644 index 0000000..4ef2dda --- /dev/null +++ b/patches/gcc/0002-fix-macos-arm64.patch @@ -0,0 +1,58 @@ +GCC 10.3.0 fixes for macOS (especially ARM64/Apple Silicon) + +This patch addresses several issues preventing GCC 10.3.0 from building on macOS: + +1. Remove obsolete zlib fdopen workaround (see common/zlib-fdopen-macos.patch) +2. Wrap safe-ctype.h macro redefinitions in #ifndef __cplusplus to prevent + conflicts with C++ standard library headers +3. Add aarch64-darwin and arm64-darwin to config.host so host-darwin.o is + compiled for ARM64 macOS builds + +These fixes are necessary for both x86_64 and ARM64 macOS builds. + +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -132,15 +132,6 @@ + + #if defined(MACOS) || defined(TARGET_OS_MAC) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn +--- a/include/safe-ctype.h ++++ b/include/safe-ctype.h +@@ -120,6 +120,7 @@ + So we include ctype.h here and then immediately redefine its macros. */ + + #include ++#ifndef __cplusplus + #undef isalpha + #define isalpha(c) do_not_use_isalpha_with_safe_ctype + #undef isalnum +@@ -147,4 +148,5 @@ + #undef tolower + #define tolower(c) do_not_use_tolower_with_safe_ctype + ++#endif /* __cplusplus */ + #endif /* SAFE_CTYPE_H */ +--- a/gcc/config.host ++++ b/gcc/config.host +@@ -251,7 +251,7 @@ + host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o" + host_lto_plugin_soname=liblto_plugin-0.dll + ;; +- i[34567]86-*-darwin* | x86_64-*-darwin*) ++ i[34567]86-*-darwin* | x86_64-*-darwin* | aarch64-*-darwin* | arm64-*-darwin*) + out_host_hook_obj="${out_host_hook_obj} host-i386-darwin.o" + host_xmake_file="${host_xmake_file} i386/x-darwin" + ;; + diff --git a/patches/gdb-enum-fix.patch b/patches/gdb-enum-fix.patch new file mode 100644 index 0000000..a438a7b --- /dev/null +++ b/patches/gdb-enum-fix.patch @@ -0,0 +1,31 @@ +Fix Clang enum-constexpr-conversion warning in GDB enum-flags.h + +This patch suppresses the -Wenum-constexpr-conversion warning that occurs when +building GDB with Clang on macOS. The warning is triggered by the enum_underlying_type +template which uses sizeof() on enum types in a way that Clang considers problematic, +even though the code is valid and works correctly. + +--- a/gdb/gdbsupport/enum-flags.h ++++ b/gdb/gdbsupport/enum-flags.h +@@ -79,6 +79,10 @@ template<> struct integer_for_size<4, 1> { typedef int32_t type; }; + template<> struct integer_for_size<8, 1> { typedef int64_t type; }; + + template ++#ifdef __clang__ ++#pragma clang diagnostic push ++#pragma clang diagnostic ignored "-Wenum-constexpr-conversion" ++#endif + struct enum_underlying_type + { + typedef typename +@@ -86,6 +90,9 @@ struct enum_underlying_type + type; + }; + ++#ifdef __clang__ ++#pragma clang diagnostic pop ++#endif + template + class enum_flags + { + diff --git a/patches/zlib.patch b/patches/zlib.patch index 7d1657d..17ac266 100644 --- a/patches/zlib.patch +++ b/patches/zlib.patch @@ -1,5 +1,7 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b412dc7..7e847ee 100644 +Patch for standalone zlib build +- Updates CMake minimum version requirement for modern CMake compatibility +- Removes obsolete Metrowerks CodeWarrior fdopen workaround (same as patches/common/zlib-fdopen-macos.patch) + --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ @@ -8,29 +10,18 @@ index b412dc7..7e847ee 100644 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -@@ -189,25 +189,3 @@ endif() - if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) - install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") - endif() -- --#============================================================================ --# Example binaries --#============================================================================ -- --add_executable(example test/example.c) --target_link_libraries(example zlib) --add_test(example example) -- --add_executable(minigzip test/minigzip.c) --target_link_libraries(minigzip zlib) -- --if(HAVE_OFF64_T) -- add_executable(example64 test/example.c) -- target_link_libraries(example64 zlib) -- set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -- add_test(example64 example64) -- -- add_executable(minigzip64 test/minigzip.c) -- target_link_libraries(minigzip64 zlib) -- set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") --endif() +--- a/zutil.h ++++ b/zutil.h +@@ -140,12 +140,3 @@ + #if defined(MACOS) || defined(TARGET_OS_MAC) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif