Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opt-in Altivec (ppc7400) architecture #245

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/macports.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ lt lt.
T{
\fBRegular architectures include:\fR
T}:T{
ppc, i386, ppc64, x86_64, arm64
ppc, ppc7400, ppc64, i386, x86_64, arm64
T}
T{
\fBDefault (11 and later):\fR
Expand Down Expand Up @@ -376,7 +376,7 @@ lt lt.
T{
\fBRegular architectures include:\fR
T}:T{
ppc, i386, ppc64, x86_64, arm64
ppc, ppc7400, ppc64, i386, x86_64, arm64
T}
T{
\fBDefault (11 and later):\fR
Expand Down
4 changes: 2 additions & 2 deletions doc/macports.conf.5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ keeplogs::

build_arch::
The machine architecture to try to build for in normal use.
*Regular architectures include:*;; ppc, i386, ppc64, x86_64, arm64
*Regular architectures include:*;; ppc, ppc7400, ppc64, i386, x86_64, arm64
*Default (11 and later):*;; arm64 or x86_64 depending on hardware
*Default (10.6-10.15):*;; x86_64 or i386 depending on hardware
*Default (10.5 and earlier):*;; i386 or ppc depending on hardware
Expand All @@ -133,7 +133,7 @@ universal_archs::
The machine architectures to use for +universal variant (multiple
architecture entries should be space separated). Should contain at
least two entries, or be empty to disable universal building.
*Regular architectures include:*;; ppc, i386, ppc64, x86_64, arm64
*Regular architectures include:*;; ppc, ppc7400, ppc64, i386, x86_64, arm64
*Default (11 and later):*;; arm64 x86_64
*Default (10.6-10.13):*;; x86_64 i386
*Default (10.5 and earlier):*;; i386 ppc
Expand Down
5 changes: 3 additions & 2 deletions doc/portfile.7
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ Archs currently supported by macOS are:
.Em i386 ,
.Em ppc ,
.Em ppc64 ,
.Em ppc7400 ,
and
.Em x86_64 .
If this option is not set, it is assumed that the port can build for all
Expand All @@ -255,10 +256,10 @@ In this case, the port will be built in 32-bit mode.
.Em optional
.br
.Sy Values:
.Em i386 x86_64 ppc ppc64 noarch
.Em arm64 i386 x86_64 ppc ppc7400 ppc64 noarch
.br
.Sy Default:
.Em i386 x86_64 ppc ppc64
.Em arm64 i386 x86_64 ppc ppc64
.br
.Sy Examples:
.Dl supported_archs i386 x86_64
Expand Down
6 changes: 5 additions & 1 deletion src/macports1.0/macports.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,11 @@ match macports.conf.default."
}
} else {
if {$os_arch eq "powerpc"} {
set macports::build_arch ppc
if {[sysctl hw.vectorunit] == 1} {
set macports::build_arch ppc7400
} else {
set macports::build_arch ppc
}
} else {
set macports::build_arch i386
}
Expand Down
48 changes: 32 additions & 16 deletions src/port1.0/portconfigure.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ proc portconfigure::choose_supported_archs {archs} {
} elseif {[vercmp ${configure.sdk_version} 10.6] >= 0} {
set sdk_archs [list x86_64 i386 ppc]
} elseif {[vercmp ${configure.sdk_version} 10.5] >= 0} {
set sdk_archs [list x86_64 i386 ppc ppc64]
set sdk_archs [list x86_64 i386 ppc ppc7400 ppc64]
} else {
# 10.4u
set sdk_archs [list i386 ppc ppc64]
set sdk_archs [list i386 ppc ppc7400 ppc64]
}

# Set intersection_archs to the intersection of what's supported by
Expand Down Expand Up @@ -456,20 +456,25 @@ proc portconfigure::choose_supported_archs {archs} {
# e.g. if build_arch is x86_64 it's still possible to build a port
# that sets supported_archs to "i386 ppc" if the SDK allows it.
array set arch_demotions [list \
arm64 x86_64 \
x86_64 i386 \
ppc64 ppc \
i386 ppc]
arm64 {x86_64} \
x86_64 {i386} \
ppc64 {ppc7400 ppc} \
ppc7400 {ppc} \
i386 {ppc}]
foreach arch $archs {
if {$arch in $intersection_archs} {
set add_arch $arch
} elseif {[info exists arch_demotions($arch)] && $arch_demotions($arch) in $intersection_archs} {
set add_arch $arch_demotions($arch)
} else {
continue
}
if {$add_arch ni $ret} {
lappend ret $add_arch
if {$arch ni $ret} {
lappend ret $arch
}
} elseif {[info exists arch_demotions($arch)]} {
foreach demoted_arch $arch_demotions($arch) {
if {$demoted_arch in $intersection_archs} {
if {$demoted_arch ni $ret} {
lappend ret $demoted_arch
}
break
}
}
}
}
return $ret
Expand All @@ -487,7 +492,16 @@ proc portconfigure::configure_get_archflags {tool} {
if {[arch_flag_supported ${configure.compiler}] &&
$tool in {cc cxx objc objcxx}
} then {
set flags "-arch ${configure.build_arch}"
# ppc7400 is PPC + Altivec; it's up to the ports to declare support
# for the ppc7400 architecture and to enable/disable Altivec. At the
# compiler level, this is done with -maltivec/-mno-altivec, but
# projects often have separate compilation paths for Altivec, so
# leave these top-level flags alone.
if {${configure.build_arch} eq "ppc7400"} {
set flags "-arch ppc"
} else {
set flags "-arch ${configure.build_arch}"
}
} elseif {${configure.build_arch} in [list arm64 ppc64 x86_64]} {
set flags "-m64"
} elseif {${configure.compiler} ne "gcc-3.3"} {
Expand Down Expand Up @@ -1290,7 +1304,9 @@ proc portconfigure::get_compiler_fallback {} {
set compilers ""
lappend compilers {*}${system_compilers}
# when building for PowerPC architectures, prefer GCC to Clang
if {[option configure.build_arch] eq "ppc" || [option configure.build_arch] eq "ppc64"} {
if {[option configure.build_arch] eq "ppc" ||
[option configure.build_arch] eq "ppc7400" ||
[option configure.build_arch] eq "ppc64"} {
lappend compilers {*}${gcc_compilers}
lappend compilers {*}${clang_compilers}
} else {
Expand Down
1 change: 1 addition & 0 deletions src/port1.0/portlint.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ proc portlint::lint_main {args} {
arm64 arm
intel i386
ppc powerpc
ppc7400 powerpc
ppc64 powerpc
x86_64 i386
} {
Expand Down
4 changes: 2 additions & 2 deletions src/port1.0/portmain.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ default distname {${name}-${version}}
default worksrcdir {$distname}
default filespath {[file join $portpath [join $filesdir]]}
default worksrcpath {[file join $workpath [join $worksrcdir]]}
# empty list means all archs are supported
default supported_archs {}
# Exclude ppc7400, which is an opt-in architecture
default supported_archs {ppc ppc64 i386 x86_64 arm64}
default depends_skip_archcheck {}
default add_users {}

Expand Down