Magellan Linux

Contents of /smage/trunk/core/llvm/llvm-3.7.0-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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