source: trunk/dports/devel/cctools/Portfile @ 132915

Last change on this file since 132915 was 132915, checked in by jeremyhu@…, 5 years ago

cctools: Remove hack for Tiger since current cctools now builds on Tiger (see #46629)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1# $Id: Portfile 132915 2015-02-13 08:51:03Z jeremyhu@macports.org $
2
3PortSystem              1.0
4
5name                    cctools
6# OS X 10.10.0
7version                 862
8set ld64_version        236.3
9revision                1
10categories              devel
11platforms               darwin
12maintainers             jeremyhu openmaintainer
13license                 {APSL-2 GPL-2+}
14installs_libs           no
15description             Compiler Tools for Mac OS X and Darwin
16long_description        A set of essential tools to support development \
17                        on Mac OS X and Darwin. Conceptually similar \
18                        similar to binutils on other platforms.
19
20homepage                http://opensource.apple.com/source/${name}/
21master_sites            http://opensource.apple.com/tarballs/${name} \
22                        http://opensource.apple.com/tarballs/ld64
23
24distfiles               ld64-${ld64_version}.tar.gz ${name}-${version}.tar.gz
25
26checksums               ld64-236.3.tar.gz \
27                        rmd160  6a3f44aa9ae57a60d2cff5b3d47be7972ad83029 \
28                        sha256  8ef36729b643201081ab45ebd8586ede8f9968bc17614b679a940faa82875ca6 \
29                        cctools-862.tar.gz \
30                        rmd160  21ca74a5f9d04c37c2310f107e21a0f3713360dd \
31                        sha256  1bf29f620b91c901ad3116b47738ab5076c1aed75d13869cd3bc7f067b4aaadb
32
33depends_build           port:libunwind-headers
34
35patchfiles              cctools-829-lto.patch PR-37520.patch cctools-839-static-dis_info.patch PR-12400897.patch cctools-862-prunetrie.patch cctools-862-unifdef__DARWIN_UNIX03-arm.patch cctools-862-no-lto.patch
36
37variant universal {}
38
39if {${os.major} < 11} {
40    patchfiles-append snowleopard-strnlen.patch
41}
42
43if {![variant_isset llvm33] && ![variant_isset llvm34] && ![variant_isset llvm35] && ![variant_isset llvm36] && ![variant_isset llvm37]} {
44    if {${os.major} >= 13} {
45        default_variants +llvm35
46    } elseif {${os.major} >= 9} {
47        default_variants +llvm34
48    }
49}
50
51set llvm_version {}
52variant llvm33 conflicts llvm34 llvm35 llvm36 llvm37 description {Use llvm-3.3 for libLTO and llvm-mc} {
53    set llvm_version        3.3
54    depends_lib-append      port:llvm-${llvm_version}
55}
56
57variant llvm34 conflicts llvm33 llvm35 llvm36 llvm37 description {Use llvm-3.4 for libLTO and llvm-mc} {
58    set llvm_version        3.4
59    depends_lib-append      port:llvm-${llvm_version}
60}
61
62variant llvm35 conflicts llvm33 llvm34 llvm36 llvm37 description {Use llvm-3.5 for libLTO and llvm-mc} {
63    set llvm_version        3.5
64    depends_lib-append      port:llvm-${llvm_version}
65}
66
67variant llvm36 conflicts llvm33 llvm34 llvm35 llvm37 description {Use llvm-3.6 for libLTO and llvm-mc} {
68    set llvm_version        3.6
69    depends_lib-append      port:llvm-${llvm_version}
70}
71
72variant llvm37 conflicts llvm33 llvm34 llvm35 llvm36 description {Use llvm-3.7 for libLTO and llvm-mc} {
73    set llvm_version        3.7
74    depends_lib-append      port:llvm-${llvm_version}
75}
76
77use_configure           no
78destroot.args           DSTROOT=${destroot}${prefix} RC_ProjectSourceVersion=${version}
79
80post-extract {
81    file copy ${worksrcpath}/../ld64-${ld64_version}/src/other/PruneTrie.cpp ${worksrcpath}/misc
82    system "touch ${worksrcpath}/../ld64-${ld64_version}/src/abstraction/configure.h"
83}
84
85post-patch {
86    # We don't want to build cctools ld.  We want to use ld64
87    reinplace "/^SUBDIRS_32/s/ld//" ${worksrcpath}/Makefile
88    reinplace "/^COMMON_SUBDIRS/s/ ld / /" ${worksrcpath}/Makefile
89
90    # Use our chosen version of llvm
91    if {${llvm_version} != ""} {
92        reinplace "s:\"llvm-mc\":\"llvm-mc-mp-${llvm_version}\":" ${worksrcpath}/as/driver.c
93        reinplace "s:@@LLVM_LIBDIR@@:${prefix}/libexec/llvm-${llvm_version}/lib:" ${worksrcpath}/libstuff/lto.c
94    }
95
96    foreach file [glob ${worksrcpath}/{*/,}Makefile] {
97        reinplace "s:/usr/local:@PREFIX@:g" ${file}
98        reinplace "s:/usr:@PREFIX@:g" ${file}
99        reinplace "s:@PREFIX@:${prefix}:g" ${file}
100        reinplace "s:${prefix}/efi:${prefix}:g" ${file}
101        reinplace "s:/Developer${prefix}:${prefix}:g" ${file}
102        reinplace "s:${prefix}/man:${prefix}/share/man:g" ${file}
103
104        # Don't strip installed binaries
105        reinplace "s:\\(install .*\\)-s :\\1:g" ${file}
106
107        if {${os.major} < 10} {
108            reinplace "s:${prefix}/bin/mig:/usr/bin/mig:g" ${file}
109        }
110    }
111}
112
113use_configure   no
114use_parallel_build  yes
115
116# https://trac.macports.org/ticket/43745
117configure.cflags-append -std=gnu99
118
119build.target    all
120
121set cxx_stdlibflags {}
122if {[string match *clang* ${configure.cxx}]} {
123    set cxx_stdlibflags -stdlib=${configure.cxx_stdlib}
124}
125
126pre-build {
127    build.args-append \
128        RC_ProjectSourceVersion=${version} \
129        USE_DEPENDENCY_FILE=NO \
130        BUILD_DYLIBS=NO \
131        CC="${configure.cc} ${configure.cflags}" \
132        CXX="${configure.cxx} ${configure.cxxflags} -I${worksrcpath}/../ld64-${ld64_version}/src/abstraction" \
133        CXXLIB="${cxx_stdlibflags}" \
134        TRIE=-DTRIE_SUPPORT \
135        RC_ARCHS="[get_canonical_archs]" \
136        SDK="-I${prefix}/include -I${worksrcpath}/../ld64-${ld64_version}/src/other"
137
138    if {${llvm_version} != ""} {
139        build.args-append \
140            LTO=-DLTO_SUPPORT \
141            RC_CFLAGS="[get_canonical_archflags] `llvm-config-mp-${llvm_version} --cflags`" \
142            LLVM_MC="llvm-mc-mp-${llvm_version}"
143    } else {
144        build.args-append \
145            LTO= \
146            RC_CFLAGS="[get_canonical_archflags]"
147    }
148}
149
150pre-destroot {
151    destroot.args-append \
152        RC_ProjectSourceVersion=${version} \
153        USE_DEPENDENCY_FILE=NO \
154        BUILD_DYLIBS=NO \
155        CC="${configure.cc} ${configure.cflags}" \
156        CXX="${configure.cxx} ${configure.cxxflags} -I${worksrcpath}/../ld64-${ld64_version}/src/abstraction" \
157        CXXLIB="${cxx_stdlibflags}" \
158        TRIE=-DTRIE_SUPPORT \
159        RC_ARCHS="[get_canonical_archs]" \
160        SDK="-I${prefix}/include -I${worksrcpath}/../ld64-${ld64_version}/src/other"
161
162    if {${llvm_version} != ""} {
163        destroot.args-append \
164            LTO=-DLTO_SUPPORT \
165            RC_CFLAGS="[get_canonical_archflags] `llvm-config-mp-${llvm_version} --cflags`" \
166            LLVM_MC="llvm-mc-mp-${llvm_version}"
167    } else {
168        destroot.args-append \
169            LTO= \
170            RC_CFLAGS="[get_canonical_archflags]"
171    }
172}
173
174platform macosx {
175    build.args-append RC_OS="macos"
176    destroot.args-append RC_OS="macos"
177}
178
179destroot.target install_tools
180destroot.args-append DSTROOT=${destroot}
181post-destroot {
182    file delete -force ${destroot}${prefix}/OpenSourceLicenses
183    file delete -force ${destroot}${prefix}/OpenSourceVersions
184    file delete -force ${destroot}${prefix}/RelNotes
185
186    if {${os.major} < 10} {
187        file delete -force ${destroot}/Developer
188    }
189
190    # Provided by port:cctools-headers
191    file delete -force ${destroot}${prefix}/include
192}
193
194livecheck.type          regex
195livecheck.regex         "${name}-(\[\\d.\]+)"
Note: See TracBrowser for help on using the repository browser.