mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
5/llvm: Add LLVM as a package for RTEMS.
- Add '%source download <source>' to only download the source and do not unpack and prep. This can used when a package internally needs another source package. - Install the staging root only if it is present. A package may internally build another package that is not staged as it is not suitable for installing. Updates #3250 Updatew #3797
This commit is contained in:
152
source-builder/config/llvm-common-1.cfg
Normal file
152
source-builder/config/llvm-common-1.cfg
Normal file
@@ -0,0 +1,152 @@
|
||||
#
|
||||
# LLVM Common Support.
|
||||
#
|
||||
# This configuration file configure's, make's and install's LLVM and some of
|
||||
# it projects.
|
||||
#
|
||||
|
||||
%include %{_configdir}/checks.cfg
|
||||
|
||||
#
|
||||
# The package description.
|
||||
#
|
||||
Name: rtems-llvm-%{llvm_version}-%{_host}-%{release}
|
||||
Summary: LLVM v%{llvm_version} on host %{_host}
|
||||
Version: %{llvm_version}
|
||||
Release: %{release}
|
||||
URL: http://llvm.org/
|
||||
|
||||
#
|
||||
# The LLVM version depends on the type of build we are doing.
|
||||
#
|
||||
%if %{rsb_released}
|
||||
%define rtems_llvm_version %{rsb_version}
|
||||
%else
|
||||
%define rtems_llvm_version %{rtems_version}
|
||||
%endif
|
||||
|
||||
#
|
||||
# LLVM Download URL.
|
||||
#
|
||||
%define llvm_url https://github.com/llvm/llvm-project/releases/download/llvmorg-%{llvm_version}
|
||||
|
||||
#
|
||||
# Packages
|
||||
#
|
||||
%source set cfe %{llvm_url}/cfe-%{llvm_version}.src.tar.xz
|
||||
%source set clang-tools-extra %{llvm_url}/clang-tools-extra-%{llvm_version}.src.tar.xz
|
||||
%source set compiler-rt %{llvm_url}/compiler-rt-%{llvm_version}.src.tar.xz
|
||||
%source set libcxx %{llvm_url}/libcxx-%{llvm_version}.src.tar.xz
|
||||
%source set libcxxabi %{llvm_url}/libcxxabi-%{llvm_version}.src.tar.xz
|
||||
%source set libunwind %{llvm_url}/libunwind-%{llvm_version}.src.tar.xz
|
||||
%source set lld %{llvm_url}/lld-%{llvm_version}.src.tar.xz
|
||||
%source set lldb %{llvm_url}/lldb-%{llvm_version}.src.tar.xz
|
||||
%source set llvm %{llvm_url}/llvm-%{llvm_version}.src.tar.xz
|
||||
%source set openmp %{llvm_url}/openmp-%{llvm_version}.src.tar.xz
|
||||
|
||||
#
|
||||
# Build LLDB on all hosts except MacOS as it reqires a codesign login key of
|
||||
# name 'llvm'.
|
||||
#
|
||||
%if %{_build_os} != darwin
|
||||
%define with_llvm_lldb 1
|
||||
%endif
|
||||
|
||||
%if %{defined with_llvm_lldb}
|
||||
%define lldb_codesign_identity -DLLDB_CODESIGN_IDENTITY=llvm
|
||||
%else
|
||||
%define lldb_codesign_identity %{nil}
|
||||
%endif
|
||||
|
||||
#
|
||||
# Prepare the source code.
|
||||
#
|
||||
%prep
|
||||
# save the build top directory and cd back to it rather than
|
||||
# using 'cd ..' because some shells change $PWD to a symlink's
|
||||
# target location and 'cd ..' fails.
|
||||
build_top=$(pwd)
|
||||
|
||||
llvm_source=%{?llvm_external:%{llvm_expand_name}}%{!?llvm_external:"llvm-%{llvm_version}"}
|
||||
|
||||
# llvm is a collection of separate packages, download them and then create
|
||||
# the source tree.
|
||||
|
||||
source_dir_llvm=${llvm_source}
|
||||
|
||||
%source setup llvm -q
|
||||
%{__mv} llvm-%{llvm_version}.src ${source_dir_llvm}
|
||||
|
||||
%source setup cfe -q
|
||||
%{__mv} cfe-%{llvm_version}.src ${source_dir_llvm}/tools/clang
|
||||
|
||||
%source setup clang-tools-extra -q
|
||||
%{__mv} clang-tools-extra-%{llvm_version}.src ${source_dir_llvm}/tools/clang/extra
|
||||
|
||||
%source setup compiler-rt -q
|
||||
%{__mv} compiler-rt-%{llvm_version}.src ${source_dir_llvm}/projects/compiler-rt
|
||||
|
||||
%source setup libcxx -q
|
||||
%{__mv} libcxx-%{llvm_version}.src ${source_dir_llvm}/projects/libcxx
|
||||
|
||||
%source setup libcxxabi -q
|
||||
%{__mv} libcxxabi-%{llvm_version}.src ${source_dir_llvm}/projects/libcxxabi
|
||||
|
||||
%source setup libunwind -q
|
||||
%{__mv} libunwind-%{llvm_version}.src ${source_dir_llvm}/projects/libunwind
|
||||
|
||||
%source setup lld -q
|
||||
%{__mv} lld-%{llvm_version}.src ${source_dir_llvm}/tools/lld
|
||||
|
||||
%if %{defined with_llvm_lldb}
|
||||
%source setup lldb -q
|
||||
%{__mv} lldb-%{llvm_version}.src ${source_dir_llvm}/tools/lldb
|
||||
%endif
|
||||
|
||||
%source setup openmp -q
|
||||
%{__mv} openmp-%{llvm_version}.src ${source_dir_llvm}/tools/openmp
|
||||
|
||||
%patch setup llvm -p1
|
||||
|
||||
cd ${build_top}
|
||||
|
||||
%build
|
||||
build_top=$(pwd)
|
||||
|
||||
# SWIG will be built and installed into %{swig_prefix} if defined
|
||||
# so add it as a path.
|
||||
%if %{defined swig_prefix}
|
||||
export PATH=%{swig_prefix}/bin:$PATH
|
||||
%endif
|
||||
|
||||
%{build_directory}
|
||||
|
||||
mkdir -p ${build_dir}
|
||||
cd ${build_dir}
|
||||
|
||||
%{__cmake} -Wno-dev \
|
||||
-G "Unix Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DPACKAGE_VERSION="%{llvm_version} (%{llvm_version_message})" \
|
||||
%{lldb_codesign_identity} \
|
||||
../${source_dir_llvm}
|
||||
|
||||
version_inc="tools/clang/include/clang/Basic/Version.inc"
|
||||
%{__cat} ${version_inc} | \
|
||||
sed -e 's/CLANG_VERSION_STRING "[0-9]*\.[0-9]*\.[0-9]*/& \(%{llvm_version_message}\)/g' \
|
||||
> ${version_inc}.tmp
|
||||
%{__mv} ${version_inc}.tmp ${version_inc}
|
||||
|
||||
%{__make} %{?_smp_mflags}
|
||||
|
||||
cd ${build_top}
|
||||
|
||||
%install
|
||||
build_top=$(pwd)
|
||||
|
||||
%{__rmdir} $SB_BUILD_ROOT
|
||||
|
||||
cd ${build_dir}
|
||||
%{__make} DESTDIR=$SB_BUILD_ROOT install
|
||||
cd ${build_top}
|
97
source-builder/config/swig-4-1.cfg
Normal file
97
source-builder/config/swig-4-1.cfg
Normal file
@@ -0,0 +1,97 @@
|
||||
#
|
||||
# SWIG 4.xx Version 1.
|
||||
#
|
||||
# This configuration file configure's, make's and install's m4
|
||||
#
|
||||
# Warning: this package is only for bootstrapping within a build.
|
||||
#
|
||||
|
||||
|
||||
Name: swig-%{swig_version}-%{_host}-%{release}
|
||||
Summary: SWIG v%{swig_version} for host %{_host}
|
||||
Version: %{swig_version}
|
||||
Release: %{release}
|
||||
URL: http://www.swig.org/
|
||||
|
||||
#
|
||||
# Source
|
||||
#
|
||||
%source set swig --rsb-file=swig-rel-%{swig_version}.tar.gz https://github.com/swig/swig/archive/rel-%{swig_version}.tar.gz
|
||||
%source set pcre https://ftp.pcre.org/pub/pcre/pcre-%{pcre_version}.tar.bz2
|
||||
|
||||
#
|
||||
# See if a special swig prefix is provided
|
||||
#
|
||||
%if %{defined swig_prefix}
|
||||
%define _disable_collecting yes
|
||||
%define _disable_packaging yes
|
||||
%define _disable_reporting yes
|
||||
%define _disable_installing yes
|
||||
%endif
|
||||
|
||||
#
|
||||
# Prepare the source code.
|
||||
#
|
||||
%prep
|
||||
build_top=$(pwd)
|
||||
|
||||
source_dir_swig="swig-rel-%{swig_version}"
|
||||
|
||||
%source setup swig -q -n swig-rel-%{swig_version}
|
||||
%source download pcre
|
||||
|
||||
%patch setup swig -p1
|
||||
|
||||
# SWIG does not ship from github with it's generated files. We
|
||||
# need to generate them.
|
||||
# Add the path to the internal autoconf tools
|
||||
SWIG_XPATH=$PATH
|
||||
%if %{defined _internal_autotools_path}
|
||||
export PATH=%{_internal_autotools_path}/bin:$PATH
|
||||
%endif
|
||||
./autogen.sh
|
||||
export PATH=$SWIG_XPATH
|
||||
|
||||
cd ${build_top}
|
||||
|
||||
%build
|
||||
build_top=$(pwd)
|
||||
|
||||
%{build_directory}
|
||||
|
||||
mkdir -p ${build_dir}
|
||||
cd ${build_dir}
|
||||
|
||||
%{host_build_flags}
|
||||
|
||||
# build PCRE using the SWIG script as it is a static link
|
||||
%{__cp} %{_sourcedir}/pcre-%{pcre_version}.tar.bz2 pcre-%{pcre_version}.tar.bz2
|
||||
../${source_dir_swig}/Tools/pcre-build.sh
|
||||
|
||||
%if %{defined swig_prefix}
|
||||
prefix=%{swig_prefix}
|
||||
%else
|
||||
prefix=%{_prefix}
|
||||
%endif
|
||||
|
||||
../${source_dir_swig}/configure \
|
||||
--host=%{_host} \
|
||||
--prefix=${prefix}
|
||||
|
||||
%{__make} %{?_smp_mflags}
|
||||
|
||||
cd ${build_top}
|
||||
|
||||
%install
|
||||
build_top=$(pwd)
|
||||
|
||||
%{__rmdir} ${SB_BUILD_ROOT}
|
||||
|
||||
cd ${build_dir}
|
||||
%if %{!defined swig_prefix}
|
||||
%define destdir DESTDIR=${SB_BUILD_ROOT}
|
||||
%else
|
||||
%define destdir %{nil}
|
||||
%endif
|
||||
%{__make} %{destdir} install
|
||||
cd ${build_top}
|
Reference in New Issue
Block a user