Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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