Magellan Linux

Contents of /smage/trunk/core/llvm/llvm-3.1-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4318 - (show annotations) (download)
Wed Nov 14 09:49:45 2012 UTC (11 years, 6 months ago) by niro
File size: 4669 byte(s)
-serveral fixes
1 # $Id$
2
3 PNAME="llvm"
4 PVER="3.1"
5 PBUILD="r4"
6
7 PCAT="sys-dev"
8
9 DESCRIPTION="The Low Level Virtual Machine."
10 HOMEPAGE="http://llvm.org/"
11
12 DEPEND_x86_64=">= sys-apps/multiarch-wrapper-1"
13 SPECIAL_VARS="DEPEND_x86_64"
14
15 DEPEND="$(marchdepend)
16 >= dev-lang/perl-5.16
17 >= dev-libs/libffi-3
18 >= sys-libs/libstdc++-4.7"
19
20 SDEPEND=">= dev-util/pkgconfig-0.25
21 >= sys-dev/bison-2.5
22 >= sys-dev/flex-2.3.35
23 >= sys-dev/make-3.82
24 >= sys-dev/gcc-4.7
25 >= sys-dev/binutils-2.23"
26
27 SRCFILE="${PNAME}-${PVER}.src.tar.gz"
28 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}.src"
29
30 sminclude mtools multilib
31 msetfeature "!check"
32
33 SRC_URI=(
34 http://llvm.org/releases/${PVER}/${SRCFILE}
35 mirror://${PNAME}/${SRCFILE}
36 mirror://${PNAME}/${PNAME}-2.9-no-docs.patch
37 )
38
39 UP2DATE="updatecmd ${HOMEPAGE} | grep 'Download now' | sed 's:.*][lL][lL][vV][mM]\ \(.*\):\1:'"
40
41 src_prepare()
42 {
43 munpack ${SRCFILE} || die
44
45 # # non-standard configure, fix config pathes, rpath and cflags
46 # all-abis 'sed -i
47 # -e "s,^PROJ_docsdir.*,PROJ_docsdir := \$(PROJ_prefix)/share/doc/${PNAME}-${PVER},"
48 # -e "s,^PROJ_etcdir.*,PROJ_etcdir := ''/etc/llvm,"
49 # -e "s,^PROJ_libdir.*,PROJ_libdir := \$(PROJ_prefix)/$(mlibdir)/llvm,"
50 # Makefile.config.in || die'
51 # all-abis 'sed -i
52 # -e "s,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),\$(RPATH) -Wl\,/usr/$(mlibdir)/llvm,"
53 # -e "/OmitFramePointer/s/-fomit-frame-pointer//"
54 # Makefile.rules || die'
55 # all-abis 'sed -i "s:\$(PROJ_libdir):/usr/$(mlibdir)/llvm:" bindings/ocaml/Makefile.ocaml || die'
56 # all-abis 'sed -i
57 # "s:ActiveLibDir = ActivePrefix + \"/lib\":ActiveLibDir = ActivePrefix + \"/$(mlibdir)/llvm\":"
58 # tools/llvm-config/llvm-config.cpp || die'
59 # all-abis 'sed -i
60 # "s:LLVM_LIBDIR=\"\${prefix}/lib\":LLVM_LIBDIR=\"\${prefix}/$(mlibdir)/llvm\":"
61 # autoconf/configure.ac configure || die'
62 # # fix gold
63 # all-abis 'sed -i "s:\$(SharedLibDir):/usr/$(mlibdir)/llvm:" tools/gold/Makefile || die'
64
65 # fix symbolic links from OCaml bindings to LLVM libraries
66 all-abis 'sed -i "s:\$(PROJ_libdir):/usr/$(mlibdir)/llvm:" bindings/ocaml/Makefile.ocaml || die'
67
68 # non-standard configure, fix config pathes and cflags
69 all-abis 'sed -i -e "s:\$(PROJ_prefix)/etc/llvm:/etc/llvm:"
70 -e "s:\$(PROJ_prefix)/lib:$(PROJ_prefix)/$(mlibdir)/llvm:"
71 -e "s:\$(PROJ_prefix)/docs/llvm:$(PROJ_prefix)/share/doc/${PNAME}-${PVER}:"
72 Makefile.config.in || die'
73 all-abis 'sed -i "/ActiveLibDir = ActivePrefix/s:lib:$(mlibdir)/llvm:" tools/llvm-config/llvm-config.cpp || die'
74 all-abis 'sed -i "s:LLVM_LIBDIR=\"\${prefix}/lib\":LLVM_LIBDIR=\"\${prefix}/$(mlibdir)/llvm\":" autoconf/configure.ac configure || die'
75 # remove insecure rpath
76 all-abis 'sed -i "s:\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\|ExmplDir\))::g" Makefile.rules || die'
77
78 # do not generate docs, which are just the man pages
79 mpatch ${PNAME}-2.9-no-docs.patch || die
80 }
81
82 src_compile()
83 {
84 local myopts
85
86 # enable pic on 64bit arches
87 [[ ${ARCH} = x86_64 ]] && myopts+="--enable-pic"
88
89 # be multilib friendly
90 [[ $(mlibdir) != lib ]] && myopts+=" --with-cxx-include-32bit-dir=32"
91
92 # force use of gcc instead of clang if already installed
93 CC=$(mabi-cc) CXX=$(mabi-cxx) \
94 mconfigure \
95 --libdir=/usr/$(mlibdir)/llvm \
96 --enable-shared \
97 --with-optimize-option= \
98 --enable-optimized \
99 --enable-libffi \
100 --enable-bindings=none \
101 ${myopts} \
102 || die
103
104 mmake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die
105 }
106
107 src_install()
108 {
109 mmake DESTDIR=${BINDIR} KEEP_SYMBOLS=1 install || die
110
111 # be multilib friendly
112 if [[ $(mlibdir) != lib ]]
113 then
114 if [[ -f ${BINDIR}/usr/bin/llvm-config ]]
115 then
116 rm ${BINDIR}/usr/bin/llvm-config || die
117 fi
118 all-abis minstallexec Release+Asserts/bin/llvm-config /usr/bin/llvm-config-$(mabi) || die
119 mlink multiarch-wrapper /usr/bin/llvm-config || die
120
121 if [[ -f ${BINDIR}/usr/include/llvm/Config/config.h ]]
122 then
123 rm ${BINDIR}/usr/include/llvm/Config/config.h || die
124 fi
125 all-abis minstallfile include/llvm/Config/config.h /usr/include/llvm/Config/config-$(mabi).h || die
126 cat > ${BINDIR}/usr/include/llvm/Config/config.h << EOF
127 #include <bits/wordsize.h>
128
129 #if __WORDSIZE == 32
130 #include "config-m32.h"
131 #elif __WORDSIZE == 64
132 #include "config-m64.h"
133 #else
134 #error "Unknown word size"
135 #endif
136 EOF
137
138 if [[ -f ${BINDIR}/usr/include/llvm/Config/llvm-config.h ]]
139 then
140 rm ${BINDIR}/usr/include/llvm/Config/llvm-config.h || die
141 fi
142 all-abis minstallfile include/llvm/Config/llvm-config.h /usr/include/llvm/Config/llvm-config-$(mabi).h || die
143 cat > ${BINDIR}/usr/include/llvm/Config/llvm-config.h << EOF
144 #include <bits/wordsize.h>
145
146 #if __WORDSIZE == 32
147 #include "llvm-config-m32.h"
148 #elif __WORDSIZE == 64
149 #include "llvm-config-m64.h"
150 #else
151 #error "Unknown word size"
152 #endif
153 EOF
154 fi
155 }