Skip to content

Commit 99dfa1f

Browse files
committed
darwin-xtools: rework, wip
1 parent 38be4a0 commit 99dfa1f

10 files changed

+935
-89
lines changed

devel/darwin-xtools/Portfile

Lines changed: 104 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -3,76 +3,116 @@
33
PortSystem 1.0
44
PortGroup cmake 1.1
55
PortGroup github 1.0
6-
PortGroup muniversal 1.0
76

8-
if {${os.arch} eq "powerpc"} {
7+
name darwin-xtools
8+
epoch 2
9+
10+
categories devel
11+
maintainers {@barracuda156 macos-powerpc.org:barracuda}
12+
13+
variant v2 conflicts v3 description "Darwin Xtools branch 2.x" {}
14+
variant v3 conflicts v2 description "Darwin Xtools branch 3.x" {}
15+
16+
if {[variant_isset v2]} {
917
set xtools_version 6f6c04e8b25497851f6a5979a6e96023fffe22df
1018
github.setup iains darwin-xtools ${xtools_version}
1119
version 2.2.4
1220
revision 1
13-
epoch 1
1421

1522
checksums ${name}-${xtools_version}.tar.gz \
1623
rmd160 07dd50453b93f90ea4806fd8c12be3acb91c2fbd \
1724
sha256 7568104068614b8e8b1cb72fcc01219f78f90a0d14d95c255be78e2c0a899d62 \
1825
size 2932788
19-
} else {
26+
} elseif {[variant_isset v3]} {
2027
set xtools_version 6446947f3e99db52a40b30a38f36b9ae33492aea
2128
github.setup iains darwin-xtools ${xtools_version}
2229
version 3.3.0
2330
revision 1
24-
epoch 0
2531

2632
checksums ${name}-${xtools_version}.tar.gz \
2733
rmd160 18d99473a012f4fa48464aadd078921a25bdc322 \
2834
sha256 9167b67e128f616cef079bbeda4b116fe0d41fe54784fff85826420daae23f5f \
2935
size 2958759
30-
}
36+
} else {
37+
set xtools_version 80ad30c3bce821f52d94e844cbb1c2d095a127c6
38+
github.setup iains darwin-xtools ${xtools_version}
39+
version 1.1.0
40+
revision 0
3141

32-
set libyaml_version 0.2.5
33-
set libyaml_distfile ${libyaml_version}.tar.gz
34-
distfiles-append ${libyaml_distfile}:libyaml
35-
checksums-append ${libyaml_distfile} \
36-
rmd160 7fe42b7d7bb0dd07aedee6c775c43fd35bb5cf3e \
37-
sha256 fa240dbf262be053f3898006d502d514936c818e422afdcf33921c63bed9bf2e \
38-
size 85055
42+
checksums ${name}-${xtools_version}.tar.gz \
43+
rmd160 0b0c7155c63a5f962c32848cd649d98b7eef1298 \
44+
sha256 83971978f413ee309589307ed994fd7a7f2d55e818e6435b2663e8167da260d7 \
45+
size 2887509
46+
}
3947

4048
github.tarball_from archive
4149

42-
platforms darwin
43-
categories devel
44-
maintainers nomaintainer
45-
46-
description Aset of modifications to ctools and ld64 that enable support for older systems with up-to-date-tools.
50+
description Aset of modifications to ctools and ld64 that enable support \
51+
for older systems with up-to-date-tools.
4752
long_description {*}${description}
4853
license {APSL-2 Apache-2}
4954

5055
homepage https://github.com/iains/darwin-xtools
5156

