94c103
# Components enabled if supported by target architecture:
94c103
%ifarch %ix86 x86_64
94c103
  %bcond_without gold
94c103
%else
94c103
  %bcond_with gold
94c103
%endif
94c103
d437c1
%if 0%{?rhel} == 6
d437c1
%define rhel6 1
d437c1
%endif
d437c1
d437c1
# llvm works on the 64-bit versions of these, but not the 32 versions.
d437c1
# consequently we build swrast on them instead of llvmpipe.
d437c1
ExcludeArch: ppc s390 %{?rhel6:s390x}
d437c1
94c103
%ifarch s390x
94c103
%global host_target SystemZ
94c103
%endif
94c103
%ifarch ppc64 ppc64le
94c103
%global host_target PowerPC
94c103
%endif
94c103
%ifarch %ix86 x86_64
94c103
%global host_target X86
94c103
%endif
94c103
%ifarch aarch64
94c103
%global host_target AArch64
94c103
%endif
94c103
%ifarch %{arm}
94c103
%global host_target ARM
94c103
%endif
94c103
94c103
%ifnarch s390x
94c103
%global amdgpu ;AMDGPU
94c103
%endif
94c103
94c103
Name:		mesa-private-llvm
4ee08c
Version:	3.9.1
4ee08c
Release:	3%{?dist}
94c103
Summary:	llvm engine for Mesa
94c103
94c103
Group:          System Environment/Libraries
94c103
License:	NCSA
94c103
URL:		http://llvm.org
94c103
Source0:	http://llvm.org/releases/%{version}/llvm-%{version}.src.tar.xz
4ee08c
Source1:        cmake-3.4.3.tar.gz
94c103
Source100:	llvm-config.h
94c103
94c103
Patch1: fix-cmake-include.patch
4ee08c
Patch2: 0001-Revert-Merging-r280589.patch
4ee08c
Patch3: 0001-Revert-InstCombine-transform-bitcasted-bitwise-logic.patch
94c103
94c103
BuildRequires:	cmake
94c103
BuildRequires:	zlib-devel
94c103
%if %{with gold}
94c103
BuildRequires:  binutils-devel
94c103
%endif
94c103
BuildRequires:  libstdc++-static
94c103
BuildRequires:  python
d437c1
d437c1
%description
d437c1
This package contains the LLVM-based runtime support for Mesa.  It is not a
d437c1
fully-featured build of LLVM, and use by any package other than Mesa is not
d437c1
supported.
d437c1
d437c1
%package devel
94c103
Summary:	Libraries and header files for LLVM
94c103
Requires:	%{name}%{?_isa} = %{version}-%{release}
d437c1
d437c1
%description devel
d437c1
This package contains library and header files needed to build the LLVM
d437c1
support in Mesa.
d437c1
d437c1
%prep
94c103
%setup -q -n llvm-%{version}.src
4ee08c
4ee08c
tar xf %{SOURCE1}
4ee08c
94c103
%patch1 -p1 -b .fixinc
4ee08c
%patch2 -p1 -b .radeonsi-fix
4ee08c
%patch3 -p1 -b .bigendian-fix
c7871d
d437c1
%build
94c103
4ee08c
BUILD_DIR=`pwd`/cmake_build
4ee08c
cd cmake-3.4.3
4ee08c
cmake . -DCMAKE_INSTALL_PREFIX=$BUILD_DIR
4ee08c
make
4ee08c
make install
4ee08c
cd -
4ee08c
4ee08c
d437c1
sed -i 's|ActiveIncludeDir = ActivePrefix + "/include|&/mesa-private|g' tools/llvm-config/llvm-config.cpp
d437c1
94c103
mkdir -p _build
94c103
cd _build
94c103
4ee08c
export PATH=$BUILD_DIR/bin:$PATH
4ee08c
%global __cmake $BUILD_DIR/bin/cmake
94c103
# force off shared libs as cmake macros turns it on.
94c103
%cmake .. \
94c103
	-DINCLUDE_INSTALL_DIR=%{_includedir}/mesa-private \
