Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7909 - (show annotations) (download)
Mon Nov 23 11:01:13 2015 UTC (8 years, 5 months ago) by niro
File size: 5798 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
100 src_compile()
101 {
102 local myopts
103
104 # enable pic on 64bit arches
105 [[ ${ARCH} = x86_64 ]] && myopts+="--enable-pic"
106
107 # be multilib friendly
108 [[ $(mlibdir) != lib ]] && myopts+=" --with-cxx-include-32bit-dir=32"
109
110 # include location of libffi headers
111 export CPPFLAGS="${CPPFLAGS} $(pkg-config --cflags libffi)"
112
113 # force use of gcc instead of clang if already installed
114 CC=$(mabi-cc) CXX=$(mabi-cxx) \
115 mconfigure \
116 --libdir=/usr/$(mlibdir)/llvm \
117 --enable-shared \
118 --disable-expensive-checks \
119 --disable-debug-runtime \
120 --disable-assertions \
121 --enable-optimized \
122 --enable-libffi \
123 --enable-targets=all \
124 --enable-bindings=none \
125 --enable-experimental-targets=R600 \
126 ${myopts} \
127 || die
128
129 mmake VERBOSE=1 REQUIRES_RTTI=1 || die
130
131 # no python sphinx in out src tree, use pre-generated docs atm
132 # mmake -C docs -f Makefile.sphinx man html || die
133 }
134
135 src_install_llvm-libs()
136 {
137 # install only libs
138 mmake DESTDIR=${BINDIR} install-libs || die
139
140 # keep libLLVM only
141 zapmost ${BINDIR} \
142 usr/$(mlibdir)/llvm/libLLVM-* \
143 $([[ $(mlibdir) != lib ]] && echo "usr/lib/llvm/libLLVM-*") \
144 || die
145
146 # append ld.so.conf
147 MCONFIG="/etc/env.d/10llvm"
148 mclearconfig || die
149 maddconfig "LDPATH=\"/usr/$(mlibdir)/llvm\"" || die
150 if [[ $(mlibdir) != lib ]]
151 then
152 maddconfig "LDPATH=\"/usr/lib/llvm\"" || die
153 fi
154 }
155
156 src_install_llvm()
157 {
158 mmake DESTDIR=${BINDIR} install || die
159
160 # install pre-generated man-pages
161 minstallman ${MANPAGES_SRCDIR}/*.1 || die
162
163 # remove libs provided by llvm-libs
164 mdelete /usr/$(mlibdir)/llvm/libLLVM-\* || die
165 if [[ $(mlibdir) != lib ]]
166 then
167 mdelete /usr/lib/llvm/libLLVM-\* || die
168 fi
169
170 # be multilib friendly
171 if [[ $(mlibdir) != lib ]]
172 then
173 if [[ -f ${BINDIR}/usr/bin/llvm-config ]]
174 then
175 mdelete /usr/bin/llvm-config || die
176 fi
177 all-abis minstallexec Release/bin/llvm-config /usr/bin/llvm-config-$(mabi) || die
178 mlink multiarch-wrapper /usr/bin/llvm-config || die
179
180 if [[ -f ${BINDIR}/usr/include/llvm/Config/config.h ]]
181 then
182 mdelete /usr/include/llvm/Config/config.h || die
183 fi
184 all-abis minstallfile include/llvm/Config/config.h /usr/include/llvm/Config/config-$(mabi).h || die
185 cat > ${BINDIR}/usr/include/llvm/Config/config.h << EOF
186 #include <bits/wordsize.h>
187
188 #if __WORDSIZE == 32
189 #include "config-m32.h"
190 #elif __WORDSIZE == 64
191 #include "config-m64.h"
192 #else
193 #error "Unknown word size"
194 #endif
195 EOF
196
197 if [[ -f ${BINDIR}/usr/include/llvm/Config/llvm-config.h ]]
198 then
199 mdelete /usr/include/llvm/Config/llvm-config.h || die
200 fi
201 all-abis minstallfile include/llvm/Config/llvm-config.h /usr/include/llvm/Config/llvm-config-$(mabi).h || die
202 cat > ${BINDIR}/usr/include/llvm/Config/llvm-config.h << EOF
203 #include <bits/wordsize.h>
204
205 #if __WORDSIZE == 32
206 #include "llvm-config-m32.h"
207 #elif __WORDSIZE == 64
208 #include "llvm-config-m64.h"
209 #else
210 #error "Unknown word size"
211 #endif
212 EOF
213 fi
214 }