Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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