Contents of /branches/R11-stable/core/llvm/llvm-3.1-r5.smage2
Parent Directory | Revision Log
Revision 16371 -
(show annotations)
(download)
Fri Feb 1 20:54:02 2013 UTC (11 years, 4 months ago) by niro
File size: 4260 byte(s)
Fri Feb 1 20:54:02 2013 UTC (11 years, 4 months ago) by niro
File size: 4260 byte(s)
-release branches/R11-stable
1 | # $Id$ |
2 | |
3 | PNAME="llvm" |
4 | PVER="3.1" |
5 | PBUILD="r5" |
6 | |
7 | PCAT="sys-dev" |
8 | |
9 | DESCRIPTION="The Low Level Virtual Machine." |
10 | HOMEPAGE="http://llvm.org/" |
11 | |
12 | DEPEND_x86_64=">= sys-apps/multiarch-wrapper-1" |
13 | SPECIAL_VARS="DEPEND_x86_64" |
14 | |
15 | DEPEND="$(marchdepend) |
16 | >= dev-lang/perl-5.16 |
17 | >= dev-libs/libffi-3 |
18 | >= sys-libs/libstdc++-4.7" |
19 | |
20 | SDEPEND=">= dev-util/pkgconfig-0.25 |
21 | >= sys-dev/bison-2.5 |
22 | >= sys-dev/flex-2.3.35 |
23 | >= sys-dev/make-3.82 |
24 | >= sys-dev/gcc-4.7 |
25 | >= sys-dev/binutils-2.23" |
26 | |
27 | SRCFILE="${PNAME}-${PVER}.src.tar.gz" |
28 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}.src" |
29 | |
30 | sminclude mtools multilib |
31 | msetfeature "!check" |
32 | |
33 | SRC_URI=( |
34 | http://llvm.org/releases/${PVER}/${SRCFILE} |
35 | mirror://${PNAME}/${SRCFILE} |
36 | mirror://${PNAME}/${PNAME}-2.9-no-docs.patch |
37 | mirror://${PNAME}/${PNAME}-3.2-fix-debug-line-info.patch |
38 | ) |
39 | |
40 | UP2DATE="updatecmd ${HOMEPAGE} | grep 'Download now' | sed 's:.*][lL][lL][vV][mM]\ \(.*\):\1:'" |
41 | |
42 | src_prepare() |
43 | { |
44 | munpack ${SRCFILE} || die |
45 | |
46 | # fix symbolic links from OCaml bindings to LLVM libraries |
47 | all-abis 'sed -i "s:\$(PROJ_libdir):/usr/$(mlibdir)/llvm:" bindings/ocaml/Makefile.ocaml || die' |
48 | |
49 | # non-standard configure, fix config pathes and cflags |
50 | all-abis 'sed -i -e "s:\$(PROJ_prefix)/etc/llvm:/etc/llvm:" |
51 | -e "s:\$(PROJ_prefix)/lib:\$(PROJ_prefix)/$(mlibdir)/llvm:" |
52 | -e "s:\$(PROJ_prefix)/docs/llvm:\$(PROJ_prefix)/share/doc/${PNAME}-${PVER}:" |
53 | Makefile.config.in || die' |
54 | all-abis 'sed -i "/ActiveLibDir = ActivePrefix/s:lib:$(mlibdir)/llvm:" tools/llvm-config/llvm-config.cpp || die' |
55 | all-abis 'sed -i "s:LLVM_LIBDIR=\"\${prefix}/lib\":LLVM_LIBDIR=\"\${prefix}/$(mlibdir)/llvm\":" autoconf/configure.ac configure || die' |
56 | |
57 | # remove insecure rpath |
58 | all-abis 'sed -i "s:\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\|ExmplDir\))::g" Makefile.rules || die' |
59 | |
60 | # fix gold |
61 | all-abis 'sed -i "s:\$(SharedLibDir):/usr/$(mlibdir)/llvm:" tools/gold/Makefile || die' |
62 | |
63 | # ugly hack - fix broken path retrieval on magellan - fixme! |
64 | all-abis 'sed -i "s:CurrentPath(GetExecutablePath(argv\[0\]).str()):CurrentPath(\"/usr/bin/llvm-config\"):" tools/llvm-config/llvm-config.cpp || die' |
65 | |
66 | # do not generate docs, which are just the man pages |
67 | mpatch ${PNAME}-2.9-no-docs.patch || die |
68 | |
69 | # fix invalid debug information |
70 | mpatch ${PNAME}-3.2-fix-debug-line-info.patch || die |
71 | } |
72 | |
73 | src_compile() |
74 | { |
75 | local myopts |
76 | |
77 | # enable pic on 64bit arches |
78 | [[ ${ARCH} = x86_64 ]] && myopts+="--enable-pic" |
79 | |
80 | # be multilib friendly |
81 | [[ $(mlibdir) != lib ]] && myopts+=" --with-cxx-include-32bit-dir=32" |
82 | |
83 | # include location of libffi headers |
84 | export CPPFLAGS="${CPPFLAGS} $(pkg-config --cflags libffi)" |
85 | |
86 | # force use of gcc instead of clang if already installed |
87 | CC=$(mabi-cc) CXX=$(mabi-cxx) \ |
88 | mconfigure \ |
89 | --libdir=/usr/$(mlibdir)/llvm \ |
90 | --enable-shared \ |
91 | --disable-expensive-checks \ |
92 | --disable-debug-runtime \ |
93 | --disable-assertions \ |
94 | --enable-optimized \ |
95 | --enable-libffi \ |
96 | --enable-targets=all \ |
97 | --enable-bindings=none \ |
98 | ${myopts} \ |
99 | || die |
100 | |
101 | mmake VERBOSE=1 REQUIRES_RTTI=1 || die |
102 | } |
103 | |
104 | src_install() |
105 | { |
106 | mmake DESTDIR=${BINDIR} install || die |
107 | |
108 | # be multilib friendly |
109 | if [[ $(mlibdir) != lib ]] |
110 | then |
111 | if [[ -f ${BINDIR}/usr/bin/llvm-config ]] |
112 | then |
113 | rm ${BINDIR}/usr/bin/llvm-config || die |
114 | fi |
115 | all-abis minstallexec Release/bin/llvm-config /usr/bin/llvm-config-$(mabi) || die |
116 | mlink multiarch-wrapper /usr/bin/llvm-config || die |
117 | |
118 | if [[ -f ${BINDIR}/usr/include/llvm/Config/config.h ]] |
119 | then |
120 | rm ${BINDIR}/usr/include/llvm/Config/config.h || die |
121 | fi |
122 | all-abis minstallfile include/llvm/Config/config.h /usr/include/llvm/Config/config-$(mabi).h || die |
123 | cat > ${BINDIR}/usr/include/llvm/Config/config.h << EOF |
124 | #include <bits/wordsize.h> |
125 | |
126 | #if __WORDSIZE == 32 |
127 | #include "config-m32.h" |
128 | #elif __WORDSIZE == 64 |
129 | #include "config-m64.h" |
130 | #else |
131 | #error "Unknown word size" |
132 | #endif |
133 | EOF |
134 | |
135 | if [[ -f ${BINDIR}/usr/include/llvm/Config/llvm-config.h ]] |
136 | then |
137 | rm ${BINDIR}/usr/include/llvm/Config/llvm-config.h || die |
138 | fi |
139 | all-abis minstallfile include/llvm/Config/llvm-config.h /usr/include/llvm/Config/llvm-config-$(mabi).h || die |
140 | cat > ${BINDIR}/usr/include/llvm/Config/llvm-config.h << EOF |
141 | #include <bits/wordsize.h> |
142 | |
143 | #if __WORDSIZE == 32 |
144 | #include "llvm-config-m32.h" |
145 | #elif __WORDSIZE == 64 |
146 | #include "llvm-config-m64.h" |
147 | #else |
148 | #error "Unknown word size" |
149 | #endif |
150 | EOF |
151 | fi |
152 | } |