Ticket #40615: macports_clang-format-v2.patch

File macports_clang-format-v2.patch, 9.5 KB (added by hahn.seb@…, 11 years ago)
  • dports/lang/llvm-3.4/Portfile

    diff --git a/dports/lang/llvm-3.4/Portfile b/dports/lang/llvm-3.4/Portfile
    index 3d66538..1b9e51e 100644
    a b if {${subport} == "llvm-${llvm_version}"} { 
    4343                        library to parse C/C++ code.
    4444
    4545    depends_lib         port:llvm-${llvm_version} port:libffi
    46     depends_run         port:clang_select port:ld64
     46    depends_run         port:clang_select port:ld64 port:python27
    4747    depends_extract     bin:svn:subversion
    4848    depends_skip_archcheck-append ld64 subversion
    4949
    patchfiles install_target.patch \ 
    102102patch.pre_args  -p1
    103103
    104104if {${subport} == "clang-${llvm_version}"} {
    105     patchfiles-append    tiger-shlib-clang.patch tiger-libclang.patch scan-build-PR-35006.patch \
    106                          0001-Comment-out-SL-cctools-workaround.patch
    107 
     105    patchfiles-append   tiger-shlib-clang.patch tiger-libclang.patch scan-build-PR-35006.patch \
     106                        0001-Comment-out-SL-cctools-workaround.patch \
     107                        install_clang-format.patch clang-format_executable_bbedit.patch \
     108                        clang-format_executable_diff.patch clang-format_executable_el.patch \
     109                        clang-format_executable_py.patch clang-format_executable_sublime.patch
    108110    build.target        clang-only
    109111    destroot.target     install-clang
    110112}
    if {${subport} == "llvm-${llvm_version}"} { 
    313315       default_variants-append +arm_runtime
    314316    }
    315317
    316     set pythonver ""
    317     set pythonverdot ""
    318 
    319     if {![variant_isset python25] && ![variant_isset python26]} {
    320         default_variants-append +python27
    321     }
    322 
    323     variant python25 conflicts python26 python27 description {Use python 2.5} {
    324         set pythonver 25
    325         set pythonverdot 2.5
    326         configure.args-append --with-python=${prefix}/bin/python2.5
    327     }
    328 
    329     variant python26 conflicts python25 python27 description {Use python 2.6} {
    330         set pythonver 26
    331         set pythonverdot 2.6
    332         configure.args-append --with-python=${prefix}/bin/python2.6
    333     }
    334 
    335     variant python27 conflicts python25 python26 description {Use python 2.7} {
    336         set pythonver 27
    337         set pythonverdot 2.7
    338         configure.args-append --with-python=${prefix}/bin/python2.7
    339     }
    340 
    341318    variant analyzer description {Install clang static analyzer} {
    342         if {[string equal "${pythonver}" ""]} {
    343             ui_error "You mush select a python variant to use the clang static analyzer (+analyzer)"
    344             error "Invalid variant combination"
    345         }
    346319
    347         depends_run-append port:perl5 port:python${pythonver}
     320        depends_run-append port:perl5
    348321
    349322        post-patch {
    350323            reinplace "s|/usr/bin/env perl|${prefix}/bin/perl5|g" \
    351324                ${worksrcpath}/tools/clang/tools/scan-build/ccc-analyzer \
    352325                ${worksrcpath}/tools/clang/tools/scan-build/c++-analyzer \
    353326                ${worksrcpath}/tools/clang/tools/scan-build/scan-build
    354             reinplace "s|/usr/bin/env python|${prefix}/bin/python${pythonverdot}|g" \
     327            reinplace "s|/usr/bin/env python|${prefix}/bin/python2.7|g" \
    355328                ${worksrcpath}/tools/clang/tools/scan-build/set-xcode-analyzer \
    356329                ${worksrcpath}/tools/clang/tools/scan-view/scan-view
    357330        }
    if {${subport} == "llvm-${llvm_version}"} { 
    376349            reinplace "s:EXEC_PATH:${sub_prefix}/bin/scan-view:" "${destroot}${prefix}/bin/scan-view-${suffix}"
    377350        }
    378351    }
     352
     353
     354    post-patch {
     355        reinplace "s|@CLANG_FORMAT_PATH@|${prefix}/bin/clang-format-${suffix}|g" \
     356            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-bbedit.applescript \
     357            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-diff.py            \
     358            ${worksrcpath}/tools/clang/tools/clang-format/clang-format-sublime.py         \
     359            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.el                 \
     360            ${worksrcpath}/tools/clang/tools/clang-format/clang-format.py
     361    }
     362
     363    post-destroot {
     364        file mkdir ${destroot}${sub_prefix}/libexec
     365        file copy ${worksrcpath}/tools/clang/tools/clang-format ${destroot}${sub_prefix}/libexec/clang-format
     366
     367        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/.svn
     368        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/Makefile
     369        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/Release+Debug+Asserts
     370        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/CMakeLists.txt
     371        file delete -force ${destroot}${sub_prefix}/libexec/clang-format/ClangFormat.cpp
     372    }
    379373}
    380374
    381375livecheck.type          none
  • new file dports/lang/llvm-3.4/files/clang-format_executable_bbedit.patch

    diff --git a/dports/lang/llvm-3.4/files/clang-format_executable_bbedit.patch b/dports/lang/llvm-3.4/files/clang-format_executable_bbedit.patch
    new file mode 100644
    index 0000000..970a65b
    - +  
     1--- a/tools/clang/tools/clang-format/clang-format-bbedit.applescript    2011-07-09 14:35:58.000000000 -0700
     2+++ b/tools/clang/tools/clang-format/clang-format-bbedit.applescript    2012-04-20 10:09:40.000000000 -0700
     3@@ -15,7 +15,7 @@ ifeq ($(HOST_OS),Darwin)
     4 end tell
     5 
     6 set filePath to urlToPOSIXPath(fileURL)
     7-set newContents to do shell script "/path/to/clang-format -offset=" & selectionOffset & " -length=" & selectionLength & " " & quoted form of filePath
     8+set newContents to do shell script "@CLANG_FORMAT_PATH@ -offset=" & selectionOffset & " -length=" & selectionLength & " " & quoted form of filePath
     9 
     10 tell application "BBEdit"
     11        -- "set contents of text document 1 to newContents" scrolls to the bottom while
  • new file dports/lang/llvm-3.4/files/clang-format_executable_diff.patch

    diff --git a/dports/lang/llvm-3.4/files/clang-format_executable_diff.patch b/dports/lang/llvm-3.4/files/clang-format_executable_diff.patch
    new file mode 100644
    index 0000000..4f9daba
    - +  
     1--- a/tools/clang/tools/clang-format/clang-format-diff.py       2011-07-09 14:35:58.000000000 -0700
     2+++ b/tools/clang/tools/clang-format/clang-format-diff.py       2012-04-20 10:09:40.000000000 -0700
     3@@ -15,7 +15,7 @@ ifeq ($(HOST_OS),Darwin)
     4 
     5 
     6 # Change this to the full path if clang-format is not on the path.
     7-binary = 'clang-format'
     8+binary = '@CLANG_FORMAT_PATH@'
     9 
     10 
     11 def main():
     12 
  • new file dports/lang/llvm-3.4/files/clang-format_executable_el.patch

    diff --git a/dports/lang/llvm-3.4/files/clang-format_executable_el.patch b/dports/lang/llvm-3.4/files/clang-format_executable_el.patch
    new file mode 100644
    index 0000000..789c0f5
    - +  
     1--- a/tools/clang/tools/clang-format/clang-format.el    2011-07-09 14:35:58.000000000 -0700
     2+++ b/tools/clang/tools/clang-format/clang-format.el    2012-04-20 10:09:40.000000000 -0700
     3@@ -13,7 +13,7 @@ ifeq ($(HOST_OS),Darwin)
     4 
     5 ;; *Location of the clang-format binary. If it is on your PATH, a full path name
     6 ;; need not be specified.
     7-(defvar clang-format-binary "clang-format")
     8+(defvar clang-format-binary "@CLANG_FORMAT_PATH@")
     9 
     10 (defun clang-format-region ()
     11   "Use clang-format to format the currently active region."
  • new file dports/lang/llvm-3.4/files/clang-format_executable_py.patch

    diff --git a/dports/lang/llvm-3.4/files/clang-format_executable_py.patch b/dports/lang/llvm-3.4/files/clang-format_executable_py.patch
    new file mode 100644
    index 0000000..c59c3c2
    - +  
     1--- a/tools/clang/tools/clang-format/clang-format.py    2011-07-09 14:35:58.000000000 -0700
     2+++ b/tools/clang/tools/clang-format/clang-format.py    2012-04-20 10:09:40.000000000 -0700
     3@@ -24,7 +24,7 @@ ifeq ($(HOST_OS),Darwin)
     4 import vim
     5 
     6 # Change this to the full path if clang-format is not on the path.
     7-binary = 'clang-format'
     8+binary = '@CLANG_FORMAT_PATH@'
     9 
     10 # Change this to format according to other formatting styles. See the output of
     11 # 'clang-format --help' for a list of supported styles. The default looks for
     12 
  • new file dports/lang/llvm-3.4/files/clang-format_executable_sublime.patch

    diff --git a/dports/lang/llvm-3.4/files/clang-format_executable_sublime.patch b/dports/lang/llvm-3.4/files/clang-format_executable_sublime.patch
    new file mode 100644
    index 0000000..d244ec1
    - +  
     1--- a/tools/clang/tools/clang-format/clang-format-sublime.py2011-07-09 14:35:58.000000000 -0700
     2+++ b/tools/clang/tools/clang-format/clang-format-sublime.py    2012-04-20 10:09:40.000000000 -0700
     3@@ -18,7 +18,7 @@ ifeq ($(HOST_OS),Darwin)
     4 import subprocess
     5 
     6 # Change this to the full path if clang-format is not on the path.
     7-binary = 'clang-format'
     8+binary = '@CLANG_FORMAT_PATH@'
     9 
     10 # Change this to format according to other formatting styles. See the output of
     11 # 'clang-format --help' for a list of supported styles. The default looks for
  • new file dports/lang/llvm-3.4/files/install_clang-format.patch

    diff --git a/dports/lang/llvm-3.4/files/install_clang-format.patch b/dports/lang/llvm-3.4/files/install_clang-format.patch
    new file mode 100644
    index 0000000..8acb66d
    - +  
     1--- a/Makefile  2013-10-02 08:42:23.000000000 -0700
     2+++ b/Makefile  2013-10-24 10:57:33.000000000 -0700
     3@@ -70,8 +70,9 @@ ifeq ($(MAKECMDGOALS),install-clang)
     4   DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
     5           tools/clang/tools/libclang \
     6           tools/clang/tools/c-index-test \
     7           tools/clang/runtime tools/clang/docs \
     8-          tools/clang/include tools/clang/lib
     9+          tools/clang/include tools/clang/lib \
     10+          tools/clang/tools/clang-format
     11   OPTIONAL_DIRS :=
     12   NO_INSTALL = 1
     13 endif