Репозиторий Sisyphus
Последнее обновление: 1 июня 2020 | Пакетов: 17568 | Посещений: 18677451
en ru br
Репозитории ALT

Группа :: Разработка/C
Пакет: llvm7.0

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

%global v_major 7.0
%global llvm_svnrel %nil
%global clang_svnrel %nil
%global rel alt7
%global llvm_name llvm%v_major
%global clang_name clang%v_major
%global lld_name lld%v_major

# Decrease debuginfo verbosity to reduce memory consumption during final library linking

%define optflags_debug -g1

%def_disable tests
%def_with clang

Name: %llvm_name
Version: 7.0.1
Release: %rel.rel
Summary: The Low Level Virtual Machine

Group: Development/C
License: NCSA
Url: http://llvm.org
Source0: http://llvm.org/releases/%version/llvm-%version.tar
Source1: http://llvm.org/releases/%version/clang-%version.tar
Source2: http://llvm.org/releases/%version/lld-%version.tar
Source3: http://llvm.org/releases/%version/compiler-rt-%version.tar
Patch:  clang-alt-i586-fallback.patch
Patch1: clang-alt-triple.patch
Patch2: llvm-alt-cmake-path.patch
Patch3: llvm-alt-fix-linking.patch
Patch4: llvm-alt-triple.patch
Patch5: compiler-rt-alt-i586-arch.patch
Patch6: RH-0001-CMake-Split-static-library-exports-into-their-own-ex.patch
Patch7: clang-alt-aarch64-dynamic-linker-path.patch
Patch8: 0001-unittests-Don-t-install-TestPlugin.so.patch
Patch9: 0001-Don-t-set-rpath-when-installing.patch
Patch10: 0001-Filter-out-cxxflags-not-supported-by-clang.patch
Patch11: 0001-AMDGPU-test-for-uniformity-of-branch-instruction-not.patch
Patch12: 0001-llvm-objdump-Implement-z-disassemble-zeroes.patch
Patch13: 0001-llvm-nm-Add-portability-as-alias-for-format-posix.patch
Patch14: lld-7-alt-mipsel-permit-textrels-by-default.patch
Patch15: lld-rL342604-PPC64-Handle-ppc64le-triple-in-getBitcodeMa.patch
Patch16: lld-rLLD344747-PPC64-Fix-offset-checks-on-rel24-call-rel.patch
Patch17: llvm-7-alt-python2.patch

# ThinLTO requires /proc/cpuinfo to exists so the same does llvm

BuildPreReq: /proc

BuildRequires(pre): cmake >= 3.4.3
# Due to %%_libsuff
BuildRequires: rpm-build >= 4.0.4-alt112
BuildRequires: chrpath libstdc++-devel libffi-devel perl-Pod-Parser perl-devel
BuildRequires: python-modules-compiler python-modules-unittest python-modules-xml
BuildRequires: python-modules-json zip zlib-devel
BuildRequires: python-module-sphinx-devel binutils-devel
BuildRequires: ninja-build
%if_with clang
BuildRequires: %clang_name %llvm_name-devel %lld_name
# FIXME!!
# this should be fixed in rpm macros
%remove_optflags -frecord-gcc-switches

%else
BuildRequires: gcc-c++
%endif #with clang

Provides: llvm = %EVR
Obsoletes: llvm <= 6.0.0

%description
LLVM is a compiler infrastructure designed for compile-time, link-time,
runtime, and idle-time optimization of programs from arbitrary
programming languages. The compiler infrastructure includes mirror sets
of programming tools as well as libraries with equivalent functionality.

%package devel
Group: Development/C
Summary: Libraries and header files for LLVM
Provides: llvm-devel = %EVR
Obsoletes: llvm-devel <= 6.0.0
Requires: %name = %EVR

%description devel
This package contains library and header files needed to develop new
native programs that use the LLVM infrastructure.

%package devel-static
Summary: Static libraries for LLVM
Group: Development/C
Provides: llvm-devel-static = %EVR
Obsoletes: llvm-devel-static <= 6.0.0
Requires: %name-devel = %EVR

%description devel-static
This package contains static libraries needed to develop new
native programs that use the LLVM infrastructure.

%package libs
Group: Development/C
Summary: LLVM shared libraries

%description libs
Shared libraries for the LLVM compiler infrastructure.

%package doc
Summary: Documentation for LLVM
Group: Documentation
BuildArch: noarch
Provides: llvm-doc = %EVR
Obsoletes: llvm-doc <= 6.0.0

