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