94c103
	-DLLVM_VERSION_SUFFIX="-mesa" \
94c103
	-DBUILD_SHARED_LIBS:BOOL=OFF \
94c103
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
94c103
	-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic -static-libstdc++" \
94c103
%if 0%{?__isa_bits} == 64
94c103
	-DLLVM_LIBDIR_SUFFIX=64 \
94c103
%else
94c103
	-DLLVM_LIBDIR_SUFFIX= \
94c103
%endif
94c103
	\
94c103
	-DLLVM_TARGETS_TO_BUILD="%{host_target}%{?amdgpu}" \
94c103
	-DLLVM_ENABLE_LIBCXX:BOOL=OFF \
94c103
	-DLLVM_ENABLE_ZLIB:BOOL=ON \
94c103
	-DLLVM_ENABLE_FFI:BOOL=OFF \
94c103
	-DLLVM_ENABLE_RTTI:BOOL=OFF \
94c103
%if %{with gold}
94c103
	-DLLVM_BINUTILS_INCDIR=%{_includedir} \
94c103
%endif
94c103
	\
94c103
	-DLLVM_BUILD_RUNTIME:BOOL=ON \
94c103
	\
94c103
	-DLLVM_INCLUDE_TOOLS:BOOL=ON \
94c103
	-DLLVM_BUILD_TOOLS:BOOL=ON \
94c103
	\
94c103
	-DLLVM_INCLUDE_TESTS:BOOL=ON \
94c103
	-DLLVM_BUILD_TESTS:BOOL=ON \
94c103
	\
94c103
	-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
94c103
	-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
94c103
	\
94c103
	-DLLVM_INCLUDE_UTILS:BOOL=ON \
94c103
	-DLLVM_INSTALL_UTILS:BOOL=OFF \
94c103
	\
94c103
	-DLLVM_INCLUDE_DOCS:BOOL=OFF \
94c103
	-DLLVM_BUILD_DOCS:BOOL=OFF \
94c103
	-DLLVM_ENABLE_SPHINX:BOOL=OFF \
94c103
	-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \
94c103
	\
94c103
	-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
94c103
	-DLLVM_DYLIB_EXPORT_ALL:BOOL=ON \
94c103
	-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
94c103
	-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \
94c103
	-DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF
94c103
94c103
make %{?_smp_mflags} VERBOSE=1
d437c1
d437c1
%install
94c103
cd _build
d437c1
make install DESTDIR=%{buildroot}
d437c1
94c103
# fix multi-lib
94c103
mv -v %{buildroot}%{_bindir}/llvm-config %{buildroot}%{_bindir}/%{name}-config-%{__isa_bits}
94c103
mv -v %{buildroot}%{_includedir}/mesa-private/llvm/Config/llvm-config{,-%{__isa_bits}}.h
94c103
install -m 0644 %{SOURCE100} %{buildroot}%{_includedir}/mesa-private/llvm/Config/llvm-config.h
d437c1
d437c1
rm -f %{buildroot}%{_libdir}/*.a
d437c1
94c103
rm -f %{buildroot}%{_libdir}/libLLVM.so
c7871d
d437c1
# remove documentation makefiles:
d437c1
# they require the build directory to work
d437c1
find examples -name 'Makefile' | xargs -0r rm -f
d437c1
d437c1
# RHEL: strip out most binaries, most libs, and man pages
d437c1
ls %{buildroot}%{_bindir}/* | grep -v bin/mesa-private | xargs rm -f
d437c1
ls %{buildroot}%{_libdir}/* | grep -v libLLVM | xargs rm -f
d437c1
rm -rf %{buildroot}%{_mandir}/man1
d437c1
d437c1
# RHEL: Strip out some headers Mesa doesn't need
94c103
rm -rf %{buildroot}%{_includedir}/mesa-private/llvm/{Assembly}
94c103
rm -rf %{buildroot}%{_includedir}/mesa-private/llvm/Option
d437c1
rm -rf %{buildroot}%{_includedir}/mesa-private/llvm/TableGen
94c103
rm -rf %{buildroot}%{_includedir}/llvm-c/lto.h
d437c1
c7871d
# RHEL: Strip out cmake build foo
c7871d
rm -rf %{buildroot}%{_datadir}/llvm/cmake
4ee08c
rm -rf %{buildroot}%{_libdir}/cmake/llvm
c7871d
d437c1
%check
94c103
cd _build
94c103
# 3.8.1 note: skx failures are XFAIL. the skylake backport does not wire
94c103
# up AVX512 for skylake, but the tests are from code that expects that.
94c103
# safe to ignore.
94c103
make check-all || :
d437c1
d437c1
%post -p /sbin/ldconfig
d437c1
%postun -p /sbin/ldconfig
d437c1
d437c1
%files
d437c1
%doc LICENSE.TXT
4ee08c
%{_libdir}/libLLVM-3.9*-mesa.so
d437c1
d437c1
%files devel
d437c1
%{_bindir}/%{name}-config-%{__isa_bits}
d437c1
%{_includedir}/mesa-private/llvm
d437c1
%{_includedir}/mesa-private/llvm-c
d437c1
d437c1
%changelog
4ee08c
* Wed May 03 2017 Lyude Paul <lyude@redhat.com> - 3.9.1-3
4ee08c
- Add temporary revert for #1445423
4ee08c
4ee08c
* Fri Mar 24 2017 Tom Stellard <tstellar@redhat.com> - 3.9.1-2
4ee08c
- Add fix for radeonsi regression
4ee08c
4ee08c
* Tue Jan 10 2017 Jeff Law  <law@redhat.com> - 3.9.1-1
4ee08c
- Update to 3.9.1
4ee08c
94c103
* Wed Jul 13 2016 Adam Jackson <ajax@redhat.com> - 3.8.1-1
94c103
- Update to 3.8.1
94c103
- Sync some x86 getHostCPUName updates from trunk
003ced
94c103
* Tue Jun 14 2016 Dave Airlie <airlied@redhat.com> - 3.8.0-2
94c103
- drop private cmake build
003ced
94c103
* Thu Mar 10 2016 Dave Airlie <airlied@redhat.com> 3.8.0-1
94c103
- llvm 3.8.0 final release
c7871d
94c103
* Thu Mar 03 2016 Dave Airlie <airlied@redhat.com> 3.8.0-0.2
94c103
- llvm 3.8.0 rc3 release
c7871d
94c103
* Fri Feb 19 2016 Dave Airlie <airlied@redhat.com> 3.8.0-0.1
94c103
- llvm 3.8.0 rc2 release
c7871d
94c103
* Tue Feb 16 2016 Dan HorĂ¡k <dan[at][danny.cz> 3.7.1-7
94c103
- recognize s390 as SystemZ when configuring build
c6b5fb
94c103
* Sat Feb 13 2016 Dave Airlie <airlied@redhat.com> 3.7.1-6
94c103
- export C++ API for mesa.
c6b5fb
94c103
* Sat Feb 13 2016 Dave Airlie <airlied@redhat.com> 3.7.1-5
94c103
- reintroduce llvm-static, clang needs it currently.
c6b5fb
94c103
* Fri Feb 12 2016 Dave Airlie <airlied@redhat.com> 3.7.1-4
94c103
- jump back to single llvm library, the split libs aren't working very well.
d437c1
94c103
* Fri Feb 05 2016 Dave Airlie <airlied@redhat.com> 3.7.1-3
94c103
- add missing obsoletes (#1303497)
d437c1
94c103
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.1-2
94c103
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
d437c1
94c103
* Thu Jan 07 2016 Jan Vcelak <jvcelak@fedoraproject.org> 3.7.1-1
94c103
- new upstream release
94c103
- enable gold linker
d437c1
94c103
* Wed Nov 04 2015 Jan Vcelak <jvcelak@fedoraproject.org> 3.7.0-100
94c103
- fix Requires for subpackages on the main package
d437c1
94c103
* Tue Oct 06 2015 Jan Vcelak <jvcelak@fedoraproject.org> 3.7.0-100
94c103
- initial version using cmake build system