tstellar / rpms / llvm

Forked from rpms/llvm 2 years ago
Clone
Bryan O'Sullivan d291b49
# Build options:
Bryan O'Sullivan d291b49
#
Bryan O'Sullivan d291b49
# --with doxygen
Bryan O'Sullivan d291b49
#   The doxygen docs are HUGE, so they are not built by default.
Bryan O'Sullivan d291b49
#
Bryan O'Sullivan d291b49
# --with gcc
Bryan O'Sullivan d291b49
#   The llvm-gcc package doesn't currently build.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%define lgcc_version 4.2
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
# LLVM object files don't contain build IDs.  I don't know why yet.
Bryan O'Sullivan d291b49
# Suppress their generation for now.
Bryan O'Sullivan d291b49
%define __debug_install_post echo not building debuginfo 
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Name: llvm
Bryan O'Sullivan fbdd01a
Version: 2.2
Bryan O'Sullivan fbdd01a
Release: 1%{?dist}
Bryan O'Sullivan d291b49
Summary: The Low Level Virtual Machine
Bryan O'Sullivan d291b49
License: NCSA
Bryan O'Sullivan d291b49
Group: Development/Languages
Bryan O'Sullivan d291b49
URL: http://llvm.org/
Bryan O'Sullivan d291b49
Source0: http://llvm.org/releases/%{version}/llvm-%{version}.tar.gz
Bryan O'Sullivan d291b49
%if %{?_with_gcc:1}%{!?_with_gcc:0}
Bryan O'Sullivan d291b49
Source1: http://llvm.org/releases/%{version}/llvm-gcc%{lgcc_version}-%{version}.source.tar.gz
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Patch0: llvm-2.1-fix-sed.patch
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Bryan O'Sullivan d291b49
BuildRequires: bison
Bryan O'Sullivan d291b49
BuildRequires: chrpath
Bryan O'Sullivan d291b49
BuildRequires: flex
Bryan O'Sullivan d291b49
BuildRequires: gcc-c++ >= 3.4
Bryan O'Sullivan d291b49
BuildRequires: libtool-ltdl-devel
Bryan O'Sullivan d291b49
%if %{?_with_doxygen:1}%{!?_with_doxygen:0}
Bryan O'Sullivan d291b49
BuildRequires: doxygen graphviz
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%description
Bryan O'Sullivan d291b49
LLVM is a compiler infrastructure designed for compile-time,
Bryan O'Sullivan d291b49
link-time, runtime, and idle-time optimization of programs from
Bryan O'Sullivan d291b49
arbitrary programming languages.  The compiler infrastructure includes
Bryan O'Sullivan d291b49
mirror sets of programming tools as well as libraries with equivalent
Bryan O'Sullivan d291b49
functionality.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_gcc:1}%{!?_with_gcc:0}
Bryan O'Sullivan d291b49
It currently supports compilation of C and C++ programs, using front
Bryan O'Sullivan d291b49
ends derived from GCC %{lgcc_version}.
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%package devel
Bryan O'Sullivan d291b49
Summary: Libraries and header files for LLVM
Bryan O'Sullivan d291b49
Group: Development/Languages
Bryan O'Sullivan d291b49
Requires: %{name} = %{version}-%{release}
Bryan O'Sullivan d291b49
Requires: libstdc++-devel >= 3.4
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%description devel
Bryan O'Sullivan d291b49
This package contains library and header files needed to develop new
Bryan O'Sullivan d291b49
native programs that use the LLVM infrastructure.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%package doc
Bryan O'Sullivan d291b49
Summary: Documentation for LLVM
Bryan O'Sullivan d291b49
Group: Development/Languages
Bryan O'Sullivan d291b49
Requires: %{name} = %{version}-%{release}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%description doc
Bryan O'Sullivan d291b49
Documentation for the LLVM compiler infrastructure.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_gcc:1}%{!?_with_gcc:0}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%package gcc
Bryan O'Sullivan d291b49
Summary: C compiler for LLVM
Bryan O'Sullivan d291b49
License: GPL
Bryan O'Sullivan d291b49
Group: Development/Languages
Bryan O'Sullivan d291b49
Requires: %{name} = %{version}-%{release}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%description gcc
Bryan O'Sullivan d291b49
C compiler for LLVM.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%package gcc-c++
Bryan O'Sullivan d291b49
Summary: C++ compiler for LLVM
Bryan O'Sullivan d291b49
License: GPL
Bryan O'Sullivan d291b49
Group: Development/Languages
Bryan O'Sullivan d291b49
Requires: %{name}-gcc = %{version}-%{release}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%description gcc-c++
Bryan O'Sullivan d291b49
C++ compiler for LLVM.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_doxygen:1}%{!?_with_doxygen:0}
Bryan O'Sullivan d291b49
%package apidoc
Bryan O'Sullivan d291b49
Summary: API documentation for LLVM
Bryan O'Sullivan d291b49
Group: Development/Languages
Bryan O'Sullivan d291b49
Requires: %{name}-docs = %{version}-%{release}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%description apidoc
Bryan O'Sullivan d291b49
API documentation for the LLVM compiler infrastructure.
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%prep
Bryan O'Sullivan d291b49
%setup -q -n llvm-%{version} %{?_with_gcc:-a1}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%patch0 -p1 -b .fix-sed
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%build
Bryan O'Sullivan d291b49
# We're not building a debuginfo package yet, because some generated
Bryan O'Sullivan d291b49
# files don't include build IDs.
Bryan O'Sullivan d291b49
cat /dev/null > debugfiles.list
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%configure \
Bryan O'Sullivan d291b49
  --libdir=%{_libdir}/%{name} \
