Skip to content

Commit

Permalink
libffi: Several Portfile fixes and improvements
Browse files Browse the repository at this point in the history
This makes a number of changes to the Portfile:

1) Removes the superfluous dependency on expect.  This was probably a
holdover from a time when dejagnu was missing the expect dependency.
Not only is this dependency superfluous (since the tests don't
reference expect directly), but it's also more heavy-handed since
dejagnu's expect dependency only applies when the OS-supplied expect
is too old.

2) Fixes the build to get the default architecture correctly.  This is
a general fix that replaces the narrow fix for the 10.6/ppc/Rosetta
case.  See the Portfile comments for details.

3) Removes the tweak to force the use of the integrated assembler when
building with clang.  This is now obsolete (since all builds work
without it), and causes some slightly inferior results in some tests.

4) Made the clearing of cxx_stdlib unconditional.  This was only
being done in the specific case where not doing so led to a circular
dependency, but since libffi doesn't use C++ at all, it's preferable
to do it in all cases and avoid unnecessary compiler constraints.
See the Portfile comments for more details.

5) Adds myself as the maintainer (previously nomaintainer).

Since #3 may affect the installed content in some cases, it includes a
revbump.  No revbumping of dependents is necessary.

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.
Builds on all tested platforms except 10.5 ppc +universal, with
test results equal to or better than the previous state.
  • Loading branch information
fhgwright authored and pmetzger committed Mar 1, 2024
1 parent e6290f0 commit adb624d
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions devel/libffi/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PortGroup muniversal 1.0
PortGroup github 1.0

github.setup libffi libffi 3.4.6 v
revision 0
revision 1

checksums rmd160 8e927f6bc340564414a87cc5b6dffc9ce53eefd8 \
sha256 b0dea9df23c863a7a50e825440f3ebffabd65df1497108e5d437747843895a4e \
Expand All @@ -14,7 +14,7 @@ checksums rmd160 8e927f6bc340564414a87cc5b6dffc9ce53eefd8 \
github.tarball_from releases
categories devel
license MIT
maintainers nomaintainer
maintainers {fwright.net:fw @fhgwright} openmaintainer

description A portable foreign function interface library
long_description The libffi library provides a portable, high level \
Expand All @@ -30,24 +30,40 @@ patchfiles patch-pre-snowleopard.diff
# Don't use macports gcc or clang toolchains to build this due to dependency cycles
compiler.blacklist-append macports-*

if {${os.platform} eq "darwin" && ${os.major} < 11} {
# Doesn't actually use C++, and having the stdlib set to libc++
# on 10.6 causes a macports-clang compiler to be chosen.
# Since libffi doesn't use C++, the cxx_stdlib setting is irrelevant, and
# having it differ from the OS default stdlib constrains the compiler selection,
# possibly even resulting in a circular dependency. Hence, we clear the
# cxx_stdlib setting.
#
# Although libffi itself doesn't use C++, it provides support for the C++ ABI,
# and hence includes some tests written in C++. The stdlib selection is not
# expected to impact libffi's own behavior, and if it did there would need to
# be appropriate conditional code to accommodate the difference.
#
# On the relevant OS versions (currently 10.6-10.8), this assumption can be
# tested by running the applicable port commands with
# "configure.cxx_stdlib=libc++".
#
platform darwin {
configure.cxx_stdlib
}

# Fix for Rosetta: https://trac.macports.org/ticket/64485
platform darwin {
if {${os.major} == 10 && ${build_arch} eq "ppc"} {
configure.args-append --build=powerpc-apple-darwin${os.major}
}
# The architecture-detection code in the configure script is based on the
# compiler's default architecture. We need to force this to match the
# target architecture to get the correct build. Merely providing the
# correct architecture options in xxFLAGS is insufficient.
#
# This is a more general fix than the former fix for 10.6/ppc/Rosetta
#
if { [variant_isset universal] } {
merger_arch_compiler yes
} else {
configure.cc "${configure.cc} ${configure.cc_archflags}"
}

# Older versions of cctools have a history of being problematic with complex
# asm like libffi has, so opt for the integrated assembler if it's available
if {[string match *clang* ${configure.compiler}]} {
configure.cflags-append -integrated-as
}
# There used to be a hack to force the use of the integrated assembler when
# building with clang. Not only is that no longer necessary, but it also
# causes slightly worse test results in at least one case.

array set merger_host {
ppc64 powerpc-apple-darwin
Expand All @@ -57,7 +73,7 @@ lappend merger_dont_diff \
${prefix}/include/ffi.h \
${prefix}/include/ffitarget.h

depends_test-append port:expect port:dejagnu
depends_test-append port:dejagnu
test.run yes
test.target check

Expand Down

0 comments on commit adb624d

Please sign in to comment.