aboutsummaryrefslogtreecommitdiff
path: root/development/llvm/llvm.build
blob: 9995b3264f2ee1a47ce7047eb69f948c811960d7 (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
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=llvm
VERSION=3.3
BUILD=1
DEPENDS=('libraries >= 20130606-1')

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: llvm (The Low Level Virtual Machine)
${NAME}:
${NAME}: LLVM is a compiler infrastructure designed for compile-time,
${NAME}: link-time, runtime, and idle-time optimization of programs from
${NAME}: arbitrary programming languages.
${NAME}:
${NAME}: This package includes 'clang', a C, C++, Objective C and Objective
${NAME}: C++ frontend for the LLVM compiler.
${NAME}:
${NAME}: Homepage: http://llvm.org
${NAME}:
EOF

PYTHONSITEDIR="${SYS_DIR[lib]}/python2.7/site-packages"

# Sources

SRCNAME[0]=cfe
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://llvm.org/releases/${SRCNAME[0]}-${SRCVERS[0]}.src.tar.gz
SRCROOT[0]=${NAME}-${VERSION}.src
SRCOPTS[0]="nosrcroot"

build0()
{
  install.dir tools
  mv cfe-${VERSION}.src tools/clang
}

SRCNAME[1]=compiler-rt
SRCVERS[1]=${VERSION}
SRCPACK[1]=http://llvm.org/releases/${SRCNAME[1]}-${SRCVERS[1]}.src.tar.gz
SRCROOT[1]=${NAME}-${VERSION}.src
SRCOPTS[1]="nosrcroot"

build1()
{
  install.dir projects
  mv compiler-rt-${VERSION}.src projects/compiler-rt
}

SRCNAME[2]=${NAME}
SRCVERS[2]=${VERSION}
SRCPACK[2]=http://llvm.org/releases/${SRCNAME[2]}-${SRCVERS[2]}.src.tar.gz
SRCROOT[2]=${NAME}-${VERSION}.src

build2()
{
# Fix insecure rpath
sed -i 's|$(RPATH) -Wl,$(\(ToolDir\|LibDir\|ExmplDir\))||g' Makefile.rules
#FIXME: convert to CMake one of these days
CPPFLAGS="$(pkg-config --cflags libffi)" \
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --disable-expensive-checks \
 --disable-debug-runtime \
 --disable-assertions \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}" \
 --with-binutils-include="${SYS_DIR[usr]}/include" \
 --with-udis86="${SYS_DIR[usr]}" \
 --with-python="${SYS_DIR[bin]}/python2" \
 --disable-docs \
 --disable-expensive-checks \
 --disable-debug-runtime \
 --disable-assertions \
 --enable-experimental-targets="R600" \
 --enable-shared \
 --enable-optimized \
 --enable-libffi \
 --enable-bindings=none \
 --enable-targets=all
make ${JOBS} VERBOSE=1 REQUIRES_RTTI=1
make install DESTDIR="${PKG}"
doc CREDITS.TXT
license LICENSE.TXT
# GCC headers
(
  cd ${PKG}${SYS_DIR[lib]}/clang/${SRCVERS[2]}
  ln -s ${SYS_DIR[lib]}64/gcc/x86_64-slackware-linux/4.8.0/include
  ln -s ${SYS_DIR[lib]}64/gcc/x86_64-slackware-linux/4.8.0/include-fixed
)
# LTO
#FIXME: lib64
install.dir ${PKG}${SYS_DIR[lib]}64/bfd-plugins
(
  cd ${PKG}${SYS_DIR[lib]}64/bfd-plugins
  ln -sf ${SYS_DIR[lib]}/LLVMgold.so
)
#FIXME Where is LLVMgold.so?
# Clean up cruft
rm -f \
 ${PKG}${SYS_DIR[lib]}/*LLVMHello.* \
 ${PKG}${SYS_DIR[html]}
chmod -x ${PKG}${SYS_DIR[lib]}/*.a
#FIXME: this should end up in a subpackage
# Install also the clang-analyzer
install.dir ${PKG}${PYTHONSITEDIR}/clang-analyzer
for f in scan-{build,view}; do
  cp -r tools/clang/tools/${f} ${PKG}${PYTHONSITEDIR}/clang-analyzer
  ln -s ${PYTHONSITEDIR}/clang-analyzer/${f}/${f} ${PKG}${SYS_DIR[bin]}/${f}
done
install.dir ${PKG}${SYS_DIR[man]}/man1
install.man tools/clang/tools/scan-build/scan-build.1 ${PKG}${SYS_DIR[man]}/man1
rm -f ${PKG}${PYTHONSITEDIR}/clang-analyzer/scan-build/scan-build.{1,bat}
(
  cd ${PKG}${PYTHONSITEDIR}/clang-analyzer/scan-build
  ln -sf ${SYS_DIR[bin]}/clang
)
# Use Python 2
sed -i \
 -e 's|env python$|&2|' \
 -e 's|/usr/bin/python$|&2|' \
 "${PKG}${PYTHONSITEDIR}/clang-analyzer/scan-view/scan-view" \
 "${PKG}${PYTHONSITEDIR}/clang-analyzer/scan-build/set-xcode-analyzer"
# Compile Python scripts
python2 -m compileall "${PKG}${PYTHONSITEDIR}/clang-analyzer"
python2 -O -m compileall "${PKG}${PYTHONSITEDIR}/clang-analyzer"
}