7f4081aa7c2793a777f2a7fc6e0913fb3d631d74
[profile/ivi/llvm.git] / packaging / llvm.spec
1 Name:           llvm
2 Version:        2.9
3 Release:        4
4 Summary:        The Low Level Virtual Machine
5 Group:          Development/Languages
6 License:        NCSA
7 URL:            http://llvm.org/
8 Source0:        llvm-%{version}%{?prerel}.tgz
9
10 # Data files should be installed with timestamps preserved
11 Patch0:         llvm-2.6-timestamp.patch
12 # clang link failure if system GCC version is unknown
13 # http://llvm.org/bugs/show_bug.cgi?id=8897
14 Patch1:         clang-2.9-add_gcc_vers.patch
15 # Operator.h incompatibility with GCC 4.6 in C++0x mode
16 # http://llvm.org/bugs/show_bug.cgi?id=9869
17 Patch2:         llvm-2.9-PR9869_operator_destructor.patch
18
19 BuildRequires:  bison
20 BuildRequires:  chrpath
21 BuildRequires:  flex
22 BuildRequires:  gcc-c++ >= 3.4
23 BuildRequires:  groff
24 BuildRequires:  libffi-devel
25 BuildRequires:  libtool-ltdl-devel
26 Requires:       libllvm = %{version}-%{release}
27 ExclusiveArch:  %ix86
28
29 %description
30 LLVM is a compiler infrastructure designed for compile-time,
31 link-time, runtime, and idle-time optimization of programs from
32 arbitrary programming languages.  The compiler infrastructure includes
33 mirror sets of programming tools as well as libraries with equivalent
34 functionality.
35
36
37 %package devel
38 Summary:        Libraries and header files for LLVM
39 Group:          Development/Languages
40 Requires:       %{name} = %{version}-%{release}
41 Requires:       libffi-devel
42 Requires:       libstdc++-devel >= 3.4
43 Provides:       llvm-static = %{version}-%{release}
44
45 Requires(posttrans): /usr/sbin/alternatives
46 Requires(postun):    /usr/sbin/alternatives
47
48 %description devel
49 This package contains library and header files needed to develop new
50 native programs that use the LLVM infrastructure.
51
52
53
54 %package -n libllvm
55 Summary:        LLVM shared libraries
56 Group:          System Environment/Libraries
57
58 %description -n libllvm
59 Shared libraries for the LLVM compiler infrastructure.
60
61
62
63
64 %prep
65 %setup -q -n llvm-%{version}
66
67 # llvm patches
68 %patch0 -p1 -b .timestamp
69 %patch2 -p1 -b .pr9869_operator_destructor
70
71 %build
72 %configure \
73   --prefix=%{_prefix} \
74   --libdir=%{_libdir}/%{name} \
75   --datadir=%{_libdir}/%{name} \
76   --disable-doxygen \
77   --disable-assertions \
78   --enable-debug-runtime \
79   --enable-jit \
80   --enable-libffi \
81   --enable-shared \
82   --with-c-include-dirs=%{_includedir}:$(find %{_prefix}/lib/gcc/*/* \
83       -maxdepth 0 -type d)/include \
84 %if %{__isa_bits} == 64
85   --with-cxx-include-32bit-dir=32 \
86 %endif
87   --with-cxx-include-root=$(find %{_includedir}/c++/* -maxdepth 0 -type d) \
88   --with-cxx-include-arch=%{_target_cpu}-%{_vendor}-%{_os} \
89
90 # FIXME file this
91 # configure does not properly specify libdir
92 sed -i 's|(PROJ_prefix)/lib|(PROJ_prefix)/%{_lib}/%{name}|g' Makefile.config
93
94 make %{_smp_mflags} REQUIRES_RTTI=1 \
95   OPTIMIZE_OPTION="%{optflags}"
96
97
98 %install
99 make install DESTDIR=%{buildroot} \
100      PROJ_docsdir=/moredocs
101
102 # Create ld.so.conf.d entry
103 mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
104 cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf << EOF
105 %{_libdir}/llvm
106 EOF
107
108
109 #find %%{buildroot} -name .dir -print0 | xargs -0r rm -f
110 file %{buildroot}/%{_bindir}/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
111 file %{buildroot}/%{_libdir}/llvm/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
112
113 # Get rid of erroneously installed example files.
114 rm %{buildroot}%{_libdir}/%{name}/*LLVMHello.*
115
116 # FIXME file this bug
117 sed -i 's,ABS_RUN_DIR/lib",ABS_RUN_DIR/%{_lib}/%{name}",' \
118   %{buildroot}%{_bindir}/llvm-config
119
120 chmod -x %{buildroot}%{_libdir}/%{name}/*.a
121
122 find examples -name 'Makefile' | xargs -0r rm -f
123
124
125
126 rm -rf %buildroot/moredocs
127
128 %post -n libllvm -p /sbin/ldconfig
129
130
131 %postun -n libllvm -p /sbin/ldconfig
132
133
134
135 %files
136 /usr/bin/tblgen
137 %{_bindir}/bugpoint
138 %{_bindir}/llc
139 %{_bindir}/lli
140 %{_bindir}/llvm*
141 %{_bindir}/macho-dump
142 %{_bindir}/opt
143 %doc %{_mandir}/man1/*.1.*
144
145 %files devel
146 %{_bindir}/llvm-config
147 %{_includedir}/%{name}
148 %{_includedir}/%{name}-c
149 %{_libdir}/%{name}/*.a
150
151 %files -n libllvm
152 %config(noreplace) %{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf
153 %dir %{_libdir}/%{name}
154 %{_libdir}/%{name}/*.so
155