summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0fc48cce4a30907fa5830d1bbc02a0093ae854b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# Maintainer: Tyler P. tyler274 <tyler274port@gmail.com> 
# Contributor: Luchesar V. ILIEV <luchesar%2eiliev%40gmail%2ecom>
# Contributor: Anders Bergh <anders@archlinuxppc.org>
# Contributor: Armin K. <krejzi at email dot com>
# Contributor: Christian Babeux <christian.babeux@0x80.ca>
# Contributor: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Hesiod (https://github.com/hesiod)
# Contributor: Roberto Alsina <ralsina@kde.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Tomas Lindquist Olsen <tomas@famolsen.dk>
# Contributor: Tomas Wilhelmsson <tomas.wilhelmsson@gmail.com>

pkgbase=llvm-polly-svn

pkgname=(
    'llvm-polly-svn'
    'llvm-libs-polly-svn'
    'llvm-ocaml-polly-svn'
    'lld-polly-svn'
    'lldb-polly-svn'
    'clang-polly-svn'
    'clang-analyzer-polly-svn'
    'clang-compiler-rt-polly-svn'
    'clang-tools-extra-polly-svn'
)
_pkgname='llvm'

pkgver=5.0.0svn_r308112

pkgver() {
  cd "$pkgname"
  local ver="$(svnversion)"
  printf "r%s" "${ver//[[:alpha:]]}"
}
pkgrel=1

arch=('i686' 'x86_64')
url='http://llvm.org/'
license=('custom:University of Illinois')

makedepends=(
    'cmake'
    'ninja'
    'libffi'
    'ocaml-ctypes'
    'ocaml-findlib'
    'python2'
    'python2-requests'
    'python2-sphinx'
    'subversion'
)

# this is always the latest svn so debug info can be useful
options=('staticlibs' '!strip')

source=(
    "${_pkgname}::svn+http://llvm.org/svn/llvm-project/llvm/trunk"
    'clang::svn+http://llvm.org/svn/llvm-project/cfe/trunk'
    'clang-tools-extra::svn+http://llvm.org/svn/llvm-project/clang-tools-extra/trunk'
    'compiler-rt::svn+http://llvm.org/svn/llvm-project/compiler-rt/trunk'
    'lld::svn+http://llvm.org/svn/llvm-project/lld/trunk'
    'lldb::svn+http://llvm.org/svn/llvm-project/lldb/trunk'
    'polly::svn+http://llvm.org/svn/llvm-project/polly/trunk'
    'llvm-Config-llvm-config.h'
)

sha256sums=(
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48'
)

#
# BEGIN INTERNAL VARIABLES AND FUNCTIONS
#

# Python site-packages dir (relative to ${pkgdir})
_py_sitepkg_dir="/usr/lib/python2.7/site-packages"

# Determine the installed OCaml package version
# Arguments: NONE
_ocamlver() {
    pacman -Q ocaml | awk '{ print $2 }' | cut -d - -f 1 | cut -d . -f 1,2,3
}

# Fix the Python interpreter path in .py files to point to python2
# Arguments: py_file_to_patch [py_file_to_patch ...]
_fix_python_exec_path() {
    sed -i \
        -e 's|^#!/usr/bin/python$|&2|' \
        -e 's|^#!/usr/bin/env python$|&2|' \
        ${@}
}

# Compile the Python files in a directory
# Arguments: directory_to_operate_on
_compile_python_files() {
    python2 -m compileall "${1}"
    python2 -O -m compileall "${1}"
}

# Install the Python bindings of a package
# Arguments: source_directory_to_install_from
_install_python_bindings() {
    install -m 0755 -d "${pkgdir}${_py_sitepkg_dir}"
    cp -r "${1}" "${pkgdir}${_py_sitepkg_dir}/"
    _compile_python_files "${pkgdir}${_py_sitepkg_dir}/${1##*/}"
}

