Magellan Linux

Annotation of /smage/trunk/core/llvm/llvm-3.6.2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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