1 |
elmer |
1.1 |
### RPM external llvm 2.5
|
2 |
elmer |
1.3 |
## NOCOMPILER
|
3 |
|
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib64
|
4 |
|
|
|
5 |
elmer |
1.1 |
Source0: http://llvm.org/releases/%realversion/%n-gcc-4.2-%realversion.source.tar.gz
|
6 |
|
|
Source1: http://llvm.org/releases/%realversion/%n-%realversion.tar.gz
|
7 |
|
|
%define gmpVersion 4.2.1
|
8 |
|
|
%define mpfrVersion 2.2.1
|
9 |
elmer |
1.3 |
%define tmpgccVersion 4.2.2
|
10 |
elmer |
1.1 |
Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
|
11 |
|
|
Source3: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2
|
12 |
elmer |
1.3 |
Source4: ftp://ftp.fu-berlin.de/unix/gnu/gcc/gcc-%tmpgccVersion/gcc-%tmpgccVersion.tar.bz2
|
13 |
elmer |
1.1 |
|
14 |
|
|
%prep
|
15 |
|
|
%setup -T -b 0 -n llvm-gcc4.2-%realversion.source
|
16 |
|
|
|
17 |
|
|
%if "%cmsos" == "slc4_ia32"
|
18 |
|
|
cat << \EOF_CONFIG_GCC >> gcc/config.gcc
|
19 |
|
|
# CMS patch to include gcc/config/i386/t-cms when building gcc
|
20 |
|
|
tm_file="$tm_file i386/cms.h"
|
21 |
|
|
tmake_file="$tmake_file i386/t-cms"
|
22 |
|
|
EOF_CONFIG_GCC
|
23 |
|
|
|
24 |
|
|
cat << \EOF_CMS_H > gcc/config/i386/cms.h
|
25 |
|
|
#undef ASM_SPEC
|
26 |
|
|
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32"
|
27 |
|
|
#undef CC1_SPEC
|
28 |
|
|
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32"
|
29 |
|
|
#undef CC1PLUS_SPEC
|
30 |
|
|
#define CC1PLUS_SPEC "-m32"
|
31 |
|
|
#undef MULTILIB_DEFAULTS
|
32 |
|
|
#define MULTILIB_DEFAULTS { "m32" }
|
33 |
|
|
EOF_CMS_H
|
34 |
|
|
|
35 |
|
|
cat << \EOF_T_CMS > gcc/config/i386/t-cms
|
36 |
|
|
MULTILIB_OPTIONS = m32
|
37 |
|
|
MULTILIB_DIRNAMES = ../lib
|
38 |
|
|
MULTILIB_MATCHES = m32=m32
|
39 |
|
|
EOF_T_CMS
|
40 |
|
|
%endif
|
41 |
|
|
|
42 |
|
|
%setup -D -T -b 1 -n llvm-%realversion
|
43 |
|
|
%setup -D -T -b 2 -n gmp-%{gmpVersion}
|
44 |
|
|
%setup -D -T -b 3 -n mpfr-%{mpfrVersion}
|
45 |
elmer |
1.3 |
%setup -D -T -b 4 -n gcc-%{tmpgccVersion}
|
46 |
elmer |
1.1 |
|
47 |
|
|
%build
|
48 |
|
|
%define gcc4opts %{nil}
|
49 |
|
|
# Build GMP/MPFR for GCC 4.x
|
50 |
|
|
cd ../gmp-%{gmpVersion}
|
51 |
|
|
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared
|
52 |
|
|
make %makeprocesses
|
53 |
|
|
make install
|
54 |
|
|
cd ../mpfr-%{mpfrVersion}
|
55 |
|
|
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared
|
56 |
|
|
make %makeprocesses
|
57 |
|
|
make install
|
58 |
|
|
%define gcc4opts --with-gmp=%i/tmp/gmp --with-mpfr=%i/tmp/mpfr
|
59 |
|
|
|
60 |
elmer |
1.3 |
# build a temporary gcc (c,c++ only) to use for the build
|
61 |
|
|
cd ../gcc-%tmpgccVersion
|
62 |
|
|
mkdir -p obj
|
63 |
|
|
cd obj
|
64 |
|
|
CC="gcc $CCOPTS" \
|
65 |
|
|
../configure --prefix=%i/tmp/gcc \
|
66 |
|
|
--enable-languages=c,c++ %gcc4opts --enable-shared
|
67 |
|
|
make %makeprocesses bootstrap
|
68 |
|
|
make install
|
69 |
|
|
find %i/tmp/gcc/lib %i/tmp/gcc/lib32 %i/tmp/gcc/lib64 -name '*.la' -exec rm -f {} \; || true
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
# Build llvm using the temp gcc
|
73 |
|
|
export CC=%i/tmp/gcc/bin/gcc
|
74 |
|
|
export CXX=%i/tmp/gcc/bin/g++
|
75 |
|
|
export PATH=%i/tmp/gcc/bin:$PATH
|
76 |
|
|
export LD_LIBRARY_PATH=%i/tmp/gcc/lib64:%i/tmp/gcc/lib:$LD_LIBRARY_PATH
|
77 |
|
|
export GCC_VERSION=%{tmpgccVersion}
|
78 |
|
|
export GCC_ROOT=%i/tmp/gcc
|
79 |
|
|
export GCC_REVISION=1
|
80 |
|
|
cd ../..
|
81 |
elmer |
1.1 |
mkdir llvm-objects
|
82 |
|
|
cd llvm-objects
|
83 |
|
|
../llvm-%realversion/configure --prefix=%i --enable-optimized
|
84 |
|
|
make %makeprocesses
|
85 |
|
|
make install
|
86 |
|
|
# Build the llvm-gcc front-end
|
87 |
|
|
cd ../llvm-gcc4.2-%realversion.source
|
88 |
|
|
./configure --prefix=%i %gcc4opts --enable-llvm=`pwd`/../llvm-objects --enable-languages=c,c++
|
89 |
|
|
rm GNUmakefile
|
90 |
|
|
make %makeprocesses
|
91 |
|
|
make install
|
92 |
|
|
|
93 |
|
|
%install
|
94 |
elmer |
1.3 |
# Clean up the temporary builds of mpfr and gmp (which had only .a libs)
|
95 |
|
|
# and gcc (which should no longer be needed)
|
96 |
|
|
rm -fR %i/tmp
|
97 |
elmer |
1.2 |
# Fix up a perl path
|
98 |
|
|
perl -p -i -e 's|^#!.*perl(.*)|#!/usr/bin/env perl$1|' %i/bin/llvm-config
|
99 |
elmer |
1.1 |
# SCRAM ToolBox toolfile
|
100 |
|
|
mkdir -p %i/etc/scram.d
|
101 |
|
|
cat << \EOF_TOOLFILE >%i/etc/scram.d/%n
|
102 |
|
|
<doc type=BuildSystem::ToolDoc version=1.0>
|
103 |
|
|
<Tool name=%n version=%v>
|
104 |
|
|
<lib name=z>
|
105 |
|
|
<client>
|
106 |
|
|
<Environment name=ZLIB_BASE default="%i"></Environment>
|
107 |
|
|
<Environment name=INCLUDE default="$ZLIB_BASE/include"></Environment>
|
108 |
|
|
<Environment name=LIBDIR default="$ZLIB_BASE/lib"></Environment>
|
109 |
|
|
</client>
|
110 |
|
|
</Tool>
|
111 |
|
|
EOF_TOOLFILE
|
112 |
|
|
|
113 |
|
|
%post
|
114 |
|
|
%{relocateConfig}etc/scram.d/%n
|