Bryan O'Sullivan d291b49
  --datadir=%{_datadir}/%{name}-%{version} \
Bryan O'Sullivan d291b49
  --disable-static \
Bryan O'Sullivan d291b49
  --enable-assertions \
Bryan O'Sullivan d291b49
  --enable-debug-runtime \
Bryan O'Sullivan d291b49
  --enable-jit \
Bryan O'Sullivan d291b49
  --enable-optimized \
Bryan O'Sullivan d291b49
  --enable-shared \
Bryan O'Sullivan d291b49
  --enable-targets=host-only \
Bryan O'Sullivan d291b49
  --with-pic
Bryan O'Sullivan d291b49
make %{_smp_mflags} tools-only VERBOSE=1 OmitFramePointer='' REQUIRES_EH=1 \
Bryan O'Sullivan d291b49
  OPTIMIZE_OPTION='%{optflags}'
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_gcc:1}%{!?_with_gcc:0}
Bryan O'Sullivan d291b49
# Build llvm-gcc.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
export PATH=%{_builddir}/%{?buildsubdir}/Release/bin:$PATH
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
mkdir llvm-gcc%{lgcc_version}-%{version}.source/build
Bryan O'Sullivan d291b49
cd llvm-gcc%{lgcc_version}-%{version}.source/build
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
../configure \
Bryan O'Sullivan d291b49
  --host=%{_host} \
Bryan O'Sullivan d291b49
  --build=%{_build} \
Bryan O'Sullivan d291b49
  --target=%{_target_platform} \
Bryan O'Sullivan d291b49
  --prefix=%{_libdir}/llvm-gcc \
Bryan O'Sullivan d291b49
  --libdir=%{_libdir}/llvm-gcc/%{_lib} \
Bryan O'Sullivan d291b49
  --enable-threads \
Bryan O'Sullivan d291b49
  --disable-nls \
Bryan O'Sullivan d291b49
%ifarch x86_64
Bryan O'Sullivan d291b49
  --disable-multilib \
Bryan O'Sullivan d291b49
  --disable-shared \
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
  --enable-languages=c,c++ \
Bryan O'Sullivan d291b49
  --enable-llvm=%{_builddir}/%{?buildsubdir} \
Bryan O'Sullivan d291b49
  --program-prefix=llvm-
Bryan O'Sullivan d291b49
make %{_smp_mflags} LLVM_VERSION_INFO=%{version}
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%install
Bryan O'Sullivan d291b49
rm -rf %{buildroot}
Bryan O'Sullivan d291b49
chmod -x examples/Makefile
Bryan O'Sullivan d291b49
make install \
Bryan O'Sullivan d291b49
  PROJ_prefix=%{buildroot}/%{_prefix} \
