Contents of /trunk/extras/llvm/llvm-3.6.2-r2.smage2
Parent Directory | Revision Log
Revision 27292 -
(show annotations)
(download)
Mon Dec 14 09:50:08 2015 UTC (8 years, 9 months ago) by niro
File size: 5713 byte(s)
Mon Dec 14 09:50:08 2015 UTC (8 years, 9 months ago) by niro
File size: 5713 byte(s)
-c++11 abi and ncureses-6.0 rebuild
1 | # $Id$ |
2 | |
3 | PNAME="llvm" |
4 | PVER="3.6.2" |
5 | PBUILD="r2" |
6 | |
7 | SPLIT_PACKAGES="llvm-libs llvm" |
8 | |
9 | PCAT="sys-dev" |
10 | HOMEPAGE="http://llvm.org/" |
11 | |
12 | DEPEND_x86_64=">= sys-apps/multiarch-wrapper-1" |
13 | SPECIAL_VARS="DEPEND_x86_64" |
14 | |
15 | LLVM_DEPEND="$(marchdepend) |
16 | >= dev-lang/perl-5.22" |
17 | |
18 | LIB_DEPEND=">= dev-libs/libffi-3.2 |
19 | >= sys-libs/zlib-1.2 |
20 | >= sys-libs/ncurses-6.0 |
21 | == sys-libs/libstdc++-5.3.0" |
22 | |
23 | SDEPEND="${LIB_DEPEND} |
24 | ${LLVM_DEPEND} |
25 | >= dev-util/pkgconfig-0.25 |
26 | >= sys-dev/bison-2.5 |
27 | >= sys-dev/flex-2.3.35 |
28 | >= sys-dev/make-3.82 |
29 | == sys-dev/gcc-5.3.0 |
30 | >= sys-dev/binutils-2.25 |
31 | >= dev-lang/python-2.7 |
32 | >= virtual/sed" |
33 | |
34 | SRCFILE="${PNAME}-${PVER}.src.tar.xz" |
35 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}.src" |
36 | |
37 | #MANPAGES_SRCFILE="${PNAME}-${PVER}-manpages.tar.bz2" |
38 | #MANPAGES_SRCDIR="${BUILDDIR}/${PNAME}-${PVER}-manpages" |
39 | MANPAGES_SRCFILE="${PNAME}-3.6.1-manpages.tar.bz2" |
40 | MANPAGES_SRCDIR="${BUILDDIR}/${PNAME}-3.6.1-manpages" |
41 | |
42 | sminclude mtools multilib cleanutils |
43 | msetfeature "!check" |
44 | |
45 | SRC_URI=( |
46 | http://llvm.org/releases/${PVER}/${SRCFILE} |
47 | mirror://${PNAME}/${SRCFILE} |
48 | mirror://${PNAME}/${MANPAGES_SRCFILE} |
49 | ) |
50 | |
51 | #UP2DATE="updatecmd ${HOMEPAGE} | grep 'Download now' | sed 's:.*][lL][lL][vV][mM]\ \(.*\):\1:'" |
52 | UP2DATE="updatecmd ${HOMEPAGE}/releases/download.html | grep '.src.' | grep '/${PNAME}-[0-9]' | sed 's:.src::g' | highesttarball xz" |
53 | |
54 | # pkgs which require a rebuild: mesa |
55 | |
56 | split_info_llvm-libs() |
57 | { |
58 | DESCRIPTION="The Low Level Virtual Machine Runtime Library." |
59 | DEPEND="${LIB_DEPEND}" |
60 | PCAT="sys-libs" |
61 | } |
62 | |
63 | split_info_llvm() |
64 | { |
65 | DESCRIPTION="The Low Level Virtual Machine." |
66 | DEPEND="${LLVM_DEPEND} |
67 | == sys-libs/llvm-libs-${PVER}" |
68 | } |
69 | |
70 | src_prepare() |
71 | { |
72 | munpack ${SRCFILE} || die |
73 | # pre-generated man-pages |
74 | oldmunpack ${MANPAGES_SRCFILE} || die |
75 | |
76 | # fix symbolic links from OCaml bindings to LLVM libraries |
77 | all-abis 'sed -i "s:\$(PROJ_libdir):/usr/$(mlibdir)/llvm:" bindings/ocaml/Makefile.ocaml || die' |
78 | |
79 | # non-standard configure, fix config pathes and cflags |
80 | all-abis 'sed -i -e "s:\$(PROJ_prefix)/etc/llvm:/etc/llvm:" |
81 | -e "s:\$(PROJ_prefix)/lib:\$(PROJ_prefix)/$(mlibdir)/llvm:" |
82 | -e "s:\$(PROJ_prefix)/docs/llvm:\$(PROJ_prefix)/share/doc/${PNAME}-${PVER}:" |
83 | Makefile.config.in || die' |
84 | all-abis 'sed -i "/ActiveLibDir = ActivePrefix/s:lib:$(mlibdir)/llvm:" tools/llvm-config/llvm-config.cpp || die' |
85 | all-abis 'sed -i "s:LLVM_LIBDIR=\"\${prefix}/lib\":LLVM_LIBDIR=\"\${prefix}/$(mlibdir)/llvm\":" autoconf/configure.ac configure || die' |
86 | |
87 | # remove insecure rpath |
88 | all-abis 'sed -i "s:\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\|ExmplDir\))::g" Makefile.rules || die' |
89 | |
90 | # fix gold |
91 | all-abis 'sed -i "s:\$(SharedLibDir):/usr/$(mlibdir)/llvm:" tools/gold/Makefile || die' |
92 | |
93 | # ugly hack - fix broken path retrieval on magellan - fixme! |
94 | all-abis 'sed -i "s:CurrentPath(GetExecutablePath(argv\[0\]).str()):CurrentPath(\"/usr/bin/llvm-config\"):" tools/llvm-config/llvm-config.cpp || die' |
95 | } |
96 | |
97 | src_compile() |
98 | { |
99 | local myopts |
100 | |
101 | # enable pic on 64bit arches |
102 | [[ ${ARCH} = x86_64 ]] && myopts+="--enable-pic" |
103 | |
104 | # be multilib friendly |
105 | [[ $(mlibdir) != lib ]] && myopts+=" --with-cxx-include-32bit-dir=32" |
106 | |
107 | # include location of libffi headers |
108 | export CPPFLAGS="${CPPFLAGS} $(pkg-config --cflags libffi)" |
109 | |
110 | # force use of gcc instead of clang if already installed |
111 | CC=$(mabi-cc) CXX=$(mabi-cxx) \ |
112 | mconfigure \ |
113 | --libdir=/usr/$(mlibdir)/llvm \ |
114 | --enable-shared \ |
115 | --disable-expensive-checks \ |
116 | --disable-debug-runtime \ |
117 | --disable-assertions \ |
118 | --enable-optimized \ |
119 | --enable-libffi \ |
120 | --enable-targets=all \ |
121 | --enable-bindings=none \ |
122 | --enable-experimental-targets=R600 \ |
123 | ${myopts} \ |
124 | || die |
125 | |
126 | mmake VERBOSE=1 REQUIRES_RTTI=1 || die |
127 | |
128 | # no python sphinx in out src tree, use pre-generated docs atm |
129 | # mmake -C docs -f Makefile.sphinx man html || die |
130 | } |
131 | |
132 | src_install_llvm-libs() |
133 | { |
134 | # install only libs |
135 | mmake DESTDIR=${BINDIR} install-libs || die |
136 | |
137 | # keep libLLVM only |
138 | zapmost ${BINDIR} \ |
139 | usr/$(mlibdir)/llvm/libLLVM-* \ |
140 | $([[ $(mlibdir) != lib ]] && echo "usr/lib/llvm/libLLVM-*") \ |
141 | || die |
142 | |
143 | # append ld.so.conf |
144 | MCONFIG="/etc/env.d/10llvm" |
145 | mclearconfig || die |
146 | maddconfig "LDPATH=\"/usr/$(mlibdir)/llvm\"" || die |
147 | if [[ $(mlibdir) != lib ]] |
148 | then |
149 | maddconfig "LDPATH=\"/usr/lib/llvm\"" || die |
150 | fi |
151 | } |
152 | |
153 | src_install_llvm() |
154 | { |
155 | mmake DESTDIR=${BINDIR} install || die |
156 | |
157 | # install pre-generated man-pages |
158 | minstallman ${MANPAGES_SRCDIR}/*.1 || die |
159 | |
160 | # remove libs provided by llvm-libs |
161 | mdelete /usr/$(mlibdir)/llvm/libLLVM-\* || die |
162 | if [[ $(mlibdir) != lib ]] |
163 | then |
164 | mdelete /usr/lib/llvm/libLLVM-\* || die |
165 | fi |
166 | |
167 | # be multilib friendly |
168 | if [[ $(mlibdir) != lib ]] |
169 | then |
170 | if [[ -f ${BINDIR}/usr/bin/llvm-config ]] |
171 | then |
172 | mdelete /usr/bin/llvm-config || die |
173 | fi |
174 | all-abis minstallexec Release/bin/llvm-config /usr/bin/llvm-config-$(mabi) || die |
175 | mlink multiarch-wrapper /usr/bin/llvm-config || die |
176 | |
177 | if [[ -f ${BINDIR}/usr/include/llvm/Config/config.h ]] |
178 | then |
179 | mdelete /usr/include/llvm/Config/config.h || die |
180 | fi |
181 | all-abis minstallfile include/llvm/Config/config.h /usr/include/llvm/Config/config-$(mabi).h || die |
182 | cat > ${BINDIR}/usr/include/llvm/Config/config.h << EOF |
183 | #include <bits/wordsize.h> |
184 | |
185 | #if __WORDSIZE == 32 |
186 | #include "config-m32.h" |
187 | #elif __WORDSIZE == 64 |
188 | #include "config-m64.h" |
189 | #else |
190 | #error "Unknown word size" |
191 | #endif |
192 | EOF |
193 | |
194 | if [[ -f ${BINDIR}/usr/include/llvm/Config/llvm-config.h ]] |
195 | then |
196 | mdelete /usr/include/llvm/Config/llvm-config.h || die |
197 | fi |
198 | all-abis minstallfile include/llvm/Config/llvm-config.h /usr/include/llvm/Config/llvm-config-$(mabi).h || die |
199 | cat > ${BINDIR}/usr/include/llvm/Config/llvm-config.h << EOF |
200 | #include <bits/wordsize.h> |
201 | |
202 | #if __WORDSIZE == 32 |
203 | #include "llvm-config-m32.h" |
204 | #elif __WORDSIZE == 64 |
205 | #include "llvm-config-m64.h" |
206 | #else |
207 | #error "Unknown word size" |
208 | #endif |
209 | EOF |
210 | fi |
211 | } |