From c82c599f3f066d67d8fb1f39e6398e3e9a4fd128 Mon Sep 17 00:00:00 2001 From: James Wrigley Date: Tue, 17 Dec 2024 11:16:10 +0100 Subject: [PATCH] [Libffi] Temporary revert to 3.2.2 to build for aarch64-freebsd (#10016) * [Libffi] Temporary revert to 3.2.2 to build for aarch64-freebsd * fixup! [Libffi] Temporary revert to 3.2.2 to build for aarch64-freebsd --- L/Libffi/build_tarballs.jl | 35 +++++++++++-------- .../patches/0001-libdir-no-touchy.patch | 31 ++++++++++++++++ .../bundled/patches/0002-aarch64-llvm18.patch | 22 ++++++++++++ 3 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 L/Libffi/bundled/patches/0001-libdir-no-touchy.patch create mode 100644 L/Libffi/bundled/patches/0002-aarch64-llvm18.patch diff --git a/L/Libffi/build_tarballs.jl b/L/Libffi/build_tarballs.jl index 61b5a671037..0d777afbc5f 100644 --- a/L/Libffi/build_tarballs.jl +++ b/L/Libffi/build_tarballs.jl @@ -1,32 +1,41 @@ using BinaryBuilder name = "Libffi" -upstream_version = "3.4.6" -version = VersionNumber(upstream_version) +version = v"3.2.1" + # Collection of sources required to build libffi sources = [ - ArchiveSource("https://github.com/libffi/libffi/releases/download/v$(upstream_version)/libffi-$(upstream_version).tar.gz", - "b0dea9df23c863a7a50e825440f3ebffabd65df1497108e5d437747843895a4e"), + ArchiveSource("https://sourceware.org/pub/libffi/libffi-$(version).tar.gz", + "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37"), + DirectorySource("./bundled"), ] +version = v"3.2.2" # <-- this is a lie, we need to bump the version to require julia v1.6 + # Bash recipe for building across all platforms script = raw""" cd $WORKSPACE/srcdir/libffi-*/ +atomic_patch -p1 ../patches/0001-libdir-no-touchy.patch + +# Required on aarch64-apple-darwin to build with newer versions of LLVM. See: +# - https://github.com/llvm/llvm-project/issues/72802 +# - Similar issue: https://github.com/libffi/libffi/issues/807 +# - In Julia: https://github.com/JuliaLang/julia/pull/54634 +if [[ ${target} == aarch64-apple-* ]]; then + atomic_patch -p1 ../patches/0002-aarch64-llvm18.patch +fi + update_configure_scripts -./configure --prefix=${prefix} \ - --build=${MACHTYPE} \ - --host=${target} \ - --disable-static \ - --enable-shared \ - --disable-multi-os-directory +autoreconf -f -i +./configure --prefix=${prefix} --build=${MACHTYPE} --host=${target} --disable-static --enable-shared make -j${nproc} make install """ # These are the platforms we will build for by default, unless further # platforms are passed in on the command line -platforms = supported_platforms() +platforms = supported_platforms(; experimental=true) # The products that we will ensure are always built products = [ @@ -38,6 +47,4 @@ dependencies = Dependency[ ] # Build the tarballs, and possibly a `build.jl` as well. -build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"6") - -# Build trigger: 2 +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6") diff --git a/L/Libffi/bundled/patches/0001-libdir-no-touchy.patch b/L/Libffi/bundled/patches/0001-libdir-no-touchy.patch new file mode 100644 index 00000000000..52f9be08580 --- /dev/null +++ b/L/Libffi/bundled/patches/0001-libdir-no-touchy.patch @@ -0,0 +1,31 @@ +--- libffi-3.2.1-orig/configure.ac 2021-11-18 00:13:42.753131022 -0500 ++++ libffi-3.2.1/configure.ac 2021-11-18 00:14:43.014058771 -0500 +@@ -590,26 +590,7 @@ + AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) + fi) + +-# These variables are only ever used when we cross-build to X86_WIN32. +-# And we only support this with GCC, so... +-if test "x$GCC" = "xyes"; then +- if test -n "$with_cross_host" && +- test x"$with_cross_host" != x"no"; then +- toolexecdir="${exec_prefix}"/'$(target_alias)' +- toolexeclibdir="${toolexecdir}"/lib +- else +- toolexecdir="${libdir}"/gcc-lib/'$(target_alias)' +- toolexeclibdir="${libdir}" +- fi +- multi_os_directory=`$CC $CFLAGS -print-multi-os-directory` +- case $multi_os_directory in +- .) ;; # Avoid trailing /. +- ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; +- esac +- AC_SUBST(toolexecdir) +-else +- toolexeclibdir="${libdir}" +-fi ++toolexeclibdir="${libdir}" + AC_SUBST(toolexeclibdir) + + AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) + diff --git a/L/Libffi/bundled/patches/0002-aarch64-llvm18.patch b/L/Libffi/bundled/patches/0002-aarch64-llvm18.patch new file mode 100644 index 00000000000..49f380df991 --- /dev/null +++ b/L/Libffi/bundled/patches/0002-aarch64-llvm18.patch @@ -0,0 +1,22 @@ +--- libffi-clean/src/aarch64/sysv.S 2014-11-08 13:47:24.000000000 +0100 ++++ libffi-3.2.1/src/aarch64/sysv.S 2024-12-14 13:17:42.329889690 +0100 +@@ -100,8 +100,8 @@ + + #define ffi_call_SYSV_FS (8 * 4) + +- .cfi_startproc + CNAME(ffi_call_SYSV): ++ .cfi_startproc + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) +@@ -247,8 +247,8 @@ + #ifdef __APPLE__ + .align 2 + #endif +- .cfi_startproc + CNAME(ffi_closure_SYSV): ++ .cfi_startproc + stp x29, x30, [sp, #-16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0)