Annotation of /smage/trunk/core/llvm/llvm-3.1-r4.smage2
Parent Directory | Revision Log
Revision 4321 -
(hide annotations)
(download)
Wed Nov 14 12:56:44 2012 UTC (11 years, 6 months ago) by niro
File size: 3982 byte(s)
Wed Nov 14 12:56:44 2012 UTC (11 years, 6 months ago) by niro
File size: 3982 byte(s)
-fixed sed line
1 | niro | 4318 | # $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 | # fix symbolic links from OCaml bindings to LLVM libraries | ||
46 | all-abis 'sed -i "s:\$(PROJ_libdir):/usr/$(mlibdir)/llvm:" bindings/ocaml/Makefile.ocaml || die' | ||
47 | |||
48 | # non-standard configure, fix config pathes and cflags | ||
49 | all-abis 'sed -i -e "s:\$(PROJ_prefix)/etc/llvm:/etc/llvm:" | ||
50 | niro | 4319 | -e "s:\$(PROJ_prefix)/lib:\$(PROJ_prefix)/$(mlibdir)/llvm:" |
51 | -e "s:\$(PROJ_prefix)/docs/llvm:\$(PROJ_prefix)/share/doc/${PNAME}-${PVER}:" | ||
52 | niro | 4318 | Makefile.config.in || die' |
53 | all-abis 'sed -i "/ActiveLibDir = ActivePrefix/s:lib:$(mlibdir)/llvm:" tools/llvm-config/llvm-config.cpp || die' | ||
54 | all-abis 'sed -i "s:LLVM_LIBDIR=\"\${prefix}/lib\":LLVM_LIBDIR=\"\${prefix}/$(mlibdir)/llvm\":" autoconf/configure.ac configure || die' | ||
55 | niro | 4320 | |
56 | niro | 4318 | # remove insecure rpath |
57 | all-abis 'sed -i "s:\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\|ExmplDir\))::g" Makefile.rules || die' | ||
58 | |||
59 | niro | 4320 | # fix gold |
60 | all-abis 'sed -i "s:\$(SharedLibDir):/usr/$(mlibdir)/llvm:" tools/gold/Makefile || die' | ||
61 | |||
62 | # ugly hack - fix broken path retrieval on magellan - fixme! | ||
63 | niro | 4321 | all-abis 'sed -i "s:CurrentPath(GetExecutablePath(argv\[0\]).str()):CurrentPath(argv\[0\]):" tools/llvm-config/llvm-config.cpp || die' |
64 | niro | 4320 | |
65 | niro | 4318 | # do not generate docs, which are just the man pages |
66 | mpatch ${PNAME}-2.9-no-docs.patch || die | ||
67 | } | ||
68 | |||
69 | src_compile() | ||
70 | { | ||
71 | local myopts | ||
72 | |||
73 | # enable pic on 64bit arches | ||
74 | [[ ${ARCH} = x86_64 ]] && myopts+="--enable-pic" | ||
75 | |||
76 | # be multilib friendly | ||
77 | [[ $(mlibdir) != lib ]] && myopts+=" --with-cxx-include-32bit-dir=32" | ||
78 | |||
79 | # force use of gcc instead of clang if already installed | ||
80 | CC=$(mabi-cc) CXX=$(mabi-cxx) \ | ||
81 | mconfigure \ | ||
82 | --libdir=/usr/$(mlibdir)/llvm \ | ||
83 | --enable-shared \ | ||
84 | niro | 4320 | --disable-expensive-checks \ |
85 | --disable-debug-runtime \ | ||
86 | --disable-assertions \ | ||
87 | niro | 4318 | --enable-optimized \ |
88 | --enable-libffi \ | ||
89 | --enable-bindings=none \ | ||
90 | ${myopts} \ | ||
91 | || die | ||
92 | |||
93 | niro | 4320 | mmake VERBOSE=1 REQUIRES_RTTI=1 || die |
94 | niro | 4318 | } |
95 | |||
96 | src_install() | ||
97 | { | ||
98 | niro | 4320 | mmake DESTDIR=${BINDIR} install || die |
99 | niro | 4318 | |
100 | # be multilib friendly | ||
101 | if [[ $(mlibdir) != lib ]] | ||
102 | then | ||
103 | if [[ -f ${BINDIR}/usr/bin/llvm-config ]] | ||
104 | then | ||
105 | rm ${BINDIR}/usr/bin/llvm-config || die | ||
106 | fi | ||
107 | all-abis minstallexec Release+Asserts/bin/llvm-config /usr/bin/llvm-config-$(mabi) || die | ||
108 | mlink multiarch-wrapper /usr/bin/llvm-config || die | ||
109 | |||
110 | if [[ -f ${BINDIR}/usr/include/llvm/Config/config.h ]] | ||
111 | then | ||
112 | rm ${BINDIR}/usr/include/llvm/Config/config.h || die | ||
113 | fi | ||
114 | all-abis minstallfile include/llvm/Config/config.h /usr/include/llvm/Config/config-$(mabi).h || die | ||
115 | cat > ${BINDIR}/usr/include/llvm/Config/config.h << EOF | ||
116 | #include <bits/wordsize.h> | ||
117 | |||
118 | #if __WORDSIZE == 32 | ||
119 | #include "config-m32.h" | ||
120 | #elif __WORDSIZE == 64 | ||
121 | #include "config-m64.h" | ||
122 | #else | ||
123 | #error "Unknown word size" | ||
124 | #endif | ||
125 | EOF | ||
126 | |||
127 | if [[ -f ${BINDIR}/usr/include/llvm/Config/llvm-config.h ]] | ||
128 | then | ||
129 | rm ${BINDIR}/usr/include/llvm/Config/llvm-config.h || die | ||
130 | fi | ||
131 | all-abis minstallfile include/llvm/Config/llvm-config.h /usr/include/llvm/Config/llvm-config-$(mabi).h || die | ||
132 | cat > ${BINDIR}/usr/include/llvm/Config/llvm-config.h << EOF | ||
133 | #include <bits/wordsize.h> | ||
134 | |||
135 | #if __WORDSIZE == 32 | ||
136 | #include "llvm-config-m32.h" | ||
137 | #elif __WORDSIZE == 64 | ||
138 | #include "llvm-config-m64.h" | ||
139 | #else | ||
140 | #error "Unknown word size" | ||
141 | #endif | ||
142 | EOF | ||
143 | fi | ||
144 | } |