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

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

ld64: Fix the XCode version comment for 127.2

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