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

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

cctools: Adjust cppflags to possibly fix a build issue on Tiger (#46875)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1# $Id: Portfile 132952 2015-02-15 22:47:29Z 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
126configure.cppflags-append -I${worksrcpath}/../ld64-${ld64_version}/src/abstraction -I${worksrcpath}/../ld64-${ld64_version}/src/other -I${worksrcpath}/include
127
128pre-build {
129    build.args-append \
130        RC_ProjectSourceVersion=${version} \
131        USE_DEPENDENCY_FILE=NO \
132        BUILD_DYLIBS=NO \
133        CC="${configure.cc} ${configure.cflags}" \
134        CXX="${configure.cxx} ${configure.cxxflags}" \
135        CXXLIB="${cxx_stdlibflags}" \
136        TRIE=-DTRIE_SUPPORT \
137        RC_ARCHS="[get_canonical_archs]" \
138        SDK="${configure.cppflags}"
139
140    if {${llvm_version} != ""} {
141        build.args-append \
142            LTO=-DLTO_SUPPORT \
143            RC_CFLAGS="[get_canonical_archflags] `llvm-config-mp-${llvm_version} --cflags`" \
144            LLVM_MC="llvm-mc-mp-${llvm_version}"
145    } else {
146        build.args-append \
147            LTO= \
148            RC_CFLAGS="[get_canonical_archflags]"
149    }
150}
151
152pre-destroot {
153    destroot.args-append \
154        RC_ProjectSourceVersion=${version} \
155        USE_DEPENDENCY_FILE=NO \
156        BUILD_DYLIBS=NO \
157        CC="${configure.cc} ${configure.cflags}" \
158        CXX="${configure.cxx} ${configure.cxxflags}" \
159        CXXLIB="${cxx_stdlibflags}" \
160        TRIE=-DTRIE_SUPPORT \
161        RC_ARCHS="[get_canonical_archs]" \
162        SDK="${configure.cppflags}"
163
164    if {${llvm_version} != ""} {
165        destroot.args-append \
166            LTO=-DLTO_SUPPORT \
167            RC_CFLAGS="[get_canonical_archflags] `llvm-config-mp-${llvm_version} --cflags`" \
168            LLVM_MC="llvm-mc-mp-${llvm_version}"
169    } else {
170        destroot.args-append \
171            LTO= \
172            RC_CFLAGS="[get_canonical_archflags]"
173    }
174}
175
176platform macosx {
177    build.args-append RC_OS="macos"
178    destroot.args-append RC_OS="macos"
179}
180
181destroot.target install_tools
182destroot.args-append DSTROOT=${destroot}
183post-destroot {
184    file delete -force ${destroot}${prefix}/OpenSourceLicenses
185    file delete -force ${destroot}${prefix}/OpenSourceVersions
186    file delete -force ${destroot}${prefix}/RelNotes
187
188    if {${os.major} < 10} {
189        file delete -force ${destroot}/Developer
190    }
191
192    # Provided by port:cctools-headers
193    file delete -force ${destroot}${prefix}/include
194}
195
196livecheck.type          regex
197livecheck.regex         "${name}-(\[\\d.\]+)"
Note: See TracBrowser for help on using the repository browser.