%description doc
Documentation for the LLVM compiler infrastructure.

%package -n %clang_name
Summary: A C language family frontend for LLVM
License: NCSA
Group: Development/C
Requires: gcc
Provides: clang = %EVR
Obsoletes: clang <= 6.0.0

%description -n %clang_name
clang: noun
   1. A loud, resonant, metallic sound.
   2. The strident call of a crane or goose.
   3. C-language family front-end toolkit.

The goal of the Clang project is to create a new C, C++, Objective C
and Objective C++ front-end for the LLVM compiler. Its tools are built
as libraries and designed to be loosely-coupled and extendable.

%package -n %clang_name-libs
Group: Development/C
Summary: clang shared libraries

%description -n %clang_name-libs
Shared libraries for the clang compiler.

%package -n %clang_name-devel
Summary: Header files for clang
Group: Development/C
Provides: clang-devel = %EVR
Obsoletes: clang-devel <= 6.0.0
Requires: %clang_name = %EVR

%description -n %clang_name-devel
This package contains header files for the Clang compiler.

%package -n %clang_name-devel-static
Summary: Static libraries for clang
Group: Development/C
Provides: clang-devel-static = %EVR
Obsoletes: clang-devel-static <= 6.0.0
Requires: %clang_name-devel = %EVR

%description -n %clang_name-devel-static
This package contains static libraries for the Clang compiler.

%package -n %clang_name-analyzer
Summary: A source code analysis framework
License: NCSA
Group: Development/C
BuildArch: noarch
Provides: clang-analyzer = %EVR
Obsoletes: clang-analyzer <= 6.0.0
Requires: %clang_name = %EVR

%description -n %clang_name-analyzer
The Clang Static Analyzer consists of both a source code analysis
framework and a standalone tool that finds bugs in C and Objective-C
programs. The standalone tool is invoked from the command-line, and is
intended to run in tandem with a build of a project or code base.

%package -n %clang_name-doc
Summary: Documentation for Clang
Group: Documentation
BuildArch: noarch
Provides: clang-doc = %EVR
Obsoletes: clang-doc <= 6.0.0

%description -n %clang_name-doc
Documentation for the Clang compiler front-end.

%package -n %lld_name
Summary: LLD - The LLVM Linker
License: NCSA
Group: Development/C
Provides: lld = %EVR
Obsoletes: lld < %EVR

%description -n %lld_name
LLD is a linker from the LLVM project. That is a drop-in replacement for system
linkers and runs much faster than them. It also provides features that are
useful for toolchain developers.

%package -n %lld_name-devel
Summary: Header files for LLD
Group: Development/C
Provides: lld-devel = %EVR
Requires: %lld_name = %EVR
Obsoletes: lld-devel < %EVR

%description -n %lld_name-devel
This package contains header files for the LLD linker.

%package -n %lld_name-doc
Summary: Documentation for LLD
Group: Documentation
BuildArch: noarch
Provides: lld-doc = %EVR
Obsoletes: lld-doc < %EVR

%description -n %lld_name-doc
Documentation for the LLD linker.

%prep
%setup -n llvm-%version -a1 -a2 -a3
for pkg in clang lld; do
  mv $pkg-%version tools/$pkg
done
mv compiler-rt-%version projects/compiler-rt
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1