52-
master_sites-append https://github.com/yaml/libyaml/archive/refs/tags:libyaml
53-
54-
patchfiles-append 0001-ld64-unwinddump-include-stdlib-for-exit-3.patch \
57+
if {[variant_isset v2] || [variant_isset v3]} {
58+
patchfiles-append 0001-ld64-unwinddump-include-stdlib-for-exit-3.patch \
5559
0002-ld64-archive_file-fix-compilation-without-LTO_SUPPOR.patch \
5660
0003-cctools-cmake-as-fix-compilation-on-powerpc-apple-da.patch \
5761
0004-cctools-otool-fix-duplicate-symbol-in-arm-i386-_disa.patch \
5862
0005-cctools-cmake-cbtlibs-link-against-libstuff-for-vari.patch \
59-
0006-ld64-cmake-build-libprunetrie-as-static-archive.patch \
60-
0007-tapilite-add-TAPI-emulation-library.patch \
63+
0006-ld64-cmake-build-libprunetrie-as-static-archive.patch
64+
65+
# Tapi is not supported in branch 1.x.
66+
variant tapi conflicts tapilite description "Use standalone Tapi library" {
67+
depends_lib-append port:libtapi
68+
69+
configure.args-append \
70+
-DXTOOLS_TAPI_PATH=${prefix}
71+
}
72+
73+
variant tapilite conflicts tapi description "Build replacement library for Tapi support" {
74+
set libyaml_version 0.2.5
75+
set libyaml_distfile ${libyaml_version}.tar.gz
76+
distfiles-append ${libyaml_distfile}:libyaml
77+
master_sites-append https://github.com/yaml/libyaml/archive/refs/tags:libyaml
78+
checksums-append ${libyaml_distfile} \
79+
rmd160 7fe42b7d7bb0dd07aedee6c775c43fd35bb5cf3e \
80+
sha256 fa240dbf262be053f3898006d502d514936c818e422afdcf33921c63bed9bf2e \
81+
size 85055
82+
83+
post-extract {
84+
ln -s ${workpath}/libyaml-${libyaml_version} ${worksrcpath}/libyaml
85+
}
86+
87+
patchfiles-append 0007-tapilite-add-TAPI-emulation-library.patch \
6188
0008-ld64-cmake-use-normal-cmake-trickery-to-link-against.patch \
6289
0009-tapilite-bunch-of-fixes-and-changes.patch \
6390
0010-tapilite-cmake-explitly-build-static-library.patch \
64-
0011-ld64-fix-compilation-on-arm64.patch \
65-
0012-cctools-fix-build-on-macOS-monterey.patch \
66-
0013-libyaml-add-the-way-to-include-it.patch \
67-
0014-cctools-removed-redundant-implementation-of-get_toc_.patch \
68-
0015-tapilite-fix-build-by-clang.patch
69-
70-
platform darwin powerpc {
71-
patchfiles-append 0016-Minor-fix-ups-for-ppc.patch
91+
0011-libyaml-add-the-way-to-include-it.patch \
92+
0012-tapilite-fix-build-by-clang.patch
93+
94+
configure.args-append \
95+
-DXTOOLS_LIBYAML_PATH=${worksrcpath}/libyaml \
96+
-DXTOOLS_USE_TAPILITE=ON
97+
}
98+
99+
if {${os.arch} ne "powerpc"} {
100+
patchfiles-append 0013-ld64-fix-compilation-on-arm64.patch \
101+
0014-cctools-fix-build-on-macOS-monterey.patch \
102+
0015-cctools-removed-redundant-implementation-of-get_toc_.patch
103+
}
72104
}
73105

74-
post-extract {
75-
ln -s ${workpath}/libyaml-${libyaml_version} ${worksrcpath}/libyaml
106+
if {${os.arch} eq "powerpc"} {
107+
variant lto description "Enable LLVM LTO" {
108+
set llvm_v 7.1.1
109+
110+
depends_lib-append port:llvm-powerpc
111+
112+
configure.args-append \
113+
-DXTOOLS_LTO_PATH=${prefix}/libexec/llvm-${llvm_v} \
114+
-DXTOOLS_LTO_SUPPORT=ON
115+
}
76116
}
77117

78118
# Use cmake-bootstrap
@@ -81,80 +121,58 @@ depends_skip_archcheck-append \
81121
cmake-bootstrap
82122
configure.cmd ${prefix}/libexec/cmake-bootstrap/bin/cmake
83123

84-
# prevent findng or linking against any other ports
124+
# Prevent finding or linking against any other ports
85125
compiler.cpath
86126
compiler.library_path
87-
configure.cppflags-delete -I${prefix}/include
88-
configure.ldflags-delete -L${prefix}/lib
127+
configure.cppflags-delete -I${prefix}/include
128+
configure.ldflags-delete -L${prefix}/lib
89129

90130
compiler.cxx_standard 2011
91131

92-
merger_arch_flag yes
93-
merger_arch_compiler yes
94-
merger_must_run_binaries yes
95-
96-
if {${os.platform} eq "darwin" && ${os.major} < 12} {
97-
depends_build-append port:gcc10-bootstrap
98-
depends_skip_archcheck-append \
99-
gcc10-bootstrap
100-
101-
# Leopard is the first macOS which supports Roseta
102-
# See: https://trac.macports.org/ticket/67284
103-
if {${os.major} > 8} {
104-
pre-configure {
105-
file mkdir ${workpath}/bins
106-
107-
set gcc [open "${workpath}/bins/gcc" w 0755]
108-
puts ${gcc} "#!/bin/sh"
109-
puts ${gcc} "arch -arch $\{BUILD_ARCH:-${build_arch}\} ${prefix}/libexec/gcc10-bootstrap/bin/gcc \"\$@\""
110-
close ${gcc}
111-
112-
set gxx [open "${workpath}/bins/g++" w 0755]
113-
puts ${gxx} "#!/bin/sh"
114-
puts ${gxx} "arch -arch $\{BUILD_ARCH:-${build_arch}\} ${prefix}/libexec/gcc10-bootstrap/bin/g++ \"\$@\""
115-
close ${gxx}
116-
}
117-
118-
configure.cc ${workpath}/bins/gcc
119-
configure.cxx ${workpath}/bins/g++
120-
121-
if {[variant_exists universal] && [variant_isset universal]} {
122-
foreach arch ${universal_archs_supported} {
123-
lappend merger_configure_env(${arch}) BUILD_ARCH=${arch}
124-
lappend merger_build_env(${arch}) BUILD_ARCH=${arch}
125-
}
126-
}
127-
} else {
128-
configure.cc ${prefix}/libexec/gcc10-bootstrap/bin/gcc
129-
configure.cxx ${prefix}/libexec/gcc10-bootstrap/bin/g++
130-
}
131-
132-
# prevent it from linking against gcc's libstdc++.6.dylib and libgcc_s.1.1.dylib
132+
if {${configure.cxx_stdlib} ne "libc++"} {
133+
# Prevent it from linking against gcc's libstdc++.6.dylib and libgcc_s.1.1.dylib
133134
configure.ldflags-append \
134135
-static-libstdc++ -static-libgcc
135-
136-
configure.compiler.add_deps no
136+
configure.args-append -DXTOOLS_CXX_HAS_STDLIB_FLAG=OFF
137137
}
138138

139139
cmake.install_prefix ${prefix}/libexec/${name}
140140

141-
cmake.build_type Release
142141
cmake.generator {Unix Makefiles}
143142

143+
proc xtools_arch {arch} {
144+
switch ${arch} {
145+
arm64 {return aarch64}
146+
ppc64 {return powerpc64}
147+
ppc {return powerpc}
148+
default {return ${arch}}
149+
}
150+
}
151+
152+
platform darwin {
153+
set xtools_triple [xtools_arch ${build_arch}]-apple-darwin${os.major}
154+
configure.pre_args-append \
155+
-DLLVM_DEFAULT_TARGET_TRIPLE=${xtools_triple}
156+
}
157+
158+
configure.pre_args-replace -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
159+
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF
160+
144161
configure.args-append -DCCTOOLS_LD_CLASSIC=OFF \
145-
-DXTOOLS_LIBYAML_PATH=${worksrcpath}/libyaml \
146-
-DXTOOLS_USE_TAPILITE=ON
162+
-DPACKAGE_VERSION="macos-powerpc"
147163

148164
# 64bit LD requires futures patches
149-
if {${build_arch} ni [list i386 ppc]} {
165+
if {${configure.build_arch} ni [list i386 ppc]} {
150166
configure.args-append -DXTOOLS_HOST_IS_64B=ON
151167
} else {
152168
configure.args-append -DXTOOLS_HOST_IS_64B=OFF
153169
}
154170

155171
post-destroot {
156-
file delete -force {*}[glob -directory ${destroot}${cmake.install_prefix} \
157-
cmake/yaml* include/yaml.h lib/libyaml*]
172+
if {[variant_isset v2] || [variant_isset v3]} {
173+
file delete -force {*}[glob -directory ${destroot}${cmake.install_prefix} \
174+
cmake/yaml* include/yaml.h lib/libyaml*]
175+
}
158176
}
159177

160-
github.livecheck.branch darwin-xtools-[string map {. -} ${version}]
178+
github.livecheck.branch darwin-xtools-[string map {. -} ${version}]

0 commit comments

Comments
 (0)