From 57c03e81b48c1b13916f85501718a1941e10a9fa Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Fri, 7 Jan 2022 21:25:07 -0600 Subject: [PATCH 1/7] Attempt to fix libelf autoconf --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3683079..cbde99e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,6 +185,8 @@ 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 ${CMAKE_COMMAND} -E copy /usr/share/misc/config.sub + COMMAND ${CMAKE_COMMAND} -E copy /usr/share/misc/config.guess CONFIGURE_COMMAND autoreconf -i COMMAND CC=${cc_compiler} RANLIB=${ranlib} ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} From c3c65fdd7af50bfc37c9dfa3527a52f2b94b1b08 Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Mon, 7 Mar 2022 02:05:12 -0600 Subject: [PATCH 2/7] Support 32bit in libzip --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c615acb..95ac1b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,8 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi PATCH_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} + -D_LARGEFILE_SOURCE=1 + -D_FILE_OFFSET_BITS=64 -DZLIB_INCLUDE_DIR=${toolchain_deps_dir}/include -DZLIB_LIBRARY=${toolchain_deps_dir}/lib/libz.a ) From 338755a325e9c0609b534b7444a16a6ab225ea6d Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Mon, 28 Mar 2022 21:35:39 -0500 Subject: [PATCH 3/7] Update zlib to 1.2.12 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95ac1b0..0a71a94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ project(vitasdk) set(GCC_VERSION 10.3.0) set(GCC_HASH SHA256=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344) -set(ZLIB_VERSION 1.2.11) -set(ZLIB_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066) +set(ZLIB_VERSION 1.2.12) +set(ZLIB_HASH SHA256=7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18) set(LIBELF_VERSION 0.8.13) set(LIBELF_HASH SHA256=591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d) From 46441a58e6f53614f6aad4836708353aa79c99a3 Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Mon, 28 Mar 2022 21:44:13 -0500 Subject: [PATCH 4/7] Update zlib.patch --- patches/zlib.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/zlib.patch b/patches/zlib.patch index d385789..02c0711 100644 --- a/patches/zlib.patch +++ b/patches/zlib.patch @@ -1,6 +1,6 @@ -diff -r -u zlib-1.2.11/CMakeLists.txt zlib-1.2.11-patched/CMakeLists.txt ---- zlib-1.2.11/CMakeLists.txt 2017-01-15 17:29:40.000000000 +0000 -+++ zlib-1.2.11-patched/CMakeLists.txt 2018-01-07 18:11:41.296650376 +0000 +diff -r -u zlib-1.2.12/CMakeLists.txt zlib-1.2.12-patched/CMakeLists.txt +--- zlib-1.2.12/CMakeLists.txt 2017-01-15 17:29:40.000000000 +0000 ++++ zlib-1.2.12-patched/CMakeLists.txt 2018-01-07 18:11:41.296650376 +0000 @@ -225,25 +225,3 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") From 4f8e435f882611e9d56026e6d1246cb8e937dfd4 Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Mon, 28 Mar 2022 22:16:31 -0500 Subject: [PATCH 5/7] Update zlib.patch --- patches/zlib.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/zlib.patch b/patches/zlib.patch index 02c0711..9f6f984 100644 --- a/patches/zlib.patch +++ b/patches/zlib.patch @@ -1,6 +1,6 @@ diff -r -u zlib-1.2.12/CMakeLists.txt zlib-1.2.12-patched/CMakeLists.txt ---- zlib-1.2.12/CMakeLists.txt 2017-01-15 17:29:40.000000000 +0000 -+++ zlib-1.2.12-patched/CMakeLists.txt 2018-01-07 18:11:41.296650376 +0000 +--- zlib-1.2.12/CMakeLists.txt 2022-03-27 18:39:42.000000000 -0500 ++++ zlib-1.2.12-patched/CMakeLists.txt 2022-03-28 22:10:09.518039100 -0500 @@ -225,25 +225,3 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") From 5bd5afd43c2965039bcf48d8a7d4b885874acb0d Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Fri, 27 May 2022 20:46:31 -0500 Subject: [PATCH 6/7] Bypass "patch detected" warning Allows rebuilding of projects without having to completely delete the build directory for the target at the expense of checking for a valid patch --- CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6101a01..8a3257a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,7 +126,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi URL https://zlib.net/zlib-${ZLIB_VERSION}.tar.xz URL_HASH ${ZLIB_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} - PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/zlib.patch + PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/zlib.patch || true CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${toolchain_deps_dir} ${toolchain_cmake_args} ) @@ -173,7 +173,7 @@ 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 patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libzip.patch || true CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${toolchain_deps_dir} ${toolchain_cmake_args} ${libzip_configure} -D_LARGEFILE_SOURCE=1 @@ -186,7 +186,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi URL https://github.com/vitasdk/artifacts/releases/download/libelf-${LIBELF_VERSION}/libelf-${LIBELF_VERSION}.tar.gz URL_HASH ${LIBELF_HASH} DOWNLOAD_DIR ${DOWNLOAD_DIR} - PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libelf.patch + PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libelf.patch || true COMMAND ${CMAKE_COMMAND} -E copy /usr/share/misc/config.sub COMMAND ${CMAKE_COMMAND} -E copy /usr/share/misc/config.guess CONFIGURE_COMMAND autoreconf -i COMMAND CC=${cc_compiler} RANLIB=${ranlib} ${compiler_flags} ${wrapper_command} /configure @@ -302,9 +302,9 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi 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 -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0001-vita.patch || true + && patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0002-fix-broken-reloc.patch || true + && patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0003-fix-elf-vaddr.patch || true CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -326,7 +326,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi URL https://ftp.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_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gdb.patch || true CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} --host=${toolchain_host} @@ -466,7 +466,7 @@ ExternalProject_add(gcc-base URL http://ftp.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-8.patch + PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-8.patch || true CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} /configure --build=${build_native} # compile a native compiler so keep host == build @@ -558,7 +558,7 @@ if(CMAKE_TOOLCHAIN_FILE) URL http://ftp.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-8.patch + PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-8.patch || true CONFIGURE_COMMAND ${compiler_flags} ${toolchain_tools} ${wrapper_command} /configure --build=${build_native} @@ -614,7 +614,7 @@ ExternalProject_add(gcc-final URL http://ftp.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-8.patch + PATCH_COMMAND patch -d -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-8.patch || true CONFIGURE_COMMAND ${compiler_flags} ${toolchain_tools} ${compiler_target_tools} ${wrapper_command} /configure --build=${build_native} From faec5152001e032b021b80d75716852874b9b0da Mon Sep 17 00:00:00 2001 From: Jaylon Gowie Date: Thu, 5 Jan 2023 23:22:37 -0600 Subject: [PATCH 7/7] Fix MacOS builds --- CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bfe048..7c940ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,22 +181,38 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi -DZLIB_INCLUDE_DIR=${toolchain_deps_dir}/include -DZLIB_LIBRARY=${toolchain_deps_dir}/lib/libz.a ) - - ExternalProject_add(libelf${suffix} - URL https://github.com/vitasdk/artifacts/releases/download/libelf-${LIBELF_VERSION}/libelf-${LIBELF_VERSION}.tar.gz - URL_HASH ${LIBELF_HASH} - DOWNLOAD_DIR ${DOWNLOAD_DIR} - PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libelf.patch || true - COMMAND ${CMAKE_COMMAND} -E copy /usr/share/misc/config.sub - COMMAND ${CMAKE_COMMAND} -E copy /usr/share/misc/config.guess - CONFIGURE_COMMAND autoreconf -i COMMAND CC=${cc_compiler} RANLIB=${ranlib} ${compiler_flags} ${wrapper_command} /configure - --build=${build_native} - --host=${toolchain_host} - --prefix=${toolchain_deps_dir} - --libdir=${toolchain_deps_dir}/lib - --disable-shared - --disable-nls - ) + + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + ExternalProject_add(libelf${suffix} + URL https://github.com/vitasdk/artifacts/releases/download/libelf-${LIBELF_VERSION}/libelf-${LIBELF_VERSION}.tar.gz + URL_HASH ${LIBELF_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libelf.patch || true + CONFIGURE_COMMAND autoreconf -i COMMAND CC=${cc_compiler} RANLIB=${ranlib} ${compiler_flags} ${wrapper_command} /configure + --build=${build_native} + --host=${toolchain_host} + --prefix=${toolchain_deps_dir} + --libdir=${toolchain_deps_dir}/lib + --disable-shared + --disable-nls + ) + else() + ExternalProject_add(libelf${suffix} + URL https://github.com/vitasdk/artifacts/releases/download/libelf-${LIBELF_VERSION}/libelf-${LIBELF_VERSION}.tar.gz + URL_HASH ${LIBELF_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PATCH_COMMAND patch -d -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libelf.patch || true + COMMAND ${CMAKE_COMMAND} -E copy /usr/share/misc/config.sub + COMMAND ${CMAKE_COMMAND} -E copy /usr/share/misc/config.guess + CONFIGURE_COMMAND autoreconf -i COMMAND CC=${cc_compiler} RANLIB=${ranlib} ${compiler_flags} ${wrapper_command} /configure + --build=${build_native} + --host=${toolchain_host} + --prefix=${toolchain_deps_dir} + --libdir=${toolchain_deps_dir}/lib + --disable-shared + --disable-nls + ) + endif() ExternalProject_add(libyaml${suffix} URL http://pyyaml.org/download/libyaml/yaml-${LIBYAML_VERSION}.tar.gz