[97621] trunk/dports/lang

jeremyhu at macports.org jeremyhu at macports.org
Sun Sep 9 22:42:53 PDT 2012


Revision: 97621
          https://trac.macports.org/changeset/97621
Author:   jeremyhu at macports.org
Date:     2012-09-09 22:42:50 -0700 (Sun, 09 Sep 2012)
Log Message:
-----------
{clang,llvm}-2.9: Update the clang port to be a subport of llvm, build with --enable-pic (#35825)

Modified Paths:
--------------
    trunk/dports/lang/llvm-2.9/Portfile

Added Paths:
-----------
    trunk/dports/lang/llvm-2.9/files/install_target.patch
    trunk/dports/lang/llvm-2.9/files/mp-clang-2.9
    trunk/dports/lang/llvm-2.9/files/scan-build-PR-35006.patch
    trunk/dports/lang/llvm-2.9/files/tiger-shlib-clang.patch

Removed Paths:
-------------
    trunk/dports/lang/clang-2.9/

Modified: trunk/dports/lang/llvm-2.9/Portfile
===================================================================
--- trunk/dports/lang/llvm-2.9/Portfile	2012-09-10 04:12:38 UTC (rev 97620)
+++ trunk/dports/lang/llvm-2.9/Portfile	2012-09-10 05:42:50 UTC (rev 97621)
@@ -4,61 +4,113 @@
 PortGroup select        1.0
 
 set llvm_version        2.9
-revision                5
+revision                11
 name                    llvm-${llvm_version}
+subport                 clang-${llvm_version} {}
 set suffix              mp-${llvm_version}
-set sub_prefix          ${prefix}/libexec/${name}
+set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
 dist_subdir             llvm
 categories              lang
 platforms               darwin
 license                 NCSA
 maintainers             jeremyhu openmaintainer
-description             llvm is a next generation compiler infrastructure (svn trunk version)
-long_description        The LLVM Core libraries provide a modern source- and \
+
+if {${subport} == "llvm-${llvm_version}"} {
+    homepage            http://llvm.org/
+    description         llvm is a next generation compiler infrastructure (svn trunk version)
+    long_description    The LLVM Core libraries provide a modern source- and \
                         target-independent optimizer, along with code \
                         generation support for many popular CPUs (as well as \
                         some less common ones!) These libraries are built \
                         around a well specified code representation known as \
                         the LLVM intermediate representation ("LLVM IR").
 
-homepage                http://llvm.org/
+    depends_lib         port:libffi
+    depends_run         bin:perl:perl5 port:llvm_select
+} elseif {${subport} == "clang-${llvm_version}"} {
+    homepage            http://clang.llvm.org/
+    description         C, C++, Objective C and Objective C++ compiler
+    long_description    Clang is an "LLVM native" C/C++/Objective-C compiler, \
+                        which aims to deliver amazingly fast compiles (e.g. \
+                        about 3x faster than GCC when compiling Objective-C \
+                        code in a debug configuration), extremely useful error \
+                        and warning messages and to provide a platform for \
+                        building great source level tools. The included Clang \
+                        Static Analyzer is a tool automatically finds bugs in \
+                        your code, and is a great example of the sort of tool \
+                        that can be built using the Clang frontend as a \
+                        library to parse C/C++ code.
 
-depends_lib             port:libffi
-depends_run             bin:perl:perl5 port:llvm_select
+    depends_lib         port:llvm-${llvm_version} port:libffi
+    depends_run         port:clang_select port:ld64
+    depends_skip_archcheck-append ld64
 
+    default_variants    +analyzer
+}
+
 #fetch.type              svn
-#svn.revision            146339
+#svn.revision            163481
+#set compiler_rt_rev     ${svn.revision}
+#set libcxx_rev          ${svn.revision}
 #version                 ${llvm_version}-r${svn.revision}
-#worksrcdir              release_29
-#svn.url                 http://llvm.org/svn/llvm-project/llvm/branches/${worksrcdir}
+#worksrcdir              trunk
+#svn.url                 http://llvm.org/svn/llvm-project/llvm/trunk
+#worksrcdir              release_31
+#svn.url                 http://llvm.org/svn/llvm-project/llvm/branches/release_31
 #default_variants-append +assertions
 
 version                 ${llvm_version}
+set compiler_rt_rev     128674
+set libcxx_rev          ${compiler_rt_rev}
 epoch                   1
-master_sites            ${homepage}releases/${version}/
+master_sites            http://llvm.org/releases/${version}
 extract.suffix          .tgz
 distfiles               llvm-${version}${extract.suffix}
 worksrcdir              llvm-${version}
-checksums           sha1    500f587f840199ac53c4fc7572839d08fa9d9123 \
-                    rmd160  caeaa067fda1eb34196b356a087645f83731cfb7 \
-                    sha256  661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779
 
-patchfiles      tiger-shlib.patch \
-                0001-Add-a-few-missing-template-keywords.patch
+checksums               llvm-${version}${extract.suffix} \
+                        sha1    500f587f840199ac53c4fc7572839d08fa9d9123 \
+                        rmd160  caeaa067fda1eb34196b356a087645f83731cfb7 \
+                        sha256  661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779 \
+                        clang-${version}${extract.suffix} \
+                        sha1    5fd3b5cec050ec12858c1602b23cf096282ad4a4 \
+                        rmd160  4ab79cbd0e2ad25a2272e6ee2fbbf546818dbd73 \
+                        sha256  70c41f3f782a71cbaa7bc8d6ea29fce4263ad3e8558dfecc6dc11cdef17909df
+
+patchfiles      install_target.patch \
+                0001-Add-a-few-missing-template-keywords.patch \
+                tiger-shlib.patch
+
 patch.pre_args  -p1
 
+if {${subport} == "clang-${llvm_version}"} {
+    if {${distfiles} != ""} {
+        distfiles-append     clang-${version}${extract.suffix}
+    }
+
+    patchfiles-append    tiger-shlib-clang.patch scan-build-PR-35006.patch
+
+    build.target        clang-only
+    destroot.target     install-clang
+}
+
 build.env-append        VERBOSE=1 REQUIRE_RTTI=1
 destroot.env-append     VERBOSE=1 REQUIRE_RTTI=1
 configure.cppflags
 configure.ldflags
 configure.pre_args-delete --prefix=${prefix}
 configure.args          --enable-bindings=none --enable-libffi --enable-shared --enable-jit \
-                        --enable-optimized --disable-profiling \
+                        --enable-optimized --disable-profiling --enable-pic \
                         --enable-debug-symbols --disable-debug-runtime \
                         --prefix="${sub_prefix}"
 
-select.group    llvm
-select.file     ${filespath}/mp-${name}
+if {${subport} == "llvm-${llvm_version}"} {
+    select.group        llvm
+    select.file         ${filespath}/mp-${subport}
+} elseif {${subport} == "clang-${llvm_version}"} {
+    select.group        clang
+    select.file         ${filespath}/mp-${subport}
+}
 
 # g++-4.0 fails to build some of the newer C++ for ppc
 # Intel looks ok, but I prefer using gcc-4.2 for consistency
@@ -110,50 +162,58 @@
         configure.args-append --with-optimize-option=-Os
     }
 
