source: trunk/dports/devel/ld64/Portfile @ 97395

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

ld64: Bump to version 133.3

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.7 KB
Line 
1# $Id: Portfile 97395 2012-09-04 21:52:22Z jeremyhu@macports.org $
2
3PortSystem              1.0
4
5# cctools uses a static library from this port when it builds, please
6# revbump cctools whenever this port updates
7
8name                    ld64
9# XCode 4.4
10version                 133.3
11set llvm_version        3.0
12categories              devel
13platforms               darwin
14maintainers             mfeiri jeremyhu
15homepage                http://opensource.apple.com/source/${name}/
16master_sites            http://opensource.apple.com/tarballs/${name}/
17license                 APSL-2
18depends_build           port:libunwind-headers \
19                        path:include/mach-o/dyld_priv.h:dyld-headers \
20                        path:include/mach-o/arm/reloc.h:cctools-headers
21description             ld64 is the new mach-o linker
22long_description        ld64 combines several object files and libraries, \
23                        resolves references, and produces an ouput file.
24
25checksums               ${distname}${extract.suffix} \
26                        rmd160  4099dbcbc296d618c6e08b1cd01f73e640a477b0 \
27                        sha256  d641e7820b4fd4cac2bc3c1038149f02503a883a145a588860dc6a283399129f
28
29patchfiles              ld64-version.patch ld64-133-no-CrashReporterClient.h.patch
30
31# We don't set llvmXX as the default variant on Tiger because it would introduce a
32# dependency cycle as llvm requires apple-gcc42 and ld64 to build correctly.  Users
33# wanting LTO support in ld64 on Tiger can install the +llvm variant after llvm
34# has been installed.
35if {![variant_isset llvm29] && ![variant_isset llvm30] && ![variant_isset llvm31] && ![variant_isset llvm32] && ${os.major} >= 9} {
36    default_variants +llvm31
37
38    # Leopard/powerpc has the option to not be LTO
39    if {![variant_isset llvm31] && ${os.arch} != "powerpc"} {
40        ui_error "Your platform cannot be configured without LTO support in ld64.  Please enable one of the llvmXX variants, and try again."
41        return -code error "Your platform cannot be configured without LTO support in ld64.  Please enable one of the llvmXX variants, and try again."
42    }
43}
44
45variant universal {}
46
47set llvm_version {}
48variant llvm29 conflicts llvm30 llvm31 llvm32 description {Use llvm-2.9 for libLTO} {
49    set llvm_version        2.9
50    depends_lib-append      port:llvm-${llvm_version}
51}
52
53variant llvm30 conflicts llvm29 llvm31 llvm32 description {Use llvm-3.0 for libLTO} {
54    set llvm_version        3.0
55    depends_lib-append      port:llvm-${llvm_version}
56}
57
58variant llvm31 conflicts llvm29 llvm30 llvm32 description {Use llvm-3.1 for libLTO} {
59    set llvm_version        3.1
60    depends_lib-append      port:llvm-${llvm_version}
61}
62
63variant llvm32 conflicts llvm29 llvm30 llvm31 description {Use llvm-3.2 for libLTO} {
64    set llvm_version        3.2
65    depends_lib-append      port:llvm-${llvm_version}
66}
67
68if {${os.arch} == "powerpc" || ${os.major} < 9} {
69    # XCode 3.2.6
70    # 127.2 should work for powerpc, but it will require some build fixes.
71    version             97.17
72    revision            1
73    checksums           rmd160  d52df7d7f741c8bedd29cbac73dbb9db992b4795 \
74                        sha256  02bd46af0809eaa415d096d7d41c3e8e7d80f7d8d181840866fb87f036b4e089
75    supported_archs     x86_64 i386 ppc
76
77    patchfiles-delete   ld64-133-no-CrashReporterClient.h.patch
78    patchfiles-append   ld64-97-no-LTO.patch ld64-97-Makefile.patch
79} elseif {${os.major} < 11} {
80    # XCode 4.2
81    # This was the last ld64 release that supported linking ppc executables.
82    version             127.2
83    revision            5
84    checksums           rmd160  8ee709341549a1944732daef6ebab7ef1acfcc6e \
85                        sha256  97b75547b2bd761306ab3e15ae297f01e7ab9760b922bc657f4ef72e4e052142
86    supported_archs     i386 x86_64
87
88    patchfiles-delete   ld64-133-no-CrashReporterClient.h.patch
89    patchfiles-append   ld64-127-any-cctools.patch ld64-127-Makefile.patch
90}
91
92platform darwin 8 {
93    pre-fetch {
94        if {[variant_isset llvm29] || [variant_isset llvm30] || [variant_isset llvm31] || [variant_isset llvm32]} {
95            if {![file exists ${prefix}/bin/llvm-config-mp-${llvm_version}]} {
96                ui_error "You must first install ld64 without llvm support to build llvm.  After llvm is installed, you can reinstall ld64 with the llvm variant."
97                return -code error "You must first install ld64 without llvm support to build llvm.  After llvm is installed, you can reinstall ld64 with the llvm variant."
98            }
99        }
100    }
101
102    post-patch {
103        reinplace "s:-Wl,-exported_symbol,__mh_execute_header::g" \
104            ${worksrcpath}/Makefile
105    }
106}
107
108if {${configure.compiler} == "gcc-4.0"} {
109    configure.compiler gcc-4.2
110    if {![file exists ${configure.cc}]} {
111        depends_build-append port:apple-gcc42
112        depends_skip_archcheck-append apple-gcc42
113        configure.compiler apple-gcc-4.2
114    }
115}
116
117post-extract {
118    file copy ${filespath}/Makefile ${worksrcpath}
119}
120
121post-patch {
122    reinplace "s|@@VERSION@@|${version}|g" \
123        ${worksrcpath}/src/ld/Options.cpp
124
125    if {${os.major} < 9} {
126        # No CommonCrypto, use openssl
127        reinplace "s:<CommonCrypto/CommonDigest.h>:<openssl/md5.h>:" \
128            ${worksrcpath}/src/ld/MachOWriterExecutable.hpp
129        reinplace "s:CC_MD5:MD5:" \
130            ${worksrcpath}/src/ld/MachOWriterExecutable.hpp
131    }
132}
133
134use_configure no
135build.args \
136    CC="${configure.cc}" \
137    CXX="${configure.cxx}" \
138    OTHER_CPPFLAGS="${configure.cppflags}" \
139    OTHER_CFLAGS="${configure.cflags} [get_canonical_archflags]" \
140    OTHER_CXXFLAGS="${configure.cxxflags} [get_canonical_archflags]" \
141    OTHER_LDFLAGS="${configure.ldflags} [get_canonical_archflags]"
142
143if {${os.major} >= 11} {
144    build.args-append \
145        RC_SUPPORTED_ARCHS="armv6 armv7 i386 x86_64"
146}
147
148destroot.args \
149    PREFIX=${prefix}
150
151pre-build {
152    if {[variant_isset llvm29] || [variant_isset llvm30] || [variant_isset llvm31]  || [variant_isset llvm32]} {
153        build.args-append LLVM_CONFIG=${prefix}/bin/llvm-config-mp-${llvm_version}
154    }
155
156    if {${os.major} < 9} {
157        build.args-append OTHER_LDFLAGS_LD64=-lcrypto
158    }   
159}
160
161post-destroot {
162    # ${prefix}/bin/ld will always use the llvm we built against
163    # ${prefix}/libexec/ld64/ld uses relative linking for use with the llvm ports
164    file mkdir ${destroot}${prefix}/libexec/ld64
165    file copy ${destroot}${prefix}/bin/ld ${destroot}${prefix}/libexec/ld64/ld
166
167    if {[variant_isset llvm29] || [variant_isset llvm30] || [variant_isset llvm31] || [variant_isset llvm32]} {
168        system "install_name_tool -change ${prefix}/libexec/llvm-${llvm_version}/lib/libLTO.dylib \
169                @executable_path/../lib/libLTO.dylib ${destroot}${prefix}/libexec/ld64/ld"
170    }
171}
172
173livecheck.type          regex
174livecheck.regex         "${name}-(\[\\d.\]+)"
Note: See TracBrowser for help on using the repository browser.