Bryan O'Sullivan d291b49
  PROJ_bindir=%{buildroot}/%{_bindir} \
Bryan O'Sullivan d291b49
  PROJ_libdir=%{buildroot}/%{_libdir}/%{name} \
Bryan O'Sullivan d291b49
  PROJ_datadir=%{buildroot}/%{_datadir} \
Bryan O'Sullivan d291b49
  PROJ_docsdir=%{buildroot}/%{_docdir}/%{name}-%{version} \
Bryan O'Sullivan d291b49
  PROJ_etcdir=%{buildroot}/%{_datadir}/%{name}-%{version} \
Bryan O'Sullivan d291b49
  PROJ_includedir=%{buildroot}/%{_includedir} \
Bryan O'Sullivan d291b49
  PROJ_infodir=%{buildroot}/%{_infodir} \
Bryan O'Sullivan d291b49
  PROJ_mandir=%{buildroot}/%{_mandir}
Bryan O'Sullivan d291b49
find %{buildroot} -name .dir -print0 | xargs -0r rm -f
Bryan O'Sullivan d291b49
file %{buildroot}/%{_bindir}/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
# Get rid of erroneously installed example files.
Bryan O'Sullivan d291b49
rm %{buildroot}%{_libdir}/%{name}/LLVMHello.*
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
# Remove deprecated tools.
Bryan O'Sullivan d291b49
rm %{buildroot}%{_bindir}/gcc{as,ld}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
sed -i 's,ABS_RUN_DIR/lib",ABS_RUN_DIR/%{_lib}/%{name}",' \
Bryan O'Sullivan d291b49
  %{buildroot}%{_bindir}/llvm-config
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
chmod -x %{buildroot}%{_libdir}/%{name}/*.[oa]
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_gcc:1}%{!?_with_gcc:0}
Bryan O'Sullivan d291b49
# Install llvm-gcc.
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
make -C llvm-gcc%{lgcc_version}-%{version}.source/build install DESTDIR=%{buildroot}
Bryan O'Sullivan d291b49
cd %{buildroot}%{_libdir}/llvm-gcc/%{_lib}
Bryan O'Sullivan d291b49
find . -name '*.la' -print0 | xargs -0r rm
Bryan O'Sullivan d291b49
find . -name '*.a' -exec %{buildroot}%{_bindir}/llvm-ranlib {} \;
Bryan O'Sullivan d291b49
cd ../bin
Bryan O'Sullivan d291b49
ln llvm-c++ llvm-gcc llvm-g++ %{buildroot}%{_bindir}
Bryan O'Sullivan d291b49
rm llvm-cpp llvm-gccbug llvm-gcov %{_target_platform}-gcc*
Bryan O'Sullivan d291b49
cd ..
Bryan O'Sullivan d291b49
mv man/man1/llvm-gcc.1 man/man1/llvm-g++.1 %{buildroot}%{_mandir}/man1
Bryan O'Sullivan d291b49
rm -r info man %{_lib}/libiberty.a
Bryan O'Sullivan d291b49
rm -r libexec/gcc/%{_target_platform}/%{lgcc_version}/install-tools
Bryan O'Sullivan d291b49
rm -r %{_lib}/gcc/%{_target_platform}/%{lgcc_version}/install-tools
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%clean
Bryan O'Sullivan d291b49
rm -rf %{buildroot}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%post -p /sbin/ldconfig
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%postun -p /sbin/ldconfig
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%files
Bryan O'Sullivan d291b49
%defattr(-,root,root,-)
Bryan O'Sullivan d291b49
%doc CREDITS.TXT LICENSE.TXT README.txt
Bryan O'Sullivan d291b49
%exclude %{_bindir}/llvm-config
Bryan O'Sullivan d291b49
%{_bindir}/bugpoint
Bryan O'Sullivan d291b49
%{_bindir}/llc
Bryan O'Sullivan d291b49
%{_bindir}/lli
Bryan O'Sullivan d291b49
%{_bindir}/llvm*
Bryan O'Sullivan d291b49
%{_bindir}/opt
Bryan O'Sullivan d291b49
%doc %{_mandir}/man1/*.1.gz
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_doxygen:1}%{!?_with_doxygen:0}
Bryan O'Sullivan d291b49
%exclude %{_bindir}/llvm-[cg]++
Bryan O'Sullivan d291b49
%exclude %{_bindir}/llvm-gcc
Bryan O'Sullivan d291b49
%exclude %{_mandir}/man1/llvm-[cg]++.*
Bryan O'Sullivan d291b49
%exclude %{_mandir}/man1/llvm-gcc.*
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%files devel
Bryan O'Sullivan d291b49
%defattr(-,root,root,-)
Bryan O'Sullivan d291b49
%{_bindir}/llvm-config
Bryan O'Sullivan d291b49
%{_datadir}/%{name}-%{version}
Bryan O'Sullivan d291b49
%{_includedir}/%{name}
Bryan O'Sullivan d291b49
%{_includedir}/%{name}-c
Bryan O'Sullivan d291b49
%{_libdir}/%{name}
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%files doc
Bryan O'Sullivan d291b49
%defattr(-,root,root,-)
Bryan O'Sullivan d291b49
%doc docs/*.{html,css} docs/img examples
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_doxygen:1}%{!?_with_doxygen:0}
Bryan O'Sullivan d291b49
%files apidoc
Bryan O'Sullivan d291b49
%defattr(-,root,root,-)
Bryan O'Sullivan d291b49
%doc docs/doxygen
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%if %{?_with_gcc:1}%{!?_with_gcc:0}
Bryan O'Sullivan d291b49
%files gcc
Bryan O'Sullivan d291b49
%defattr(-,root,root,-)
Bryan O'Sullivan d291b49
%{_bindir}/llvm-gcc
Bryan O'Sullivan d291b49
%dir %{_libdir}/llvm-gcc
Bryan O'Sullivan d291b49
%dir %{_libdir}/llvm-gcc/bin
Bryan O'Sullivan d291b49
%dir %{_libdir}/llvm-gcc/include
Bryan O'Sullivan d291b49
%dir %{_libdir}/llvm-gcc/%{_lib}
Bryan O'Sullivan d291b49
%dir %{_libdir}/llvm-gcc/libexec
Bryan O'Sullivan d291b49
%dir %{_libdir}/llvm-gcc/libexec/gcc
Bryan O'Sullivan d291b49
%dir %{_libdir}/llvm-gcc/libexec/gcc/%{_target_platform}/%{lgcc_version}
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/%{_lib}/gcc
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/%{_lib}/libmudflap*.a
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/bin/%{_target_platform}-llvm-gcc
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/bin/llvm-gcc
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/include/mf-runtime.h
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/libexec/gcc/%{_target_platform}/%{lgcc_version}/cc1
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/libexec/gcc/%{_target_platform}/%{lgcc_version}/collect2
Bryan O'Sullivan d291b49
%doc %{_mandir}/man1/llvm-gcc.*
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%files gcc-c++
Bryan O'Sullivan d291b49
%defattr(-,root,root,-)
Bryan O'Sullivan d291b49
%{_bindir}/llvm-[cg]++
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/%{_lib}/lib*++.a
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/bin/%{_target_platform}-llvm-[cg]++
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/bin/llvm-[cg]++
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/include/c++
Bryan O'Sullivan d291b49
%{_libdir}/llvm-gcc/libexec/gcc/%{_target_platform}/%{lgcc_version}/cc1plus
Bryan O'Sullivan d291b49
%doc %{_mandir}/man1/llvm-g++.*
Bryan O'Sullivan d291b49
%endif
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
%changelog
Bryan O'Sullivan d291b49
* Sun Jan 20 2008 Bryan O'Sullivan <bos@serpentine.com> - 2.1-2
Bryan O'Sullivan d291b49
- Fix review comments
Bryan O'Sullivan d291b49
Bryan O'Sullivan d291b49
* Sun Jan 20 2008 Bryan O'Sullivan <bos@serpentine.com> - 2.1-1
Bryan O'Sullivan d291b49
- Initial version