Skip to content

Commit

Permalink
Try fixing port index on riscv
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Aug 17, 2024
1 parent a348533 commit 935e8c3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
5 changes: 3 additions & 2 deletions _resources/port1.0/compilers/gcc_compilers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ if {${os.major} >= 10 || [option os.platform] ne "darwin"} {
lappend compilers macports-gcc-14 macports-gcc-13 macports-gcc-12 macports-gcc-11 macports-gcc-10
}

global os.platform os.major
# GCC 9 and older only on OSX10.10 and older
# https://trac.macports.org/ticket/65472
if {${os.major} < 15} {
if {${os.platform} eq "darwin" && ${os.major} < 15} {
if {${os.major} >= 10} {
lappend compilers macports-gcc-9 macports-gcc-8
}
lappend compilers macports-gcc-7 macports-gcc-6 macports-gcc-5
}

if {${os.major} >= 10} {
if {${os.platform} ne "darwin" || ${os.major} >= 10} {
lappend compilers macports-gcc-devel
}
1 change: 1 addition & 0 deletions _resources/port1.0/compilers/gcc_dependencies.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# GCC version providing the primary runtime
# Note settings here *must* match those in the lang/libgcc port and compilers PG
global os.platform os.major
if {[option os.platform] eq "darwin" && [option os.major] < 10} {
set gcc_main_version 7
} else {
Expand Down
7 changes: 4 additions & 3 deletions _resources/port1.0/group/compilers-1.0.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ if {${os.major} < 10 && ${os.platform} eq "darwin" } {

set compilers.list {cc cxx cpp objc fc f77 f90}

global os.arch os.platform
# build database of gcc compiler attributes
# Should match those in compilers/gcc_compilers.tcl
if { ${os.arch} eq "arm" || ${os.platform} ne "darwin" } {
Expand Down Expand Up @@ -150,7 +151,7 @@ foreach ver ${gcc_versions} {
set cdb(gcc$ver_nodot,f90) ${prefix}/bin/gfortran-mp-$ver
# The devel port, and starting with version 10, GCC will support using -stdlib=libc++,
# so use it for improved compatibility with clang builds
if { ${build_arch} ni [list ppc ppc64] } {
if { ${build_arch} ni [list ppc ppc64 riscv64] } {
if { $ver eq "devel" || [vercmp ${ver} >= 10]} {
set cdb(gcc$ver_nodot,cxx_stdlib) libc++
} else {
Expand All @@ -165,7 +166,7 @@ foreach ver ${gcc_versions} {
# Should match those in compilers/clang_compilers.tcl
# Also do not forget to add support of new llvm into cctools
set clang_versions [list]
if { ${os.arch} ne "arm" && ${os.platform} eq "darwin" } {
if { (${os.arch} ni [list arm ppc ppc64]) && ${os.platform} eq "darwin" } {
if {${os.major} < 16} {
if {${os.major} < 9} {
lappend clang_versions 3.3
Expand All @@ -185,7 +186,7 @@ if { ${os.arch} ne "arm" && ${os.platform} eq "darwin" } {
lappend clang_versions 9.0 10
}
}
if { ${os.major} >= 9 || ${os.platform} ne "darwin" } {
if { ${os.platform} ne "darwin" || ${os.major} >= 11 } {
lappend clang_versions 11
if { ${os.major} >= 11 || ${os.platform} ne "darwin"} {
lappend clang_versions 12 13 14 15 16 17 18
Expand Down
19 changes: 11 additions & 8 deletions _resources/port1.0/group/muniversal-1.1.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ default muniversal.arch_build_compiler {${muniversal.arch_compiler}}
##########################################################################################
foreach phase {configure build test destroot} {
foreach command {pre_args args post_args env} {
foreach arch {arm64 x86_64 i386 ppc ppc64} {
foreach arch {arm64 x86_64 i386 ppc ppc64 riscv64} {
options ${phase}.${command}.${arch}
if {"${phase}.${command}" eq "configure.pre_args"} {
default ${phase}.${command}.${arch} "\[muniversal::get_triplets ${arch}\]"
Expand All @@ -95,20 +95,20 @@ foreach phase {configure build test destroot} {
}
unset phase command arch

foreach arch {arm64 x86_64 i386 ppc ppc64} {
foreach arch {arm64 x86_64 i386 ppc ppc64 riscv64} {
options patchfiles.${arch}
}
unset arch

foreach arch {arm64 x86_64 i386 ppc ppc64} {
foreach arch {arm64 x86_64 i386 ppc ppc64 riscv64} {
foreach flags {cppflags cflags cxxflags objcflags objcxxflags ldflags fflags f90flags fcflags} {
options configure.${flags}.${arch}
default configure.${flags}.${arch} {}
}
}
unset flags arch

foreach arch {arm64 x86_64 i386 ppc ppc64} {
foreach arch {arm64 x86_64 i386 ppc ppc64 riscv64} {
foreach tool {cc objc cxx objcxx fc f90 f77 ld} {
options configure.${tool}_archflags.${arch}
default configure.${tool}_archflags.${arch} "\[muniversal::get_archflag ${tool} ${arch}\]"
Expand All @@ -119,7 +119,7 @@ unset tool arch
##########################################################################################
# determine which architectures are different and which ones can be run via Rosetta
##########################################################################################
foreach arch {arm64 x86_64 i386 ppc ppc64} {
foreach arch {arm64 x86_64 i386 ppc ppc64 riscv64} {
options muniversal.can_run.${arch}
options muniversal.is_cross.${arch}
}
Expand All @@ -130,12 +130,14 @@ default muniversal.can_run.x86_64 {[expr { (${os.arch} eq "i386" && ${os.cpu64
default muniversal.can_run.i386 {[expr { ${os.arch} eq "i386" && ${os.major} < 19 }]}
default muniversal.can_run.ppc {[expr { ${os.arch} eq "powerpc" || (${os.arch} eq "i386" && ${os.major} < 11) }]}
default muniversal.can_run.ppc64 {[expr { ${os.arch} eq "powerpc" && ${os.cpu64bit_capable} }]}
default muniversal.can_run.riscv64 {[expr { ${os.arch} eq "riscv64"}]}

default muniversal.is_cross.arm64 {[expr { ${os.arch} ne "arm" }]}
default muniversal.is_cross.x86_64 {[expr { ${os.arch} ne "i386" || !${os.cpu64bit_capable} }]}
default muniversal.is_cross.i386 {[expr { ${os.arch} ne "i386" || ${os.major} >= 19 }]}
default muniversal.is_cross.ppc {[expr { ${os.arch} ne "powerpc" }]}
default muniversal.is_cross.ppc64 {[expr { ${os.arch} ne "powerpc" || !${os.cpu64bit_capable} }]}
default muniversal.is_cross.riscv64 {[expr { ${os.arch} ne "riscv64" }]}

##########################################################################################
# triplet information
Expand All @@ -161,7 +163,7 @@ default triplet.add_host {cross}
options triplet.add_build
default triplet.add_build {none}

foreach arch {arm64 x86_64 i386 ppc ppc64} {
foreach arch {arm64 x86_64 i386 ppc ppc64 riscv64} {
options triplet.cpu.${arch}
}
unset arch
Expand All @@ -171,8 +173,9 @@ default triplet.cpu.x86_64 {x86_64}
default triplet.cpu.i386 {i686}
default triplet.cpu.ppc {powerpc}
default triplet.cpu.ppc64 {powerpc64}
default triplet.cpu.riscv64 {riscv64}

foreach arch {arm64 x86_64 i386 ppc ppc64} {
foreach arch {arm64 x86_64 i386 ppc ppc64 riscv64} {
options triplet.${arch}
default triplet.${arch} "\${triplet.cpu.${arch}}-\${triplet.vendor}-\${triplet.os}"
}
Expand Down Expand Up @@ -316,7 +319,7 @@ proc muniversal::get_archflag {tool arch} {

if { [portconfigure::arch_flag_supported ${configure.compiler}] && ${tool} in {cc cxx objc objcxx ld} } {
return "-arch ${arch}"
} elseif { ${arch} in {arm64 ppc64 x86_64} } {
} elseif { ${arch} in {arm64 ppc64 riscv64 x86_64} } {
return "-m64"
} elseif {${configure.compiler} ne "gcc-3.3"} {
return "-m32"
Expand Down
7 changes: 2 additions & 5 deletions lang/libgcc/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ variant universal { }
# Pick the gcc version that provides the primary runtime.
# NOTE : The logic here must match that in the gccX ports *and*
# that in _resources/port1.0/group/compilers-1.0.tcl
if { ${os.major} < 10 } {
set gcc_version 7
} else {
set gcc_version 14
}
set gcc_version 14

depends_lib port:libgcc${gcc_version}

build { }
Expand Down

0 comments on commit 935e8c3

Please sign in to comment.