-    post-destroot {
-        foreach liba [glob ${destroot}${sub_prefix}/lib/*dylib] {
-            set liba_nodr [string map "${destroot} {}" ${liba}]
-            system "install_name_tool -id ${liba_nodr} ${liba}"
-
-            foreach libb [glob ${destroot}${sub_prefix}/lib/*dylib] {
-                set libb_base [string map "${destroot}${sub_prefix}/lib/ {}" ${libb}]
-                set libb_nodr [string map "${destroot} {}" ${libb}]
-
-                system "install_name_tool -change @executable_path/../lib/${libb_base} ${libb_nodr} ${liba}"
-            }
-        }
+    if {${subport} == "clang-${llvm_version}" && ${os.major} <= 9} {
+        patchfiles-append leopard-no-asan.patch
     }
 }
 
 platform darwin 8 {
+    # Tiger's DevTools make has issues with the nested ifs in compiler-rt
+    depends_run-append      port:gmake
+    depends_skip_archcheck-append gmake
+    build.cmd               ${prefix}/bin/gmake
+    destroot.cmd            ${prefix}/bin/gmake
+
     post-configure {
         reinplace "/^RPATH/s/=.*/=/" ${worksrcpath}/Makefile.config
     }
 }
 
-variant ocaml description {Enable generation of OCaml binding} {
-    depends_lib-append   port:ocaml
+post-extract {
+    if {${subport} == "clang-${llvm_version}"} {
+        #system "cd ${worksrcpath}/tools && svn co -r ${svn.revision} http://llvm.org/svn/llvm-project/cfe/trunk clang"
+        #system "cd ${worksrcpath}/tools && svn co -r ${svn.revision} http://llvm.org/svn/llvm-project/cfe/branches/release_30 clang"
+        file rename ${workpath}/clang-${llvm_version} ${worksrcpath}/tools/clang
 
-    configure.args-delete --enable-bindings=none
-    configure.args-append --enable-bindings=ocaml
+        system "cd ${worksrcpath}/projects && svn co -r ${compiler_rt_rev} http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt"
+        #system "cd ${worksrcpath}/projects && svn co -r ${compiler_rt_rev} http://llvm.org/svn/llvm-project/compiler-rt/branches/release_30 compiler-rt"
+        #file rename ${workpath}/compiler-rt-${llvm_version} ${worksrcpath}/projects/compiler-rt
 
-    destroot.args-append  OVERRIDE_libdir=${sub_prefix}/lib
+        #system "cd ${worksrcpath}/projects && svn co -r ${libcxx_rev} http://llvm.org/svn/llvm-project/libcxx/trunk libcxx"
+        #system "cd ${worksrcpath}/projects && svn co -r ${libcxx_rev} http://llvm.org/svn/llvm-project/libcxx/branches/release_30 libcxx"
+        #file rename ${workpath}/libcxx-${llvm_version} ${worksrcpath}/projects/libcxx
+    }
 }
 
 post-patch {
-    # http://trac.macports.org/ticket/33207
-    reinplace "/LLVMINTERP/s/-lli/-lli-${suffix}/" ${worksrcpath}/tools/llvm-ld/llvm-ld.cpp
+    if {${subport} == "llvm-${llvm_version}"} {
+        # http://trac.macports.org/ticket/33207
+        reinplace "/LLVMINTERP/s/-lli/-lli-${suffix}/" ${worksrcpath}/tools/llvm-ld/llvm-ld.cpp
+    } elseif {${subport} == "clang-${llvm_version}"} {
+        # http://trac.macports.org/ticket/33272
+        if {![variant_isset arm_runtime]} {
+            reinplace {/^RuntimeLibrary.darwin.Configs/ s/arm[^ ]* *//g} ${worksrcpath}/tools/clang/runtime/Makefile
+            reinplace {/^SubDirs/ s/arm//} ${worksrcpath}/projects/compiler-rt/lib/Makefile.mk
+            reinplace {/^UniversalArchs/ s/arm[^ )]* *//g} ${worksrcpath}/projects/compiler-rt/make/platform/clang_darwin.mk
+            reinplace {/^Configs/ s/arm[^ )]* *//g} ${worksrcpath}/projects/compiler-rt/make/platform/clang_darwin.mk
+        }
+    }
 }
 
 post-destroot {
     file mkdir ${destroot}${prefix}/share/doc
-    file rename ${destroot}${sub_prefix}/docs/llvm ${destroot}${prefix}/share/doc/${name}
+    file rename ${destroot}${sub_prefix}/docs/llvm ${destroot}${prefix}/share/doc/${subport}
 
-    foreach man [glob ${destroot}${sub_prefix}/share/man/man1/*.1] {
-	set basename [string map "${destroot}${sub_prefix}/share/man/man1/ {}" ${man}]
-        file rename ${man} ${destroot}${prefix}/share/man/man1/[string map ".1 -${suffix}.1" ${basename}]
-    }
-
     foreach bin [glob ${destroot}${sub_prefix}/bin/*] {
         set bin_filename [string map "${sub_prefix} ${prefix}" ${bin}]-${suffix}
         set exec_path [string map "${destroot}${sub_prefix} ${sub_prefix}" ${bin}]
@@ -161,4 +221,105 @@
         xinstall -m 755 "${filespath}/llvm-bin" "${bin_filename}"
         reinplace "s:EXEC_PATH:${exec_path}:" "${bin_filename}"
     }
+
+    if {${subport} == "llvm-${llvm_version}"} {
+        foreach man [glob ${destroot}${sub_prefix}/share/man/man1/*.1] {
+            set basename [string map "${destroot}${sub_prefix}/share/man/man1/ {}" ${man}]
+            file rename ${man} ${destroot}${prefix}/share/man/man1/[string map ".1 -${suffix}.1" ${basename}]
+        }
+
+        foreach liba [glob ${destroot}${sub_prefix}/lib/*dylib] {
+            set liba_nodr [string map "${destroot} {}" ${liba}]
+            system "install_name_tool -id ${liba_nodr} ${liba}"
+
+            foreach libb [glob ${destroot}${sub_prefix}/lib/*dylib] {
+                set libb_base [string map "${destroot}${sub_prefix}/lib/ {}" ${libb}]
+                set libb_nodr [string map "${destroot} {}" ${libb}]
+
+                system "install_name_tool -change @executable_path/../lib/${libb_base} ${libb_nodr} ${liba}"
+            }
+        }
+    } elseif {${subport} == "clang-${llvm_version}"} {
+        #system "ditto ${worksrcpath}/projects/libcxx/include ${destroot}${sub_prefix}/lib/c++/v1"
+
+        # http://trac.macports.org/ticket/33207
+        ln -s ${prefix}/libexec/ld64/ld ${destroot}${sub_prefix}/bin/ld
+
+        system "install_name_tool -id ${sub_prefix}/lib/libclang.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
+        system "install_name_tool -change @executable_path/../lib/libLLVM-${llvm_version}svn.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}svn.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
+    }
 }
+
+if {${subport} == "llvm-${llvm_version}"} {
+    variant ocaml description {Enable generation of OCaml binding} {
+        depends_lib-append   port:ocaml
+
+        configure.args-delete --enable-bindings=none
+        configure.args-append --enable-bindings=ocaml
+
+        destroot.args-append  OVERRIDE_libdir=${sub_prefix}/lib
+    }
+} elseif {${subport} == "clang-${llvm_version}"} {
+    variant arm_runtime description {Build and install the arm runtime for iOS development (requires iOS SDK)} {}
+
+    set pythonver ""
+    set pythonverdot ""
+
+    if {![variant_isset python25] && ![variant_isset python26]} {
+        default_variants +python27
+    }
+
+    variant python25 conflicts python26 python27 description {Use python 2.5} {
+        set pythonver 25
+        set pythonverdot 2.5
+    }
+
+    variant python26 conflicts python25 python27 description {Use python 2.6} {
+        set pythonver 26
+        set pythonverdot 2.6
+    }
+
+    variant python27 conflicts python25 python26 description {Use python 2.7} {
+        set pythonver 27
+        set pythonverdot 2.7
+    }
+
+    variant analyzer description {Install clang static analyzer} {
+        if {[string equal "${pythonver}" ""]} {
+            ui_error "You mush select a python variant to use the clang static analyzer (+analyzer)"
+            error "Invalid variant combination"
+        }
+
+        depends_run-append port:perl5 port:python${pythonver}
+
+        post-patch {
+            reinplace "s|/usr/bin/env perl|${prefix}/bin/perl5|g" \
+                ${worksrcpath}/tools/clang/tools/scan-build/ccc-analyzer \
+                ${worksrcpath}/tools/clang/tools/scan-build/c++-analyzer \
+                ${worksrcpath}/tools/clang/tools/scan-build/scan-build
+            reinplace "s|/usr/bin/env python|${prefix}/bin/python${pythonverdot}|g" \
+                ${worksrcpath}/tools/clang/tools/scan-build/set-xcode-analyzer \
+                ${worksrcpath}/tools/clang/tools/scan-view/scan-view
+        }
+
+        post-destroot {
+            file mkdir ${destroot}${sub_prefix}/libexec
+            file copy ${worksrcpath}/tools/clang/tools/scan-build ${destroot}${sub_prefix}/libexec/scan-build
+            file copy ${worksrcpath}/tools/clang/tools/scan-view ${destroot}${sub_prefix}/libexec/scan-view
+
+            file delete -force ${destroot}${sub_prefix}/libexec/scan-build/.svn
+            file delete -force ${destroot}${sub_prefix}/libexec/scan-view/.svn
+            file delete -force ${destroot}${sub_prefix}/libexec/scan-view/Resources/.svn
+
+            ln -s ${sub_prefix}/libexec/scan-build/scan-build ${destroot}${sub_prefix}/bin/scan-build
+            ln -s ${sub_prefix}/libexec/scan-view/scan-view ${destroot}${sub_prefix}/bin/scan-view
+            ln -s ${sub_prefix}/bin ${destroot}${sub_prefix}/libexec/scan-build/bin
+
+            xinstall -m 755 "${filespath}/llvm-bin" "${destroot}${prefix}/bin/scan-build-${suffix}"
+            reinplace "s:EXEC_PATH:${sub_prefix}/bin/scan-build:" "${destroot}${prefix}/bin/scan-build-${suffix}"
+
+            xinstall -m 755 "${filespath}/llvm-bin" "${destroot}${prefix}/bin/scan-view-${suffix}"
+            reinplace "s:EXEC_PATH:${sub_prefix}/bin/scan-view:" "${destroot}${prefix}/bin/scan-view-${suffix}"
+        }
+    }
+}

Added: trunk/dports/lang/llvm-2.9/files/install_target.patch
===================================================================
--- trunk/dports/lang/llvm-2.9/files/install_target.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-2.9/files/install_target.patch	2012-09-10 05:42:50 UTC (rev 97621)
@@ -0,0 +1,14 @@
+--- a/Makefile.orig	2012-01-22 19:39:46.000000000 -0800
++++ b/Makefile	2012-01-22 19:40:29.000000000 -0800
+@@ -68,8 +68,9 @@ endif
+ 
+ ifeq ($(MAKECMDGOALS),install-clang)
+   DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
+-          tools/clang/runtime tools/clang/docs \
+-          tools/lto
++          tools/clang/tools/libclang tools/clang/tools/c-index-test \
++          tools/clang/include/clang-c \
++          tools/clang/runtime tools/clang/docs
+   OPTIONAL_DIRS :=
+   NO_INSTALL = 1
+ endif

Added: trunk/dports/lang/llvm-2.9/files/mp-clang-2.9
===================================================================
--- trunk/dports/lang/llvm-2.9/files/mp-clang-2.9	                        (rev 0)
+++ trunk/dports/lang/llvm-2.9/files/mp-clang-2.9	2012-09-10 05:42:50 UTC (rev 97621)
@@ -0,0 +1,5 @@
+-
+bin/clang++-mp-2.9
+bin/clang-mp-2.9
+bin/scan-build-mp-2.9
+bin/scan-view-mp-2.9

Added: trunk/dports/lang/llvm-2.9/files/scan-build-PR-35006.patch
===================================================================
--- trunk/dports/lang/llvm-2.9/files/scan-build-PR-35006.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-2.9/files/scan-build-PR-35006.patch	2012-09-10 05:42:50 UTC (rev 97621)
@@ -0,0 +1,11 @@
+--- a/tools/clang/tools/scan-build/scan-build.orig	2012-07-12 09:47:19.000000000 -0700
++++ b/tools/clang/tools/scan-build/scan-build	2012-07-12 09:49:15.000000000 -0700
+@@ -1399,6 +1399,8 @@ if (defined $OutputFormat) {
+       Diag "Analysis run complete.\n";
+       Diag "Viewing analysis results in '$HtmlDir' using scan-view.\n";
+       my $ScanView = Cwd::realpath("$RealBin/scan-view");
++      if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/bin/scan-view"); }
++      if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/../scan-view/scan-view"); }
+       if (! -x $ScanView) { $ScanView = "scan-view"; }
+       exec $ScanView, "$HtmlDir";
+     }

Added: trunk/dports/lang/llvm-2.9/files/tiger-shlib-clang.patch
===================================================================
--- trunk/dports/lang/llvm-2.9/files/tiger-shlib-clang.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-2.9/files/tiger-shlib-clang.patch	2012-09-10 05:42:50 UTC (rev 97621)
@@ -0,0 +1,16 @@
+--- llvm-3.0.src.orig/tools/clang/tools/libclang/Makefile	2011-07-09 14:35:58.000000000 -0700
++++ llvm-3.0.src/tools/clang/tools/libclang/Makefile	2012-04-20 10:09:40.000000000 -0700
+@@ -38,9 +38,11 @@ ifeq ($(HOST_OS),Darwin)
+     # Extra options to override libtool defaults.
+     LLVMLibsOptions += -Wl,-dead_strip -Wl,-seg1addr,0xE0000000 
+ 
+-    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
+     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
+-    ifneq ($(DARWIN_VERS),8)
++    ifeq ($(DARWIN_VERS),8)
++       LLVMLibsOptions += -Wl,-install_name \
++                          -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
++    else
+        LLVMLibsOptions += -Wl,-install_name \
+                           -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
+     endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120909/04132bd8/attachment.html>


More information about the macports-changes mailing list