Contents of /smage/trunk/core/llvm/llvm-3.1-r4.smage2
Parent Directory | Revision Log
Revision 4322 -
(show annotations)
(download)
Wed Nov 14 16:31:38 2012 UTC (11 years, 10 months ago) by niro
File size: 4122 byte(s)
Wed Nov 14 16:31:38 2012 UTC (11 years, 10 months ago) by niro
File size: 4122 byte(s)
auto added: ver bump to 3.1-r4
1 | # $Id$ |
2 | |
3 | PNAME="llvm" |
4 | PVER="3.1" |
5 | PBUILD="r4" |
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 | ) |
38 | |
39 | UP2DATE="updatecmd ${HOMEPAGE} | grep 'Download now' | sed 's:.*][lL][lL][vV][mM]\ \(.*\):\1:'" |
40 | |
41 | src_prepare() |
42 | { |
43 | munpack ${SRCFILE} || die |
44 | |
45 | # fix symbolic links from OCaml bindings to LLVM libraries |
46 | all-abis 'sed -i "s:\$(PROJ_libdir):/usr/$(mlibdir)/llvm:" bindings/ocaml/Makefile.ocaml || die' |
47 | |
48 | # non-standard configure, fix config pathes and cflags |
49 | all-abis 'sed -i -e "s:\$(PROJ_prefix)/etc/llvm:/etc/llvm:" |
50 | -e "s:\$(PROJ_prefix)/lib:\$(PROJ_prefix)/$(mlibdir)/llvm:" |
51 | -e "s:\$(PROJ_prefix)/docs/llvm:\$(PROJ_prefix)/share/doc/${PNAME}-${PVER}:" |
52 | Makefile.config.in || die' |
53 | all-abis 'sed -i "/ActiveLibDir = ActivePrefix/s:lib:$(mlibdir)/llvm:" tools/llvm-config/llvm-config.cpp || die' |
54 | all-abis 'sed -i "s:LLVM_LIBDIR=\"\${prefix}/lib\":LLVM_LIBDIR=\"\${prefix}/$(mlibdir)/llvm\":" autoconf/configure.ac configure || die' |
55 | |
56 | # remove insecure rpath |
57 | all-abis 'sed -i "s:\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\|ExmplDir\))::g" Makefile.rules || die' |
58 | |
59 | # fix gold |
60 | all-abis 'sed -i "s:\$(SharedLibDir):/usr/$(mlibdir)/llvm:" tools/gold/Makefile || die' |
61 | |
62 | # ugly hack - fix broken path retrieval on magellan - fixme! |
63 | all-abis 'sed -i "s:CurrentPath(GetExecutablePath(argv\[0\]).str()):CurrentPath(\"/usr/bin/llvm-config\"):" tools/llvm-config/llvm-config.cpp || die' |
64 | |
65 | # do not generate docs, which are just the man pages |
66 | mpatch ${PNAME}-2.9-no-docs.patch || die |
67 | } |
68 | |
69 | src_compile() |
70 | { |
71 | local myopts |
72 | |
73 | # enable pic on 64bit arches |
74 | [[ ${ARCH} = x86_64 ]] && myopts+="--enable-pic" |
75 | |
76 | # be multilib friendly |
77 | [[ $(mlibdir) != lib ]] && myopts+=" --with-cxx-include-32bit-dir=32" |
78 | |
79 | # include location of libffi headers |
80 | export CPPFLAGS="${CPPFLAGS} $(pkg-config --cflags libffi)" |
81 | |
82 | # force use of gcc instead of clang if already installed |
83 | CC=$(mabi-cc) CXX=$(mabi-cxx) \ |
84 | mconfigure \ |
85 | --libdir=/usr/$(mlibdir)/llvm \ |
86 | --enable-shared \ |
87 | --disable-expensive-checks \ |
88 | --disable-debug-runtime \ |
89 | --disable-assertions \ |
90 | --enable-optimized \ |
91 | --enable-libffi \ |
92 | --enable-bindings=none \ |
93 | --enable-targets=all \ |
94 | ${myopts} \ |
95 | || die |
96 | |
97 | mmake VERBOSE=1 REQUIRES_RTTI=1 || die |
98 | } |
99 | |
100 | src_install() |
101 | { |
102 | mmake DESTDIR=${BINDIR} install || die |
103 | |
104 | # be multilib friendly |
105 | if [[ $(mlibdir) != lib ]] |
106 | then |
107 | if [[ -f ${BINDIR}/usr/bin/llvm-config ]] |
108 | then |
109 | rm ${BINDIR}/usr/bin/llvm-config || die |
110 | fi |
111 | all-abis minstallexec Release+Asserts/bin/llvm-config /usr/bin/llvm-config-$(mabi) || die |
112 | mlink multiarch-wrapper /usr/bin/llvm-config || die |
113 | |
114 | if [[ -f ${BINDIR}/usr/include/llvm/Config/config.h ]] |
115 | then |
116 | rm ${BINDIR}/usr/include/llvm/Config/config.h || die |
117 | fi |
118 | all-abis minstallfile include/llvm/Config/config.h /usr/include/llvm/Config/config-$(mabi).h || die |
119 | cat > ${BINDIR}/usr/include/llvm/Config/config.h << EOF |
120 | #include <bits/wordsize.h> |
121 | |
122 | #if __WORDSIZE == 32 |
123 | #include "config-m32.h" |
124 | #elif __WORDSIZE == 64 |
125 | #include "config-m64.h" |
126 | #else |
127 | #error "Unknown word size" |
128 | #endif |
129 | EOF |
130 | |
131 | if [[ -f ${BINDIR}/usr/include/llvm/Config/llvm-config.h ]] |
132 | then |
133 | rm ${BINDIR}/usr/include/llvm/Config/llvm-config.h || die |
134 | fi |
135 | all-abis minstallfile include/llvm/Config/llvm-config.h /usr/include/llvm/Config/llvm-config-$(mabi).h || die |
136 | cat > ${BINDIR}/usr/include/llvm/Config/llvm-config.h << EOF |
137 | #include <bits/wordsize.h> |
138 | |
139 | #if __WORDSIZE == 32 |
140 | #include "llvm-config-m32.h" |
141 | #elif __WORDSIZE == 64 |
142 | #include "llvm-config-m64.h" |
143 | #else |
144 | #error "Unknown word size" |
145 | #endif |
146 | EOF |
147 | fi |
148 | } |