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