Magellan Linux

Contents of /branches/R11-stable/extras/llvm/llvm-3.5.1-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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