forked from alisw/alidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clang.sh
58 lines (52 loc) · 1.82 KB
/
clang.sh
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
package: Clang
version: "3.9"
source: https://github.com/alisw/clang
tag: master
build_requires:
- CMake
---
#!/bin/sh
# Unsetting default compiler flags in order to make sure that no debug
# information is compiled into the objects which make the build artifacts very
# big
unset CXXFLAGS
unset CFLAGS
# note that BUILD_SHARED_LIBS=ON IS NEEDED FOR ADDING DYNAMIC PLUGINS
# to clang-tidy (for instance)
cmake $SOURCEDIR \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALLROOT" \
-DLLVM_INSTALL_UTILS=ON \
-DBUILD_SHARED_LIBS=ON
make ${JOBS+-j $JOBS}
make install
case $ARCHITECTURE in
osx*)
ln -sf /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++ $INSTALLROOT/include
;;
esac
FIND_EXEC='-executable'
mkdir findtest && touch x && chmod 0777 x
find findtest -type f $FIND_EXEC &> /dev/null || FIND_EXEC='-perm +011'
rm -rf findtest
find $SOURCEDIR/tools/clang/tools/scan-build -type f $FIND_EXEC -exec cp {} $INSTALLROOT/bin \;
find $SOURCEDIR/tools/clang/tools/scan-view -type f $FIND_EXEC -exec cp {} $INSTALLROOT/bin \;
# Modulefile
mkdir -p etc/modulefiles
cat > etc/modulefiles/$PKGNAME <<EoF
#%Module1.0
proc ModulesHelp { } {
global version
puts stderr "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
}
set version $PKGVERSION-@@PKGREVISION@$PKGHASH@@
module-whatis "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
# Dependencies
module load BASE/1.0
# Our environment
setenv CLANG_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
prepend-path PATH \$::env(CLANG_ROOT)/bin
prepend-path LD_LIBRARY_PATH \$::env(CLANG_ROOT)/lib
$([[ ${ARCHITECTURE:0:3} == osx ]] && echo "prepend-path DYLD_LIBRARY_PATH \$::env(CLANG_ROOT)/lib")
EoF
mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles