Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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