# Install the license files for a package
# Arguments: source_directory_to_install_from
# Notes: We prune some directories that are inserted into the tree in prepare() 
#        in order to eliminate possible duplicates. We also use NULL-terminated
#        strings, just in case we have paths including spaces. Finally, we opt
#        for a flat directory structure, so all license files in subdirectories
#        get their names from the relative path with '/'s replaced by dashes.
#        Not the most elegant solution, but should be working well enough.
_install_licenses() {
    find "${1}" \
        \( \
            -path "${srcdir}/${_pkgname}/tools/lld" -o \
            -path "${srcdir}/${_pkgname}/tools/clang" -o \
            -path "${srcdir}/${_pkgname}/tools/lldb" -o \
            -path "${srcdir}/${_pkgname}/tools/polly" -o \
            -path "${srcdir}/${_pkgname}/projects/compiler-rt" \
        \) -prune -o \
        \( \
            -iname 'license*' -o \
            -iname 'credits*' -o \
            -iname 'copyright*' \
        \) -printf '%P\0' \
        | while read -d $'\0' license_file; do
            install -D -m 0644 \
                "${1}/${license_file}" \
                "${pkgdir}/usr/share/licenses/${pkgname}/${license_file//\//-}"
        done
}

#
# END INTERNAL VARIABLES AND FUNCTIONS
#

pkgver() {
    cd "${srcdir}/${_pkgname}"

    # This will almost match the output of `llvm-config --version` when the
    # LLVM_APPEND_VC_REV cmake flag is turned on. The only difference is
    # dash being replaced with underscore because of Pacman requirements.
    echo $(awk -F 'MAJOR |MINOR |PATCH |SUFFIX |)' \
            'BEGIN { ORS="." ; i=0 } \
             /set\(LLVM_VERSION_/ { print $2 ; i++ ; if (i==2) ORS="" } \
             END { print "\n" }' \
        CMakeLists.txt)_r$(svnversion | tr -d [A-z])
}

prepare() {
    cd "${srcdir}/${_pkgname}"

    # Anything added here and packaged separately should be pruned in _install_licenses() above.
    svn export --force "${srcdir}/clang" tools/clang
    svn export --force "${srcdir}/clang-tools-extra" tools/clang/tools/extra
    svn export --force "${srcdir}/compiler-rt" projects/compiler-rt
    svn export --force "${srcdir}/lld" tools/lld
    svn export --force "${srcdir}/lldb" tools/lldb
    svn export --force "${srcdir}/polly" tools/polly

    mkdir -p "${srcdir}/build"
}

build() {
    cd "${srcdir}/build"

    # Building with any already installed on the system LLVM OCaml bindings is very error-prone.
    # The problems almost certainly arise from incompatibilities between the installed system-wide
    # bindings and the newly built ones. Unfortunately, the OCAMLPATH environment variable doesn't
    # allow overriding the search path set in the system configuration file, only adding to it.
    # Even same version bindings cause problems in certain circumstances, so let's play safe.
    ocamlfind query llvm >/dev/null 2>&1 && {
        error 'Incompatible LLVM OCaml bindings installed.'
        plain 'Building with already installed on the system LLVM OCaml bindings is not supported.'
        plain 'Please either uninstall any currently installed llvm-ocaml* package before building,'
        plain 'or, __preferably__, build in a clean chroot, as described on the Arch Linux wiki:'
        plain 'https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot'
        exit 1
    }

    export PKG_CONFIG_PATH='/usr/lib/pkgconfig'

    # LLVM_BUILD_LLVM_DYLIB: Build the dynamic runtime libraries (e.g. libLLVM.so).
    # LLVM_LINK_LLVM_DYLIB:  Link our own tools against the libLLVM dynamic library, too.
    # LLVM_BINUTILS_INCDIR:  Set to binutils' plugin-api.h location in order to build LLVMgold.
    # cmake -G 'Unix Makefiles' \
    #     -DCMAKE_BUILD_TYPE:STRING=Release \
    #     -DCMAKE_INSTALL_PREFIX:PATH=/usr \
    #     -DLLVM_APPEND_VC_REV:BOOL=ON \
    #     -DLLVM_ENABLE_RTTI:BOOL=ON \
    #     -DLLVM_ENABLE_FFI:BOOL=ON \
    #     -DFFI_INCLUDE_DIR:PATH="$(pkg-config --variable=includedir libffi)" \
    #     -DFFI_LIBRARY_DIR:PATH="$(pkg-config --variable=libdir libffi)" \
    #     -DLLVM_BUILD_DOCS:BOOL=ON \
    #     -DLLVM_ENABLE_SPHINX:BOOL=ON \
    #     -DSPHINX_OUTPUT_HTML:BOOL=ON \
    #     -DSPHINX_OUTPUT_MAN:BOOL=ON \
    #     -DSPHINX_WARNINGS_AS_ERRORS:BOOL=OFF \
    #     -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
    #     -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
    #     -DLLVM_BINUTILS_INCDIR:PATH=/usr/include \
    #     "../${_pkgname}"
#        -DPGO_INSTRUMENT_LTO:BOOL=ON \
#        -C "../clang/cmake/caches/PGO.cmake" \
#	-DBOOTSTRAP_LLVM_ENABLE_LLD:BOOL=ON \

    cmake -G 'Unix Makefiles' \
        -DCMAKE_BUILD_TYPE:STRING=Release \
        -DCMAKE_INSTALL_PREFIX:PATH=/usr \
        -DLLVM_APPEND_VC_REV:BOOL=ON \
        -DLLVM_ENABLE_RTTI:BOOL=ON \
        -DLLVM_ENABLE_FFI:BOOL=ON \
        -DFFI_INCLUDE_DIR:PATH="$(pkg-config --variable=includedir libffi)" \
        -DFFI_LIBRARY_DIR:PATH="$(pkg-config --variable=libdir libffi)" \
        -DLLVM_BUILD_DOCS:BOOL=ON \
        -DLLVM_ENABLE_SPHINX:BOOL=ON \
        -DSPHINX_OUTPUT_HTML:BOOL=ON \
        -DSPHINX_OUTPUT_MAN:BOOL=ON \
        -DSPHINX_WARNINGS_AS_ERRORS:BOOL=OFF \
        -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
        -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
        -DLLVM_BINUTILS_INCDIR:PATH=/usr/include \
        -DLLVM_ENABLE_LTO=Thin \
        -DLLVM_PARALLEL_LINK_JOBS=1 \
	-DCMAKE_C_COMPILER="/usr/bin/clang" \
	-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
	-DCMAKE_RANLIB="/usr/bin/llvm-ranlib" \
	-DCMAKE_AR="/usr/bin/llvm-ar" \
	-DPOLLY_ENABLE_GPGPU_CODEGEN:BOOL=ON \
        -DLINK_POLLY_INTO_TOOLS:BOOL=ON \
        "../${_pkgname}"

    #ninja
    #ninja ocaml_doc
    make 
    make ocaml_doc
}

check() {
    cd "${srcdir}/build"
    # Dirty fix for unittests failing because the shared lib is not in the library path.
    # Also, disable the LLVM tests on i686 as they seem to fail too often there.
    [[ "${CARCH}" == "i686" ]] || LD_LIBRARY_PATH="${srcdir}/build/lib" make check
    
    #[[ "${CARCH}" == "i686" ]] || LD_LIBRARY_PATH="${srcdir}/build/lib" ninja check-llvm
    
    #ninja check-clang
    #ninja check-lld
    #ninja check-lldb
    #ninja check-polly
    make check-clang
    make check-polly
}