%build
%cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DLLVM_TARGETS_TO_BUILD="host;AMDGPU;BPF;NVPTX;" \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='AVR' \
-DLLVM_ENABLE_LIBCXX:BOOL=OFF \
-DLLVM_ENABLE_ZLIB:BOOL=ON \
-DLLVM_ENABLE_FFI:BOOL=ON \
-DLLVM_ENABLE_RTTI:BOOL=ON \
-DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON \
-DLLVM_BINUTILS_INCDIR="%_includedir/bfd" \
%if_with clang
-DLLVM_ENABLE_LTO=Thin \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_RANLIB:PATH=%_bindir/llvm-ranlib \
-DCMAKE_AR:PATH=%_bindir/llvm-ar \
-DCMAKE_NM:PATH=%_bindir/llvm-nm \
-DLLVM_ENABLE_LLD:BOOL=ON \
%else
-DLLVM_ENABLE_LTO=On \
-DLLVM_USE_LINKER=gold \
-DCMAKE_AR:PATH=%_bindir/gcc-ar \
-DCMAKE_NM:PATH=%_bindir/gcc-nm \
-DCMAKE_RANLIB:PATH=%_bindir/gcc-ranlib \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic" \
%endif
\
-DLLVM_LIBDIR_SUFFIX="%_libsuff" \
-DLLVM_BUILD_RUNTIME:BOOL=ON \
\
-DLLVM_INCLUDE_TOOLS:BOOL=ON \
-DLLVM_BUILD_TOOLS:BOOL=ON \
\
%if_enabled tests
-DLLVM_INCLUDE_TESTS:BOOL=ON \
-DLLVM_BUILD_TESTS:BOOL=ON \
%endif
\
-DLLVM_INCLUDE_EXAMPLES:BOOL=ON \
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
\
-DLLVM_INCLUDE_UTILS:BOOL=ON \
-DLLVM_INSTALL_UTILS:BOOL=OFF \
\
-DLLVM_INCLUDE_DOCS:BOOL=ON \
-DLLVM_BUILD_DOCS:BOOL=ON \
-DLLVM_ENABLE_SPHINX:BOOL=ON \
-DSPHINX_WARNINGS_AS_ERRORS:BOOL=OFF \
-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
-DLLVM_DYLIB_EXPORT_ALL:BOOL=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF

ninja \
      -vvv \
      -j %__nprocs \
      -C BUILD

%install
pushd BUILD
cmake -DCMAKE_INSTALL_PREFIX=%buildroot%prefix ../
popd
ninja -C BUILD install

# And prepare Clang documentation

rm -rf BUILD/clang-docs
mkdir -p BUILD/clang-docs
for f in LICENSE.TXT NOTES.txt README.txt; do
 ln tools/clang/$f BUILD/clang-docs/
done
rm -rf tools/clang/docs/{doxygen*,Makefile*,*.graffle,tools}

file %buildroot%_bindir/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
file %buildroot%_libdir/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d

%check
%if_enabled tests
LD_LIBRARY_PATH=%buildroot%_libdir:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
ninja -C BUILD check-all || :
%endif

%files
%doc CREDITS.TXT LICENSE.TXT README.txt
%_bindir/*
%_man1dir/*
%exclude %_bindir/llvm-config*
%exclude %_bindir/*clang*
%exclude %_bindir/c-index-test
%exclude %_bindir/scan-*
%exclude %_man1dir/llvm-config.1.*
%exclude %_man1dir/clang.1*
%exclude %_man1dir/scan-build.1*
%exclude %_bindir/lld*
%exclude %_bindir/ld*.lld
%exclude %_bindir/wasm-ld

%files libs
%_libdir/libLLVM-*.so
%_libdir/libLTO.so.*
%exclude %_libdir/LLVMgold.so
%exclude %_libdir/libclang.so.*

%files devel
%_bindir/llvm-config
%_man1dir/llvm-config.1.*
%_includedir/llvm
%_includedir/llvm-c
%_libdir/libLLVM.so
%_libdir/libLTO.so
%_libdir/LLVMgold.so
%_libdir/LLVMHello.so
%_libdir/BugpointPasses.so
%exclude %_libdir/libclang.so
%_datadir/cmake/Modules/llvm
%exclude %_datadir/cmake/Modules/llvm/LLVMStaticExports.cmake

%files devel-static
%_libdir/*.a
%exclude %_libdir/libclang*.a
%_datadir/cmake/Modules/llvm/LLVMStaticExports.cmake

%files doc
%doc %_docdir/llvm

%files -n %clang_name
%doc BUILD/clang-docs/*
%_bindir/*clang*
%_bindir/c-index-test
%_libdir/clang
%_man1dir/clang.1*

%files -n %clang_name-libs
%_libdir/libclang.so.*

%files -n %clang_name-devel
%_includedir/clang
%_includedir/clang-c
%_libdir/libclang.so
%_datadir/cmake/Modules/clang

%files -n %clang_name-devel-static
%_libdir/libclang*.a

%files -n %clang_name-analyzer
%_prefix/libexec/*-analyzer
%_bindir/scan-build
%_bindir/scan-view
%_datadir/scan-build
%_datadir/scan-view
%_man1dir/scan-build.1*

%files -n %clang_name-doc
%doc %_docdir/clang

%files -n %lld_name
%_bindir/lld*
%_bindir/ld*.lld
%_bindir/wasm-ld

%files -n %lld_name-devel
%dir %_includedir/lld
%_includedir/lld/*

%files -n %lld_name-doc
%doc %_docdir/lld

%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin