mirror of
https://src.fedoraproject.org/rpms/llvm.git
synced 2024-11-25 01:35:17 +00:00
626da9456a
Remove version.spec.inc from git ================================ We no longer track `version.spec.inc` in git. This is useful for development. If we build a snapshot, the file is required but if we build a `release` build (see below), then we don't include it. Make improvements ================= We distinguish between `snapshot-` and `release-` builds now in the `Makefile`. These old targets are mapped to their new counterparts and a deprecation warning is shown: * `setup` -> `snapshot-setup` * `local-rpm` -> `snapshot-rpm` * `local-srpm` -> `snapshot-srpm` * `local-prep` -> `snapshot-prep` * `local-clean` -> `snapshot-clean` We also have these new Make targets that run the build process with a release tarball instead: * `release-setup` * `release-rpm` * `release-srpm` * `release-prep` * `release-clean` The targets `local-list-check` and `local-tmt-vm` have been commented out because I think they were not needed. I just kept them for future reference of research done in those areas. All builds described by the `Makefile` are still local and no `mock` is involved. I find this the easiest to debug. Toggle default bcond state for snapshot_build ============================================= We want to be able to build non-snapshot releases with this repo. That's why be default the build condition `snapshot_build` is off. So only when you explicitly enable `--with=snapshot_build` or define `--define "_with_snapshot_build 1"` you'll be able to build a snapshot. If however the build happens in Copr with a namespace that begins with `fedora-llvm-team/llvm-snapshots-`, then the build condition is ON by default and there's no need to enable it explicitly with `--with=snapshot_build`. Things related to release update ================================ * Add llvm-project tarball and signature to sources * Fix: error: source 1001 defined multiple times * Fix: error: source 1006 defined multiple times * Fix missing newline * Conditionally apply 0001-Always-build-shared-libs-for-LLD.patch * Only enable offload runtime in snapshot mode Misc. ===== * Add missing prep dependency
238 lines
6.7 KiB
PHP
238 lines
6.7 KiB
PHP
# TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le
|
|
%ifarch s390 s390x %ix86
|
|
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
|
|
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
|
|
%endif
|
|
|
|
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
|
|
export ASMFLAGS="%{build_cflags}"
|
|
|
|
# We set CLANG_DEFAULT_PIE_ON_LINUX=OFF and PPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON to match the
|
|
# defaults used by Fedora's GCC.
|
|
|
|
#region BEGIN: COPIED FROM CLANG
|
|
|
|
# TODO(kkleine): Make sure the paths actually work. I have the feeling this needs adjustment
|
|
pwd
|
|
%if 0%{?__isa_bits} == 64
|
|
sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/64/g' llvm/test/lit.cfg.py
|
|
%else
|
|
sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' llvm/test/lit.cfg.py
|
|
%endif
|
|
|
|
# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things.
|
|
%ifarch aarch64
|
|
%define _find_debuginfo_dwz_opts %{nil}
|
|
%endif
|
|
|
|
#endregion
|
|
|
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:`pwd`/llvm/%{_vpath_builddir}/%{_lib}"
|
|
|
|
cd llvm
|
|
|
|
# TODO(kkleine): Follow more closely the Distribution guidelines found here: https://llvm.org/docs/BuildingADistribution.html
|
|
# force off shared libs as cmake macros turns it on.
|
|
# TODO: Disable LLVM_UNREACHABLE_OPTIMIZE.
|
|
# TODO: LIBOMP_HAVE_VERSION_SCRIPT_FLAG should be set automatically.
|
|
# TODO: Override LIBOMP_INSTALL_LIBDIR, because otherwise the libraries
|
|
# are installed to /usr/lib64/$TRIPLE and clang can't find them.
|
|
%cmake -G Ninja \
|
|
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb" \
|
|
\
|
|
\
|
|
-DCLANG_DEFAULT_PIE_ON_LINUX=OFF \
|
|
%if 0%{?fedora} || 0%{?rhel} > 9
|
|
-DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON \
|
|
%endif
|
|
-DPYTHON_EXECUTABLE=%{__python3} \
|
|
%if %{with compat_build}
|
|
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
|
|
-DCLANG_INCLUDE_TESTS:BOOL=OFF \
|
|
-DCLANG_BUILD_TOOLS:BOOL=OFF \
|
|
%else
|
|
-DLLVM_INCLUDE_TESTS:BOOL=ON \
|
|
-DCLANG_INCLUDE_TESTS:BOOL=ON \
|
|
-DLLVM_BUILD_UTILS:BOOL=ON \
|
|
%endif
|
|
-DCLANG_ENABLE_ARCMT:BOOL=ON \
|
|
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \
|
|
-DCLANG_INCLUDE_DOCS:BOOL=ON \
|
|
-DCLANG_PLUGIN_SUPPORT:BOOL=ON \
|
|
-DENABLE_LINKER_BUILD_ID:BOOL=ON \
|
|
-DLLVM_ENABLE_EH=ON \
|
|
-DCLANG_LINK_CLANG_DYLIB=ON \
|
|
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
|
|
-DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \
|
|
-DCLANG_RESOURCE_DIR=../lib/clang/%{maj_ver} \
|
|
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra \
|
|
-DCLANG_CONFIG_FILE_SYSTEM_DIR=%{_sysconfdir}/%{pkg_name_clang}/ \
|
|
-DCLANG_DEFAULT_UNWINDLIB=libgcc \
|
|
\
|
|
\
|
|
\
|
|
\
|
|
%if %{without compat_build}
|
|
%if %{with snapshot_build}
|
|
-DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;offload" \
|
|
%else
|
|
-DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp" \
|
|
%endif
|
|
%endif
|
|
\
|
|
\
|
|
\
|
|
\
|
|
\
|
|
%if %{without compat_build}
|
|
-DCOMPILER_RT_INSTALL_PATH=%{_prefix}/lib/clang/%{maj_ver} \
|
|
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
|
|
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF \
|
|
%endif
|
|
\
|
|
\
|
|
\
|
|
\
|
|
\
|
|
%if %{without compat_build}
|
|
-DLIBOMP_HAVE_VERSION_SCRIPT_FLAG:BOOL=ON \
|
|
-DLIBOMP_INSTALL_ALIASES=OFF \
|
|
%if 0%{?__isa_bits} == 64
|
|
-DOPENMP_LIBDIR_SUFFIX=64 \
|
|
%else
|
|
-DOPENMP_LIBDIR_SUFFIX= \
|
|
%endif
|
|
%endif
|
|
-DOPENMP_INSTALL_LIBDIR=%{_lib} \
|
|
-DOFFLOAD_INSTALL_LIBDIR=%{_lib} \
|
|
\
|
|
\
|
|
\
|
|
\
|
|
-DBUILD_SHARED_LIBS:BOOL=OFF \
|
|
-DLLVM_PARALLEL_LINK_JOBS=1 \
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DCMAKE_SKIP_RPATH:BOOL=ON \
|
|
%ifarch s390 %ix86
|
|
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
|
|
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
|
|
%endif
|
|
%if %{without compat_build}
|
|
%if 0%{?__isa_bits} == 64
|
|
-DLLVM_LIBDIR_SUFFIX=64 \
|
|
%else
|
|
-DLLVM_LIBDIR_SUFFIX= \
|
|
%endif
|
|
%endif
|
|
\
|
|
-DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \
|
|
-DLLVM_ENABLE_LIBCXX:BOOL=OFF \
|
|
-DLLVM_ENABLE_ZLIB:BOOL=ON \
|
|
-DLLVM_ENABLE_FFI:BOOL=ON \
|
|
-DLLVM_ENABLE_RTTI:BOOL=ON \
|
|
-DLLVM_USE_PERF:BOOL=ON \
|
|
%if %{with gold}
|
|
-DLLVM_BINUTILS_INCDIR=%{_includedir} \
|
|
%endif
|
|
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \
|
|
\
|
|
-DLLVM_BUILD_RUNTIME:BOOL=ON \
|
|
\
|
|
-DLLVM_INCLUDE_TOOLS:BOOL=ON \
|
|
-DLLVM_BUILD_TOOLS:BOOL=ON \
|
|
\
|
|
-DLLVM_BUILD_TESTS:BOOL=ON \
|
|
%if %{with compat_build}
|
|
-DLLVM_INSTALL_GTEST:BOOL=OFF \
|
|
%else
|
|
-DLLVM_INSTALL_GTEST:BOOL=ON \
|
|
%endif
|
|
-DLLVM_LIT_ARGS="-vv" \
|
|
\
|
|
-DLLVM_INCLUDE_EXAMPLES:BOOL=ON \
|
|
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
|
|
\
|
|
-DLLVM_INCLUDE_UTILS:BOOL=ON \
|
|
%if %{with compat_build}
|
|
-DLLVM_INSTALL_UTILS:BOOL=OFF \
|
|
%else
|
|
-DLLVM_INSTALL_UTILS:BOOL=ON \
|
|
-DLLVM_UTILS_INSTALL_DIR:PATH=%{_bindir} \
|
|
-DLLVM_TOOLS_INSTALL_DIR:PATH=bin \
|
|
%endif
|
|
\
|
|
-DLLVM_INCLUDE_DOCS:BOOL=ON \
|
|
-DLLVM_BUILD_DOCS:BOOL=ON \
|
|
-DLLVM_ENABLE_SPHINX:BOOL=ON \
|
|
-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \
|
|
-DLLVM_APPEND_VC_REV:BOOL=OFF \
|
|
\
|
|
%if %{with snapshot_build}
|
|
-DLLVM_VERSION_SUFFIX="%{llvm_snapshot_version_suffix}" \
|
|
%else
|
|
%if %{without compat_build}
|
|
-DLLVM_VERSION_SUFFIX='' \
|
|
%endif
|
|
%endif
|
|
-DLLVM_UNREACHABLE_OPTIMIZE:BOOL=ON \
|
|
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
|
|
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
|
|
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \
|
|
-DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \
|
|
-DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \
|
|
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
|
|
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
|
|
-DLLVM_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \
|
|
-DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \
|
|
-DLLVM_INCLUDE_BENCHMARKS=OFF \
|
|
\
|
|
\
|
|
-DLLVM_DYLIB_COMPONENTS="all" \
|
|
-DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \
|
|
\
|
|
\
|
|
\
|
|
-DLLDB_DISABLE_CURSES:BOOL=OFF \
|
|
-DLLDB_DISABLE_LIBEDIT:BOOL=OFF \
|
|
-DLLDB_DISABLE_PYTHON:BOOL=OFF \
|
|
-DPYTHON_VERSION_MAJOR:STRING=$(%{__python3} -c "import sys; print(sys.version_info.major)") \
|
|
-DPYTHON_VERSION_MINOR:STRING=$(%{__python3} -c "import sys; print(sys.version_info.minor)") \
|
|
%ifarch ppc64le
|
|
-DLLDB_TEST_USER_ARGS=--skip-category=watchpoint \
|
|
%endif
|
|
-DLLDB_ENFORCE_STRICT_TEST_REQUIREMENTS:BOOL=ON \
|
|
\
|
|
\
|
|
\
|
|
%ifarch x86_64
|
|
-DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -Wl,-z,cet-report=error" \
|
|
%endif
|
|
%if %{with lto_build}
|
|
%if 0%{?fedora} >= 41
|
|
-DLLVM_UNITTEST_LINK_FLAGS="-fno-lto"
|
|
%else
|
|
-DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0"
|
|
%endif
|
|
%endif
|
|
|
|
# Build libLLVM.so first. This ensures that when libLLVM.so is linking, there
|
|
# are no other compile jobs running. This will help reduce OOM errors on the
|
|
# builders without having to artificially limit the number of concurrent jobs.
|
|
%cmake_build --target LLVM
|
|
|
|
# Also build libclang-cpp.so separately to avoid OOM errors.
|
|
# This is to fix occasional OOM errors on the ppc64le COPR builders.
|
|
%cmake_build --target libclang-cpp.so
|
|
|
|
%cmake_build
|
|
|
|
# If we don't build the runtimes target here, we'll have to wait for the %check
|
|
# section until these files are available but they need to be installed.
|
|
#
|
|
# /usr/lib64/libomptarget.devicertl.a
|
|
# /usr/lib64/libomptarget-amdgpu-*.bc
|
|
# /usr/lib64/libomptarget-nvptx-*.bc
|
|
|
|
%cmake_build --target runtimes
|
|
|
|
cd ..
|