package_llvm-polly-svn() {
    pkgdesc='The LLVM Compiler Infrastructure'
    depends=(
        "llvm-libs-polly-svn=${pkgver}-${pkgrel}"
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('llvm', 'llvm-svn')
    conflicts=('llvm', 'llvm-svn')

    cd "${srcdir}/build"

    # Disable automatic installation of components that go into subpackages
    sed -i '/\(clang\|lld\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake

    make DESTDIR="${pkgdir}" install
    #DESTDIR="${pkgdir}" ninja install

    # The runtime libraries get installed in llvm-libs-svn
    rm -f "${pkgdir}"/usr/lib/lib{LLVM,LTO}{,-*}.so{,.*}
    mv -f "${pkgdir}"/usr/lib/{BugpointPasses,LLVMgold,LLVMHello}.so "${srcdir}/"

    # Clang libraries and OCaml bindings go to separate packages
    rm -rf "${srcdir}"/{clang,ocaml.{doc,lib}}
    mv "${pkgdir}/usr/lib/clang" "${srcdir}/clang"
    mv "${pkgdir}/usr/lib/ocaml" "${srcdir}/ocaml.lib"
    mv "${pkgdir}/usr/share/doc/llvm/ocaml-html" "${srcdir}/ocaml.doc"

    if [[ "${CARCH}" == "x86_64" ]]; then
        # Needed for multilib (https://bugs.archlinux.org/task/29951)
        # Header stubs are taken from Fedora
        mv "${pkgdir}/usr/include/llvm/Config/llvm-config"{,-64}.h
        cp "${srcdir}/llvm-Config-llvm-config.h" "${pkgdir}/usr/include/llvm/Config/llvm-config.h"
    fi

    # Clean up documentation
    # TODO: This may not be needed any more.
    rm -rf "${pkgdir}/usr/share/doc/llvm/html/_sources"

    _install_python_bindings "${srcdir}/llvm/bindings/python/llvm"

    _install_licenses "${srcdir}/llvm"
}

package_lldb-polly-svn() {
    pkgdesc='Next generation, high-performance debugger'
    url='http://lldb.llvm.org/'
    depends=(
        "llvm-libs-polly-svn=${pkgver}-${pkgrel}"
        'libedit'
        'libxml2'
        'python2'
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('lldb', 'lldb-svn')
    conflicts=('lldb', 'lldb-svn')

    #cd "${srcdir}/build"
    cd "${srcdir}/build/tools/lldb"

    #DESTDIR="${pkgdir}" ninja install-lldb
    make DESTDIR="${pkgdir}" install

    #cd "${srcdir}/build/tools/lldb"
    _fix_python_exec_path \
        "${pkgdir}${_py_sitepkg_dir}/lldb/utils/symbolication.py"

    _compile_python_files "${pkgdir}${_py_sitepkg_dir}/lldb"

    _install_licenses "${srcdir}/lldb"
}


package_llvm-libs-polly-svn() {
    pkgdesc='The LLVM Compiler Infrastructure (runtime libraries)'
    depends=(
        'libffi'
        'zlib'
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('llvm-libs', 'llvm-libs-svn')
    conflicts=('llvm-libs', 'llvm-libs-svn')

    cd "${srcdir}/build"

    #DESTDIR="${pkgdir}" ninja install-{LLVM,LTO}
    make DESTDIR="${pkgdir}" install-{LLVM,LTO}

    # Moved from the llvm-svn package here
    mv "${srcdir}"/{BugpointPasses,LLVMgold,LLVMHello}.so "${pkgdir}/usr/lib/"

    # Ref: http://llvm.org/docs/GoldPlugin.html
    install -m755 -d "${pkgdir}/usr/lib/bfd-plugins"
    ln -s {/usr/lib,"${pkgdir}/usr/lib/bfd-plugins"}/LLVMgold.so

    # Since r262066 lto.h is also installed, but we don't need it in the -libs package.
    rm -rf "${pkgdir}/usr/include"

    # Must have a symlink that corresponds to the output of `llvm-config --version`.
    # Without it, some builds, e.g. Mesa, might fail for "lack of shared libraries".
    _sover="$(echo ${pkgver} | cut -d . -f -2)svn"
    # libLLVM.so.3.8.0svn-r123456
    ln -s "libLLVM-${_sover}.so" "${pkgdir}/usr/lib/libLLVM.so.$(echo ${pkgver} | tr _ -)"
    # libLLVM-3.8.0svn-r123456.so
    ln -s "libLLVM-${_sover}.so" "${pkgdir}/usr/lib/libLLVM-$(echo ${pkgver} | tr _ -).so"

    _install_licenses "${srcdir}/llvm"
}

package_llvm-ocaml-polly-svn() {
    pkgdesc='OCaml bindings for LLVM'
    depends=(
        "llvm-polly-svn=${pkgver}-${pkgrel}"
        "ocaml=$(_ocamlver)"
        'ocaml-ctypes'
    )
    provides=('llvm-ocaml', 'llvm-ocaml-svn')
    conflicts=('llvm-ocaml', 'llvm-ocaml-svn')

    cd "${srcdir}/build"

    install -m755 -d "${pkgdir}/usr/lib"
    install -m755 -d "${pkgdir}/usr/share/doc/llvm"
    cp -a "${srcdir}/ocaml.lib" "${pkgdir}/usr/lib/ocaml"
    cp -a "${srcdir}/ocaml.doc" "${pkgdir}/usr/share/doc/llvm/ocaml-html"

    _install_licenses "${srcdir}/llvm"
}

package_lld-polly-svn() {
    pkgdesc='A linker from the LLVM project'
    depends=(
        "llvm-libs-polly-svn=${pkgver}-${pkgrel}"
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('lld', 'lld-svn')
    conflicts=('lld', 'lld-svn')

    #cd "${srcdir}/build"
    cd "${srcdir}/build/tools/lld"
	
    #DESTDIR="${pkgdir}" ninja install-lld
    make DESTDIR="${pkgdir}" install

    # Clean up documentation
    # TODO: This may at some point not be needed any more.
    rm -rf "${pkgdir}/usr/share/doc/lld/html/_sources"

    _install_licenses "${srcdir}/lld"
}

package_clang-polly-svn() {
    pkgdesc='C language family frontend for LLVM'
    url='http://clang.llvm.org/'
    depends=(
        "llvm-polly-svn=${pkgver}-${pkgrel}"
    )
    optdepends=(
        'clang-compiler-rt-polly-svn: sanitizer runtimes, builtins, profile library and BlocksRuntime with polly'
        'clang-tools-extra-polly-svn: standalone tools: syntax checking, formatting, refactoring, etc. with polly'
        'python2: git-clang-format and clang-format-diff.py support'
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('clang', 'clang-svn')
    conflicts=('clang', 'clang-svn')

    cd "${srcdir}/build/tools/clang"

    # Exclude the extra directory, since it'll be installed in a separate package
    sed -i \
        "s|^\([[:blank:]]*include(\"${srcdir}/build/tools/clang/tools/extra/cmake_install.cmake\")\)$|#\1|" \
        tools/cmake_install.cmake
    
    #cd "${srcdir}/build"
    #DESTDIR="${pkgdir}" ninja install-clang
    
    make DESTDIR="${pkgdir}" install

    # The Clang Static Analyzer is installed in a separate package
    # TODO: Probably there's more elegant way to achieve this.

    rm -rf "${srcdir}/clang-analyzer.tmp"

    install -m 0755 -d \
        "${srcdir}/clang-analyzer.tmp/usr/bin" \
        "${srcdir}/clang-analyzer.tmp/usr/share/man/man1" \
        "${srcdir}/clang-analyzer.tmp/usr/share/scan-build" \
        "${srcdir}/clang-analyzer.tmp/usr/share/scan-view"

    mv \
        "${pkgdir}/usr/bin/scan-build" \
        "${pkgdir}/usr/bin/scan-view" \
        "${pkgdir}/usr/libexec/c++-analyzer" \
        "${pkgdir}/usr/libexec/ccc-analyzer" \
        \
        "${srcdir}/clang-analyzer.tmp/usr/bin/"

    mv \
        "${pkgdir}/usr/share/man/man1/scan-build.1" \
        \
        "${srcdir}/clang-analyzer.tmp/usr/share/man/man1/"

    mv \
        "${pkgdir}/usr/share/scan-build/scanview.css" \
        "${pkgdir}/usr/share/scan-build/sorttable.js" \
        \
        "${srcdir}/clang-analyzer.tmp/usr/share/scan-build/"

    mv \
        "${pkgdir}/usr/share/scan-view/FileRadar.scpt" \
        "${pkgdir}/usr/share/scan-view/GetRadarVersion.scpt" \
        "${pkgdir}/usr/share/scan-view/Reporter.py" \
        "${pkgdir}/usr/share/scan-view/ScanView.py" \
        "${pkgdir}/usr/share/scan-view/bugcatcher.ico" \
        "${pkgdir}/usr/share/scan-view/startfile.py" \
        \
        "${srcdir}/clang-analyzer.tmp/usr/share/scan-view/"

    rmdir \
        "${pkgdir}/usr/libexec" \
        "${pkgdir}/usr/share/scan-build" \
        "${pkgdir}/usr/share/scan-view"

    # Clean up documentation
    # TODO: This may not be needed any more.
    rm -rf "${pkgdir}/usr/share/doc/clang/html/_sources"

    _fix_python_exec_path \
        "${pkgdir}/usr/bin/git-clang-format" \
        "${pkgdir}/usr/share/clang/clang-format-diff.py"

    _install_python_bindings "${srcdir}/llvm/tools/clang/bindings/python/clang"

    _install_licenses "${srcdir}/clang"
}

package_clang-analyzer-polly-svn() {
    pkgdesc='Source code analysis tool for Clang, supporting C, C++, and Objective-C'
    url='http://clang-analyzer.llvm.org/'
    depends=(
        "clang-polly-svn=${pkgver}-${pkgrel}"
        'perl'
        'python2'
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('clang-analyzer')
    conflicts=('clang-analyzer')

    cd "${srcdir}"

    mv "${srcdir}/clang-analyzer.tmp"/* "${pkgdir}"/

    sed -i 's|/libexec/|/bin/|' "${pkgdir}/usr/bin/scan-build"

    _fix_python_exec_path \
        "${pkgdir}/usr/bin/scan-view"

    _compile_python_files "${pkgdir}/usr/share/scan-view"

    _install_licenses "${srcdir}/clang"
}


package_clang-compiler-rt-polly-svn() {
    pkgdesc='The "compiler-rt" set of runtime libraries for Clang and LLVM'
    url='http://compiler-rt.llvm.org/'
    depends=(
        "clang-polly-svn=${pkgver}-${pkgrel}"
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('clang-compiler-rt', 'clang-compiler-rt-svn')
    conflicts=('clang-compiler-rt', 'clang-compiler-rt-svn')

    #cd "${srcdir}/build"

    #DESTDIR="${pkgdir}" ninja install-compiler-rt
    
    cd "${srcdir}/build/projects/compiler-rt"

    make DESTDIR="${pkgdir}" install
    
    _install_licenses "${srcdir}/compiler-rt"
}

package_clang-tools-extra-polly-svn() {
    pkgdesc='Standalone tools for Clang: syntax checking, formatting, refactoring, etc.'
    url='http://clang.llvm.org/docs/ClangTools.html'
    depends=(
        "clang-polly-svn=${pkgver}-${pkgrel}"
    )
    groups=('llvm-toolchain-polly-svn')
    provides=('clang-tools-extra', 'clang-tools-extra-svn')
    conflicts=('clang-tools-extra', 'clang-tools-extra-svn')

    #cd "${srcdir}/build"

    #DESTDIR="${pkgdir}" ninja install-clang-tidy
    #DESTDIR="${pkgdir}" ninja install-clang-format
    
    cd "${srcdir}/build/tools/clang/tools/extra"

    make DESTDIR="${pkgdir}" install
    
    _install_licenses "${srcdir}/clang-tools-extra"
}

# vim:set ts=4 sts=4 sw=4 et: