Ignore:
Timestamp:
Apr 28, 2012, 8:39:35 PM (5 years ago)
Author:
jeremyhu@…
Message:

ld64: Bump Tiger and ppc to ld64-97.17, replace XCode build with a Makefile to use the right compiler

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/devel/ld64/Portfile

    r92368 r92440  
    22
    33PortSystem              1.0
    4 PortGroup               xcode 1.0
    5 PortGroup               xcodeversion 1.0
    6 minimum_xcodeversions   {10 3.2.3}
    74
    85# cctools uses a static library from this port when it builds, please
     
    1512set llvm_version        3.0
    1613categories              devel
     14platforms               darwin
    1715maintainers             mfeiri jeremyhu
    1816homepage                http://opensource.apple.com/source/${name}/
     
    3028                        sha256  96a912464e2d4d3d7cdaab0744003b0fa93d139f203c82867f659ee94b4ae9f7
    3129
    32 patchfiles              ld64-pbxproj.patch ld64-version.patch
     30patchfiles              ld64-version.patch
    3331
    3432# We don't set llvmXX as the default variant on Tiger because it would introduce a
     
    4543    }
    4644}
     45
     46variant universal {}
    4747
    4848set llvm_version {}
     
    6363
    6464if {${os.arch} == "powerpc" || ${os.major} < 9} {
    65     # XCode 3.1.4
    66     # 97.17 could work, but it requires gcc-4.2 to build, and xcodebuild
    67     # isn't UsingTheRightCompiler.  We could use it for Leopard/ppc, but
    68     # I don't want to support too many different versions.
    69     version             85.2.1
    70     revision            6
    71     checksums           rmd160 42c80bd4ad6e9f96a757245e6a2b95084c009ff1 \
    72                         sha256 4bcbcbdfd62efdc46c51700b8f5dae2cbd1638e9e50f649d5c7f242d32fca804
    73     supported_archs     i386 ppc
     65    # 127.2 should work for powerpc, but it will require some build fixes.
     66    version             97.17
     67    revision            0
     68    checksums           rmd160  d52df7d7f741c8bedd29cbac73dbb9db992b4795 \
     69                        sha256  02bd46af0809eaa415d096d7d41c3e8e7d80f7d8d181840866fb87f036b4e089
     70    supported_archs     x86_64 i386 ppc
    7471
    75     patchfiles-delete   ld64-pbxproj.patch ld64-version.patch
    76     patchfiles-append   patch-MATH85-ld.cpp.diff ld64-85-pbxproj.patch \
    77                         ld64-85-version.patch ld64-85-no_pie.patch
     72    patchfiles-append   ld64-97-no-LTO.patch ld64-97-Makefile.patch
    7873} elseif {${os.major} < 11} {
    7974    # XCode 3.2.6
     
    8580    supported_archs     i386 x86_64
    8681
    87     patchfiles-append   ld64-127-any-cctools.patch
     82    patchfiles-append   ld64-127-any-cctools.patch ld64-127-Makefile.patch
    8883}
    8984
     
    9994}
    10095
    101 xcode.target            all ObjectDump machocheck
    102 xcode.destroot.path     ${prefix}/bin
     96if {${configure.compiler} == "gcc-4.0"} {
     97    configure.compiler gcc-4.2
     98    if {![file exists ${configure.cc}]} {
     99        depends_build-append port:apple-gcc42
     100        depends_skip_archcheck-append apple-gcc42
     101        configure.compiler apple-gcc-4.2
     102    }
     103}
     104
     105post-extract {
     106    file copy ${filespath}/Makefile ${worksrcpath}
     107}
    103108
    104109post-patch {
    105     set extra_flags {}
     110    reinplace "s|@@VERSION@@|${version}|g" \
     111        ${worksrcpath}/src/ld/Options.cpp
    106112
     113    if {${os.major} < 9} {
     114        # No CommonCrypto, use openssl
     115        reinplace "s:<CommonCrypto/CommonDigest.h>:<openssl/md5.h>:" \
     116            ${worksrcpath}/src/ld/MachOWriterExecutable.hpp
     117        reinplace "s:CC_MD5:MD5:" \
     118            ${worksrcpath}/src/ld/MachOWriterExecutable.hpp
     119    }
     120}
     121
     122use_configure no
     123build.args \
     124    CC="${configure.cc}" \
     125    CXX="${configure.cxx}" \
     126    OTHER_CPPFLAGS="${configure.cppflags}" \
     127    OTHER_CFLAGS="${configure.cflags} [get_canonical_archflags]" \
     128    OTHER_CXXFLAGS="${configure.cxxflags} [get_canonical_archflags]" \
     129    OTHER_LDFLAGS="${configure.ldflags} [get_canonical_archflags]"
     130
     131destroot.args \
     132    PREFIX=${prefix}
     133
     134pre-build {
    107135    if {[variant_isset llvm29] || [variant_isset llvm30] || [variant_isset llvm31]} {
    108         reinplace "s|-Wl,-lazy_library,/Developer/usr/lib/libLTO.dylib|-Wl,-lazy_library,[exec ${prefix}/bin/llvm-config-mp-${llvm_version} --libdir]/libLTO.dylib|g" \
    109             ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    110         reinplace "s|MACPORTS_LLVM_INCLUDEDIR|[exec ${prefix}/bin/llvm-config-mp-${llvm_version} --includedir]|g" \
    111             ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    112 
    113         set extra_flags [exec ${prefix}/bin/llvm-config-mp-${llvm_version} --cflags]
    114     } else {
    115         reinplace "s|-Wl,-lazy_library,/Developer/usr/lib/libLTO.dylib||g" \
    116             ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    117     }
    118 
    119     reinplace "s|MACPORTS_CFLAGS|-I${prefix}/include ${extra_flags}|g" \
    120         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    121     reinplace "s|MACPORTS_CPLUSPLUSFLAGS|-I${prefix}/include ${extra_flags}|g" \
    122         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    123 
    124     reinplace "s|/usr/share/man/man1|${prefix}/share/man/man1|g" \
    125         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    126     reinplace "s|usr/share/man/man1|${prefix}/share/man/man1|g" \
    127         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    128     reinplace "s|/usr/local|${prefix}|g" \
    129         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    130     reinplace "s|/SDKs/Extra/usr|${prefix}|g" \
    131         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    132     reinplace "s|/Developer${prefix}|${prefix}|g" \
    133         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    134     reinplace "s|\$(DEVELOPER_DIR)/usr|${prefix}|g" \
    135         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    136     reinplace "s|\$(DEVELOPER_DIR)${prefix}|${prefix}|g" \
    137         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    138     reinplace "s|\$(RC_ProjectSourceVersion)|${version}|g" \
    139         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    140     reinplace "/VERSIONING_SYSTEM/d" \
    141         ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    142 
    143     if {[file exists ${worksrcpath}/src/ld/Options.cpp]} {
    144         reinplace "s|@@VERSION@@|${version}|g" \
    145             ${worksrcpath}/src/ld/Options.cpp
    146     } else {
    147         reinplace "s|@@VERSION@@|${version}|g" \
    148             ${worksrcpath}/src/Options.cpp
     136        build.args-append LLVM_CONFIG=${prefix}/bin/llvm-config-mp-${llvm_version}
    149137    }
    150138
    151139    if {${os.major} < 9} {
    152         reinplace "s:-lazy_library,::g" \
    153             ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    154 
    155         # No CommonCrypto, use openssl
    156         reinplace "s:<CommonCrypto/CommonDigest.h>:<openssl/md5.h>:" \
    157             ${worksrcpath}/src/MachOWriterExecutable.hpp
    158         reinplace "s:CC_MD5:MD5:" \
    159             ${worksrcpath}/src/MachOWriterExecutable.hpp
    160         reinplace "s:MACPORTS_LD64_LDFLAGS:-lcrypto:g" \
    161             ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    162     } else {
    163         reinplace "s:MACPORTS_LD64_LDFLAGS::g" \
    164             ${worksrcpath}/ld64.xcodeproj/project.pbxproj
    165     }
     140        build.args-append OTHER_LDFLAGS_LD64=-lcrypto
     141    }   
    166142}
    167143
     
    176152                @executable_path/../lib/libLTO.dylib ${destroot}${prefix}/libexec/ld64/ld"
    177153    }
    178 
    179     if {[file exists ${destroot}${prefix}/bin/libprunetrie.a]} {
    180         file rename ${destroot}${prefix}/bin/libprunetrie.a ${destroot}${prefix}/lib/libprunetrie.a
    181     }
    182154}
    183155
Note: See TracChangeset for help on using the changeset viewer.