Skip to content

Commit 921bbb2

Browse files
committed
build: add DOWNLOAD_EXTRACT_TIMESTAMP to toolchain dependencies and patches for macOS compatibility
1 parent 4ce7cd6 commit 921bbb2

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
127127
URL https://www.zlib.net/zlib-${ZLIB_VERSION}.tar.gz
128128
URL_HASH ${ZLIB_HASH}
129129
DOWNLOAD_DIR ${DOWNLOAD_DIR}
130+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
130131
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${toolchain_deps_dir}
131132
${toolchain_cmake_args}
132133
-DBUILD_SHARED_LIBS=OFF
@@ -190,6 +191,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
190191
URL https://github.com/vitasdk/artifacts/releases/download/libelf-${LIBELF_VERSION}/libelf-${LIBELF_VERSION}.tar.gz
191192
URL_HASH ${LIBELF_HASH}
192193
DOWNLOAD_DIR ${DOWNLOAD_DIR}
194+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
193195
PATCH_COMMAND patch -d <SOURCE_DIR> -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/libelf.patch
194196
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/config.guess ${PROJECT_SOURCE_DIR}/config.sub <SOURCE_DIR>/
195197
CONFIGURE_COMMAND autoreconf -i <SOURCE_DIR> COMMAND CC=${cc_compiler} RANLIB=${ranlib} ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
@@ -205,6 +207,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
205207
URL http://pyyaml.org/download/libyaml/yaml-${LIBYAML_VERSION}.tar.gz
206208
URL_HASH ${LIBYAML_HASH}
207209
DOWNLOAD_DIR ${DOWNLOAD_DIR}
210+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
208211
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/config.guess ${PROJECT_SOURCE_DIR}/config.sub <SOURCE_DIR>/config/
209212
CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
210213
--build=${build_native}
@@ -220,6 +223,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
220223
URL http://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2
221224
URL_HASH ${GMP_HASH}
222225
DOWNLOAD_DIR ${DOWNLOAD_DIR}
226+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
223227
CONFIGURE_COMMAND CFLAGS=-std=gnu99 CPPFLAGS=-fexceptions ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
224228
--build=${build_native}
225229
--host=${toolchain_host}
@@ -235,6 +239,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
235239
URL http://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2
236240
URL_HASH ${MPFR_HASH}
237241
DOWNLOAD_DIR ${DOWNLOAD_DIR}
242+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
238243
CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
239244
--build=${build_native}
240245
--host=${toolchain_host}
@@ -249,6 +254,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
249254
URL https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz
250255
URL_HASH ${MPC_HASH}
251256
DOWNLOAD_DIR ${DOWNLOAD_DIR}
257+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
252258
CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
253259
--build=${build_native}
254260
--host=${toolchain_host}
@@ -279,6 +285,7 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
279285
URL https://github.com/libexpat/libexpat/releases/download/R_2_3_0/expat-${EXPAT_VERSION}.tar.bz2
280286
URL_HASH ${EXPAT_HASH}
281287
DOWNLOAD_DIR ${DOWNLOAD_DIR}
288+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
282289
CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
283290
--build=${build_native}
284291
--host=${toolchain_host}
@@ -307,10 +314,12 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
307314
URL https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz
308315
URL_HASH ${BINUTILS_HASH}
309316
DOWNLOAD_DIR ${DOWNLOAD_DIR}
317+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
310318
PATCH_COMMAND
311319
patch -d <SOURCE_DIR> -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0001-vita.patch
312320
&& patch -d <SOURCE_DIR> -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0002-fix-broken-reloc.patch
313321
&& patch -d <SOURCE_DIR> -p3 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0003-fix-elf-vaddr.patch
322+
&& patch -d <SOURCE_DIR> -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/binutils/0004-fix-zlib-macOS.patch
314323
&& ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/config.guess ${PROJECT_SOURCE_DIR}/config.sub <SOURCE_DIR>/
315324
CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
316325
--build=${build_native}
@@ -335,7 +344,9 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
335344
URL https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz
336345
URL_HASH ${GDB_HASH}
337346
DOWNLOAD_DIR ${DOWNLOAD_DIR}
347+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
338348
PATCH_COMMAND patch -d <SOURCE_DIR> -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gdb.patch
349+
COMMAND patch -d <SOURCE_DIR> -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gdb-zlib.patch
339350
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/config.guess ${PROJECT_SOURCE_DIR}/config.sub <SOURCE_DIR>/
340351
CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
341352
--build=${build_native}
@@ -482,6 +493,7 @@ ExternalProject_add(gcc-base
482493
URL http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz
483494
URL_HASH ${GCC_HASH}
484495
DOWNLOAD_DIR ${DOWNLOAD_DIR}
496+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
485497
PATCH_COMMAND patch -d <SOURCE_DIR> -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-15.patch
486498
CONFIGURE_COMMAND ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
487499
--build=${build_native}
@@ -580,6 +592,7 @@ if(CMAKE_TOOLCHAIN_FILE)
580592
URL http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz
581593
URL_HASH ${GCC_HASH}
582594
DOWNLOAD_DIR ${DOWNLOAD_DIR}
595+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
583596
PATCH_COMMAND patch -d <SOURCE_DIR> -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-15.patch
584597
CONFIGURE_COMMAND ${compiler_flags} ${toolchain_tools}
585598
${wrapper_command} <SOURCE_DIR>/configure
@@ -636,6 +649,7 @@ ExternalProject_add(gcc-final
636649
URL http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz
637650
URL_HASH ${GCC_HASH}
638651
DOWNLOAD_DIR ${DOWNLOAD_DIR}
652+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
639653
PATCH_COMMAND patch -d <SOURCE_DIR> -p1 -t -N < ${PROJECT_SOURCE_DIR}/patches/gcc/0001-gcc-15.patch
640654
CONFIGURE_COMMAND ${compiler_flags} ${toolchain_tools} ${compiler_target_tools}
641655
${wrapper_command} <SOURCE_DIR>/configure
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/zlib/zutil.h
2+
+++ b/zlib/zutil.h
3+
@@ -143,7 +143,7 @@
4+
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
5+
# include <unix.h> /* for fdopen */
6+
# else
7+
-# ifndef fdopen
8+
+# if !defined(__APPLE__) && !defined(fdopen)
9+
# define fdopen(fd,mode) NULL /* No fdopen() */
10+
# endif
11+
# endif

patches/gdb-zlib.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/zlib/zutil.h
2+
+++ b/zlib/zutil.h
3+
@@ -143,7 +143,7 @@
4+
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
5+
# include <unix.h> /* for fdopen */
6+
# else
7+
-# ifndef fdopen
8+
+# if !defined(__APPLE__) && !defined(fdopen)
9+
# define fdopen(fd,mode) NULL /* No fdopen() */
10+
# endif
11+
# endif

0 commit comments

Comments
 (0)