Skip to content

Commit

Permalink
libffi: Fix build on 10.4, 10.5
Browse files Browse the repository at this point in the history
This makes three changes to the patches for 10.4 and 10.5:

1) In the G3 patch, it removes the ppc7400 reference that was never
actually used, rather than updating it.  It still fixes the case that
is actually used.

2) It removes the patch for i386 assembler that has been
(approximately) incorporated upstream since v3.4.5.  The collision
with this patch was the reason for the patch failure.

3) For the gcc 4.2 test-build fix, it replaces the conditionally
applied patchfile with an unconditional patch controlled by an
environment variable, thereby keeping the source code consistent
across OS versions.  This new environment variable is now defined by
the Portfile when the compiler is gcc 4.2.

The patches for #1 and macports#3 are now in a single unified patchfile.

Closes: https://trac.macports.org/ticket/69380

TESTED:
Tested on 10.4-10.5 ppc, 10.5-10.6 ppc (x86_64 Rosetta), 10.4-10.6
i386, 10.4-12.x x86_64, and 11.x-14.x arm64.
Now builds and passes at least some tests on all tested platforms,
except 10.4 ppc +universal.
Test behavior on 10.6+ is essentially unchanged.  Tests on 10.4 and
10.5 have a few additional failures since v3.4.4 (the last version
that built successfully) due to new tests having been added.
  • Loading branch information
fhgwright authored and pmetzger committed Mar 1, 2024
1 parent a6d57f3 commit e6290f0
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 97 deletions.
13 changes: 6 additions & 7 deletions devel/libffi/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ long_description The libffi library provides a portable, high level \

homepage https://www.sourceware.org/libffi/

patchfiles powerpc-g3.patch

if {${os.platform} eq "darwin" && ${os.major} < 10 && ![string match *clang* ${configure.compiler}]} {
# https://trac.macports.org/ticket/61170
patchfiles-append patch-libffi-intel-leopard-sysv.diff \
patch-libffi-tests-gcc42.diff
}
patchfiles patch-pre-snowleopard.diff

# Don't use macports gcc or clang toolchains to build this due to dependency cycles
compiler.blacklist-append macports-*
Expand Down Expand Up @@ -67,4 +61,9 @@ depends_test-append port:expect port:dejagnu
test.run yes
test.target check

# Some warnings need to be disabled when building tests with gcc-4.2
if {[string match *gcc-4.2 ${configure.compiler}]} {
test.env-append LIBFFI_TEST_OLDGCC=1
}

github.livecheck.regex {(\d+(?:\.\d+)+)}
39 changes: 0 additions & 39 deletions devel/libffi/files/patch-libffi-intel-leopard-sysv.diff

This file was deleted.

27 changes: 0 additions & 27 deletions devel/libffi/files/patch-libffi-tests-gcc42.diff

This file was deleted.

50 changes: 50 additions & 0 deletions devel/libffi/files/patch-pre-snowleopard.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--- src/powerpc/darwin.S.orig 2023-03-15 07:19:45.000000000 -0700
+++ src/powerpc/darwin.S 2024-02-26 18:37:38.000000000 -0800
@@ -31,8 +31,6 @@
#define MODE_CHOICE(x, y) x
#endif

-#define machine_choice MODE_CHOICE(ppc7400,ppc64)
-
; Define some pseudo-opcodes for size-independent load & store of GPRs ...
#define lgu MODE_CHOICE(lwzu, ldu)
#define lg MODE_CHOICE(lwz,ld)
--- src/powerpc/darwin_closure.S.orig 2023-03-15 07:19:45.000000000 -0700
+++ src/powerpc/darwin_closure.S 2024-02-26 18:37:38.000000000 -0800
@@ -34,7 +34,7 @@
#define MODE_CHOICE(x, y) x
#endif

-#define machine_choice MODE_CHOICE(ppc7400,ppc64)
+#define machine_choice MODE_CHOICE(ppc,ppc64)

; Define some pseudo-opcodes for size-independent load & store of GPRs ...
#define lgu MODE_CHOICE(lwzu, ldu)
--- testsuite/lib/libffi.exp.orig 2023-03-15 07:19:45.000000000 -0700
+++ testsuite/lib/libffi.exp 2024-02-26 18:37:38.000000000 -0800
@@ -516,7 +516,10 @@ proc run-many-tests { testcases extra_fl
}
}
"gnu" {
- set common "-W -Wall -Wno-psabi"
+ set common "-W -Wall"
+ if ![info exists env(LIBFFI_TEST_OLDGCC)] {
+ set common "$common -Wno-psabi"
+ }
if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {
--- testsuite/libffi.bhaible/bhaible.exp.orig 2023-03-15 07:19:45.000000000 -0700
+++ testsuite/libffi.bhaible/bhaible.exp 2024-02-26 18:37:38.000000000 -0800
@@ -24,7 +24,10 @@ global compiler_vendor
# was done in a pretty lazy fashion, and requires the use of compiler
# flags to disable warnings for now.
if { [string match $compiler_vendor "gnu"] } {
- set warning_options "-Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized";
+ set warning_options "-Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized";
+ if ![info exists env(LIBFFI_TEST_OLDGCC)] {
+ set common "$warning_options -Wno-unused-but-set-variable"
+ }
}
if { [string match $compiler_vendor "microsoft"] } {
# -wd4996 suggest use of vsprintf_s instead of vsprintf
24 changes: 0 additions & 24 deletions devel/libffi/files/powerpc-g3.patch

This file was deleted.

0 comments on commit e6290f0

Please sign in to comment.