Depend on libffi to allow the LLVM interpreter to call external functions

Build with RTTI enabled, needed by e.g. Rubinius (# 722714)
Fix multilib installation
This commit is contained in:
Michel Alexandre Salim 2011-08-01 18:50:42 +02:00
parent f63f528480
commit 687c13802d
4 changed files with 94 additions and 12 deletions

View file

@ -0,0 +1,12 @@
--- clang-2.9/lib/Driver/ToolChains.cpp.add_gcc_vers 2011-03-21 22:29:27.000000000 +0100
+++ clang-2.9/lib/Driver/ToolChains.cpp 2011-08-01 18:20:29.504194241 +0200
@@ -1449,7 +1449,8 @@
GccTriple = "i586-suse-linux";
}
- const char* GccVersions[] = {"4.5.2", "4.5.1", "4.5", "4.4.5", "4.4.4",
+ const char* GccVersions[] = {"4.6.1", "4.6.0",
+ "4.5.2", "4.5.1", "4.5", "4.4.5", "4.4.4",
"4.4.3", "4.4", "4.3.4", "4.3.3", "4.3.2",
"4.3", "4.2.4", "4.2.3", "4.2.2", "4.2.1",
"4.2"};

9
llvm-Config-config.h Normal file
View file

@ -0,0 +1,9 @@
#include <bits/wordsize.h>
#if __WORDSIZE == 32
#include "config-32.h"
#elif __WORDSIZE == 64
#include "config-64.h"
#else
#error "Unknown word size"
#endif

View file

@ -0,0 +1,9 @@
#include <bits/wordsize.h>
#if __WORDSIZE == 32
#include "llvm-config-32.h"
#elif __WORDSIZE == 64
#include "llvm-config-64.h"
#else
#error "Unknown word size"
#endif

View file

@ -12,7 +12,7 @@
Name: llvm
Version: 2.8
Release: 11%{?dist}
Release: 12%{?dist}
Summary: The Low Level Virtual Machine
Group: Development/Languages
@ -20,19 +20,31 @@ License: NCSA
URL: http://llvm.org/
Source0: http://llvm.org/releases/%{version}/llvm-%{version}.tgz
Source1: http://llvm.org/releases/%{version}/clang-%{version}.tgz
# multilib fixes
Source2: llvm-Config-config.h
Source3: llvm-Config-llvm-config.h
# Data files should be installed with timestamps preserved
Patch0: llvm-2.6-timestamp.patch
# rename alignof -> alignOf for C++0x support
# http://llvm.org/bugs/show_bug.cgi?id=8423
Patch1: llvm-2.8-alignOf.patch
Patch2: clang-2.8-alignOf.patch
# Disable broken AVX code generation
# http://llvm.org/bugs/show_bug.cgi?id=9508
Patch3: llvm-2.8-disable-avx.patch
# clang link failure if system GCC version is unknown
# http://llvm.org/bugs/show_bug.cgi?id=8897
# Patch4: clang-2.9-add_gcc_vers.patch
BuildRequires: bison
BuildRequires: chrpath
BuildRequires: flex
BuildRequires: gcc-c++ >= 3.4
BuildRequires: groff
BuildRequires: libffi-devel
BuildRequires: libtool-ltdl-devel
%if %{with ocaml}
BuildRequires: ocaml-ocamldoc
@ -64,6 +76,8 @@ Requires: %{name} = %{version}-%{release}
Requires: libstdc++-devel >= 3.4
Provides: llvm-static = %{version}-%{release}
Requires(posttrans): /usr/sbin/alternatives
Requires(postun): /usr/sbin/alternatives
%description devel
This package contains library and header files needed to develop new
@ -207,12 +221,16 @@ HTML documentation for LLVM's OCaml binding.
%setup -q -n llvm-%{version} -a1 %{?_with_gcc:-a2}
mv clang-%{version} tools/clang
# llvm patches
%patch0 -p1 -b .timestamp
%patch1 -p0 -b .alignOf
%patch3 -p1 -b .avx
# clang patches
pushd tools/clang
%patch2 -p0 -b .alignOf
#patch3 -p1 -b .add_gcc_ver
popd
%patch3 -p1 -b .avx
# Encoding fix
#(cd tools/clang/docs && \
@ -233,6 +251,7 @@ popd
--disable-assertions \
--enable-debug-runtime \
--enable-jit \
--enable-libffi \
--enable-shared \
--with-c-include-dirs=%{_includedir}:$(find %{_prefix}/lib/gcc/*/* \
-maxdepth 0 -type d)/include \
@ -244,7 +263,7 @@ popd
# configure does not properly specify libdir
sed -i 's|(PROJ_prefix)/lib|(PROJ_prefix)/%{_lib}/%{name}|g' Makefile.config
make %{_smp_mflags} \
make %{_smp_mflags} REQUIRES_RTTI=1 \
%ifarch ppc
OPTIMIZE_OPTION="%{optflags} -fno-var-tracking-assignments"
%else
@ -252,17 +271,21 @@ make %{_smp_mflags} \
%endif
%check
# no current unexpected failures. Use || true if they recur to force ignore
make check 2>&1 | tee llvm-testlog.txt
(cd tools/clang && make test 2>&1) | tee clang-testlog.txt
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} \
PROJ_docsdir=/moredocs
# multilib fixes
mv %{buildroot}%{_bindir}/llvm-config{,-%{__isa_bits}}
pushd %{buildroot}%{_includedir}/llvm/Config
mv config.h config-%{__isa_bits}.h
cp -p %{SOURCE2} config.h
mv llvm-config.h llvm-config-%{__isa_bits}.h
cp -p %{SOURCE3} llvm-config.h
popd
# Create ld.so.conf.d entry
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf << EOF
@ -312,7 +335,7 @@ rm %{buildroot}%{_libdir}/%{name}/*LLVMHello.*
# FIXME file this bug
sed -i 's,ABS_RUN_DIR/lib",ABS_RUN_DIR/%{_lib}/%{name}",' \
%{buildroot}%{_bindir}/llvm-config
%{buildroot}%{_bindir}/llvm-config-%{__isa_bits}
chmod -x %{buildroot}%{_libdir}/%{name}/*.a
@ -321,6 +344,11 @@ chmod -x %{buildroot}%{_libdir}/%{name}/*.a
find examples -name 'Makefile' | xargs -0r rm -f
%check
make check
(cd tools/clang && make test)
%post libs -p /sbin/ldconfig
%post -n clang -p /sbin/ldconfig
@ -329,13 +357,32 @@ find examples -name 'Makefile' | xargs -0r rm -f
%postun -n clang -p /sbin/ldconfig
%posttrans devel
# link llvm-config to the platform-specific file;
# use ISA bits as priority so that 64-bit is preferred
# over 32-bit if both are installed
alternatives \
--install \
%{_bindir}/llvm-config \
llvm-config \
%{_bindir}/llvm-config-%{__isa_bits} \
%{__isa_bits}
%postun devel
if [ $1 -eq 0 ]; then
alternatives --remove llvm-config \
%{_bindir}/llvm-config-%{__isa_bits}
fi
exit 0
%files
%defattr(-,root,root,-)
%doc CREDITS.TXT LICENSE.TXT README.txt
%{_bindir}/bugpoint
%{_bindir}/llc
%{_bindir}/lli
%exclude %{_bindir}/llvm-config
%exclude %{_bindir}/llvm-config-%{__isa_bits}
%{_bindir}/llvm*
%{_bindir}/opt
%exclude %{_mandir}/man1/clang.1.*
@ -344,7 +391,7 @@ find examples -name 'Makefile' | xargs -0r rm -f
%files devel
%defattr(-,root,root,-)
%{_bindir}/llvm-config
%{_bindir}/llvm-config-%{__isa_bits}
%{_includedir}/%{name}
%{_includedir}/%{name}-c
%{_libdir}/%{name}/*.a
@ -414,6 +461,11 @@ find examples -name 'Makefile' | xargs -0r rm -f
%changelog
* Tue Aug 2 2011 Michel Salim <salimma@fedoraproject.org> - 2.8-12
- Depend on libffi to allow the LLVM interpreter to call external functions
- Build with RTTI enabled, needed by e.g. Rubinius (# 722714)
- Fix multilib installation
* Tue Apr 26 2011 Adam Jackson <ajax@redhat.com> 2.8-11
- llvm-2.8-disable-avx.patch: Disable AVX code generation. (#699896)