summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-07-12 08:25:15 +1000
committerChris Johns <chrisj@rtems.org>2019-07-21 21:09:34 +1000
commit8db33fbe434267d385e637a14f38d444c72254fa (patch)
tree618a7fe3a19cf0181b54e2aafdd0063b29bf02a2
parentsb/config: Fix GDB probes when using python-config. (diff)
downloadrtems-source-builder-8db33fbe434267d385e637a14f38d444c72254fa.tar.bz2
rtems: Add kernel, libbsd and BSP building as packages.
-rw-r--r--rtems/config/5/bsps/beagleboneblack.bset19
-rw-r--r--rtems/config/5/rtems-default.bset1
-rw-r--r--rtems/config/5/rtems-kernel.bset15
-rw-r--r--rtems/config/5/rtems-libbsd.bset8
-rw-r--r--rtems/config/rtems-base.bset9
-rw-r--r--rtems/config/rtems-bsp.cfg42
-rw-r--r--rtems/config/tools/rtems-kernel-4-1.cfg179
-rw-r--r--rtems/config/tools/rtems-kernel-5.cfg7
-rw-r--r--rtems/config/tools/rtems-kernel-common.cfg229
-rw-r--r--rtems/config/tools/rtems-libbsd-5.cfg13
-rw-r--r--rtems/config/tools/rtems-libbsd-common.cfg79
-rw-r--r--rtems/config/tools/rtems-tools-common-1.cfg15
-rw-r--r--source-builder/defaults.mc12
-rw-r--r--source-builder/sb/build.py21
-rw-r--r--source-builder/sb/config.py74
15 files changed, 474 insertions, 249 deletions
diff --git a/rtems/config/5/bsps/beagleboneblack.bset b/rtems/config/5/bsps/beagleboneblack.bset
new file mode 100644
index 0000000..68b590a
--- /dev/null
+++ b/rtems/config/5/bsps/beagleboneblack.bset
@@ -0,0 +1,19 @@
+#
+# BeagleBone Black
+#
+# Build into the prefix path:
+#
+# - ARM tools
+# - RTEMS Kernel and BSP
+# - LibBSD
+# - Packages
+#
+
+%define rtems_target arm-rtems5
+%define rtems_host arm-rtems5
+%define with_rtems_bsp beagleboneblack
+
+
+5/rtems-arm
+5/rtems-kernel
+5/rtems-libbsd
diff --git a/rtems/config/5/rtems-default.bset b/rtems/config/5/rtems-default.bset
index d57388f..47780e7 100644
--- a/rtems/config/5/rtems-default.bset
+++ b/rtems/config/5/rtems-default.bset
@@ -20,4 +20,3 @@ tools/rtems-gdb-8.2.1-1
tools/rtems-binutils-2.32
tools/rtems-gcc-fb371a33fa6-newlib-5c2a3661c
tools/rtems-tools-5-1
-tools/rtems-kernel-5
diff --git a/rtems/config/5/rtems-kernel.bset b/rtems/config/5/rtems-kernel.bset
new file mode 100644
index 0000000..080af0b
--- /dev/null
+++ b/rtems/config/5/rtems-kernel.bset
@@ -0,0 +1,15 @@
+#
+# RTEMS Kernel configuration.
+#
+%define release 1
+
+#
+# The RTEMS version and URLs
+#
+%include rtems-version.bset
+%include rtems-urls.bset
+
+#
+# Build the kernel.
+#
+tools/rtems-kernel-5
diff --git a/rtems/config/5/rtems-libbsd.bset b/rtems/config/5/rtems-libbsd.bset
new file mode 100644
index 0000000..ff9c2e7
--- /dev/null
+++ b/rtems/config/5/rtems-libbsd.bset
@@ -0,0 +1,8 @@
+#
+# RTEMS LibBSD configuration.
+#
+
+#
+# Build the kernel.
+#
+tools/rtems-libbsd-5
diff --git a/rtems/config/rtems-base.bset b/rtems/config/rtems-base.bset
index 5a7cc98..6749ce4 100644
--- a/rtems/config/rtems-base.bset
+++ b/rtems/config/rtems-base.bset
@@ -27,3 +27,12 @@ package: rtems-%{rtems_version}-%{_target}-%{_host}-%{release}
# Pick up the RTEMS URLs.
#
%include rtems-urls.bset
+
+#
+# Handle the Waf install root.
+#
+%ifos win32 mingw ming32
+ %define rtems_waf_build_root_suffix %{waf_build_root_suffix}
+%else
+ %define rtems_waf_build_root_suffix %{nil}
+%endif
diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index 8e1c12a..404ad6a 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -32,18 +32,16 @@
%endif
#
-# The target is used by compilers or Cxc builds.
-#
-%if %{_target} != %{nil}
- %error RTEMS BSP builds use --host and not --target
-%endif
-
-#
# We need a host from the user to specifiy the RTEMS architecture and major
-# version.
+# version. It can be defined in rtems_host.
#
-%if %{_host} == %{nil} && %{rtems_bsp_error}
- %error No RTEMS host or BSP specified: --host=<arch>-rtems<ver>
+%if %{defined rtems_host}
+ %define _host %{rtems_host}
+%endif
+%if %{rtems_bsp_error}
+ %if %{_host} == %{nil} || %{_host} == %{_build}
+ %error No RTEMS host or BSP specified: --host=<arch>-rtems<ver>
+ %endif
%endif
#
@@ -51,7 +49,7 @@
#
%ifn %{defined with_rtems_bsp}
%if %{rtems_bsp_error}
- %error No RTEMS BSP specified: --rtems-bsp=arch/bsp (or --with-rtems-bsp=bsp)
+ %error No RTEMS BSP specified: --with-rtems-bsp=bsp
%endif
%define with_rtems_bsp sparc/erc32
%endif
@@ -61,10 +59,16 @@
#
%ifn %{defined with_tools}
%define with_tools %{_prefix}
+ %define rtems_waf_tools %{nil}
+%else
+ %define rtems_waf_tools --rtems-tools=%{with_tools}
%endif
%ifn %{defined with_rtems}
%define with_rtems %{_prefix}
+ %define rtems_waf_rtems %{nil}
+%else
+ %define rtems_waf_rtems --rtems=%{with_rtems}
%endif
#
@@ -91,7 +95,7 @@
%define rtems_bsp_libs %{pkgconfig libs %{_host}-%{rtems_bsp}}
%if %{rtems_bsp_cflags} == %{nil} && %{rtems_bsp_error}
- %error No RTEMS BSP CFLAGS found; Please check the --rtems-bsp option.
+ %error No RTEMS BSP CFLAGS found; Please check the --with-rtems-bsp option.
%endif
%if %{rtems_bsp_ccflags} == %{nil}
@@ -99,6 +103,11 @@
%endif
#
+# The RTEMS BSP architecture/bsp.
+#
+%define rtems_bsp_arch_bsp %{_host_arch}/%{rtems_bsp}
+
+#
# RTEMS BSP paths
#
%define rtems_bsp_cc %{_host}-gcc
@@ -156,3 +165,12 @@
%define host_cxxflags %{rtems_bsp_ccflags}
%define host_ldflags %{rtems_bsp_ldflags}
%define host_libs %{rtems_bsp_libs}
+
+#
+# Handle the Waf install root.
+#
+%ifos win32 mingw ming32
+ %define rtems_waf_build_root_suffix %{waf_build_root_suffix}
+%else
+ %define rtems_waf_build_root_suffix %{nil}
+%endif
diff --git a/rtems/config/tools/rtems-kernel-4-1.cfg b/rtems/config/tools/rtems-kernel-4-1.cfg
index 8c725a5..26e7d9c 100644
--- a/rtems/config/tools/rtems-kernel-4-1.cfg
+++ b/rtems/config/tools/rtems-kernel-4-1.cfg
@@ -3,181 +3,4 @@
#
# This configuration file configure's, make's and install's RTEMS.
#
-
-%if %{rsb_released}
- %define rtems_kernel_version %{rsb_version}
-%else
- %define rtems_kernel_version %{rtems_version}
-%endif
-
-#
-# Package details.
-#
-Name: %{_target}-kernel-%{rtems_kernel_version}-%{release}
-Summary: RTEMS v%{rtems_kernel_version} for target %{_target} on host %{_host}
-Version: %{rtems_kernel_version}
-Release: %{release}
-URL: http://www.rtems.org/
-
-#
-# Build if the RSB is released or optionally enable/disable building the RTEMS
-# kernel via the command line.
-#
-%if %{rsb_released} || %{defined with_rtems}
- %define rtems_kernel_build 1
-%else
- %define rtems_kernel_build 0
-%endif
-%if %{defined without_rtems}
- %define rtems_kernel_build 0
-%endif
-
-%if %{rtems_kernel_build}
- %include %{_configdir}/checks.cfg
- %include %{_configdir}/base.cfg
- %include %{_configdir}/versions.cfg
-
- #
- # A magic internal path that would break if changes in the defaults.mc
- # macro file are made.
- #
- %define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
-
- #
- # Check the version of autoconf. Check autoreconf as it is used.
- #
- %if %{__autoreconf_ver} <= 2.68
- %if %{__autoreconf_bindir_ver} <= 2.68
- %if %{__autoreconf_path_ver} <= 2.68
- %error Autoconf (autoreconf) version 2.69 or higher is needed.
- %endif
- %endif
- %endif
-
- #
- # Source
- #
- %if %{rsb_released}
- %if ! %{defined rtems_kernel_compression}
- %define rtems_kernel_compression xz
- %endif
- %define rtems_kernel_version %{rtems_version}
- %define rtems_bootstrap 0
- %else
- #
- # The code in git needs to be bootstrapped. Do each build because we have
- # no way to change what changes may have happened in the code.
- #
- %define rtems_bootstrap 1
- %endif
-
- %if ! %{defined rtems_kernel_version}
- %define rtems_kernel_version HEAD
- %endif
- %if %{defined rtems_kernel_git_commit_hash}
- %define rtems_kernel_git_checkout ?checkout=%{defined rtems_kernel_git_commit_hash}
- %else
- %define rtems_kernel_git_checkout %{nil}
- %endif
-
- %source set rtems git://git.rtems.org/rtems.git?reset=hard?branch=%{rtems_kernel_version}?pull%{rtems_kernel_git_checkout} #
- # If C++ defined for the tool set use it to control RTEMS's setting..
- #
- %if %{defined enable_cxx}
- %define rtems_cxx %{enable_cxx}
- %endif
-
- #
- # Default set up.
- #
- %ifn %{defined rtems_posix}
- %define rtems_posix 1
- %endif
- %ifn %{defined rtems_networking}
- %define rtems_networking 1
- %endif
- %ifn %{defined rtems_cxx}
- %define rtems_cxx 1
- %endif
- %ifn %{defined rtems_tests}
- %define rtems_tests samples
- %endif
-
- %if %{rtems_tests} == disable
- %define rtems_tests_opt --disable-tests
- %else
- %define rtems_tests_opt --enable-tests=%{rtems_tests}
- %endif
-
- #
- # Check the various --with/--without options we support.
- #
- # --with-rtemsbsp : Supported, list of BSPs
- # --without-rtemsbsp: Not supported
- # --with-tests : Supported, samples/yes/no
- # --without-tests : Not supported
- # --with-smp : Supported
- # --without-smp : Not care
- #
- #
- %if %{defined without_rtemsbsp}
- %error Option --without-rtemsbsp is not supported.
- %endif
- %if %{defined without_rtems_tests}
- %define with_rtems_tests no
- %endif
-
- #
- # Prepare the source code.
- #
- %prep
- source_dir_rtems="rtems-%{rtems_kernel_version}"
- %source setup rtems -q -c -n %{name}-%{version}
- cd ${source_dir_rtems}
- %patch setup rtems -p1
- %if %{rtems_bootstrap}
- %if %{defined _internal_autotools_path}
- export PATH="%{_internal_autotools_path}/bin:${PATH}"
- %endif
- ./bootstrap -c
- %{_sbdir}/sb-bootstrap --preinstall
- %{_sbdir}/sb-bootstrap
- %endif
- cd ..
-
- %build
- # Build directory support.
- if test "%{_build}" != "%{_host}" ; then
- build_dir="build-cxc"
- else
- build_dir="build"
- fi
- mkdir -p ${build_dir}
- cd ${build_dir}
-
- ../${source_dir_rtems}/configure \
- --build=%{_build} --host=%{_host} \
- --target=%{_target} \
- %{?rtems_posix:--enable-posix}%{!?rtems_posix:--disable-posix} \
- %{?rtems_networking:--enable-networking}%{!?rtems_networking:--disable-networking} \
- %{?rtems_cxx:--enable-cxx}%{!?rtems_cxx:--disable-cxx} \
- %{?with_rtems_tests:--enable-tests=%{with_rtems_tests}} \
- %{?with_rtemsbsp:--enable-rtemsbsp="%{with_rtemsbsp}"} \
- %{?with_rtems_smp:--enable-smp} \
- --prefix=%{_prefix} --bindir=%{_bindir} \
- --exec-prefix=%{_exec_prefix} \
- --includedir=%{_includedir} --libdir=%{_libdir} \
- --mandir=%{_mandir} --infodir=%{_infodir}
-
- %{__make} %{?_smp_mflags} all
- cd ..
-
- %install
- %{__rmdir} $SB_BUILD_ROOT
-
- cd ${build_dir}
- %{__make} DESTDIR=$SB_BUILD_ROOT install
-
- cd ..
-
-%endif
+%include tools/rtems-kernel-common.cfg
diff --git a/rtems/config/tools/rtems-kernel-5.cfg b/rtems/config/tools/rtems-kernel-5.cfg
index 5d5d654..7f23635 100644
--- a/rtems/config/tools/rtems-kernel-5.cfg
+++ b/rtems/config/tools/rtems-kernel-5.cfg
@@ -2,7 +2,10 @@
# RTEMS 5
#
+%define rtems_kernel_version c4d89deaa66f9878ea5499cae7210d5815afc4fe
+%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 fa4cbcfd9d10be737b91805f1fbaccb7289f3d300a2a7aafef1713d265dd97242d00aba5f1c63ead5a889cfb2148fd9d62c79dcb6f16e61f9fa1290067159b43
+
#
-# The RTEMS build instructions. We use 4.xx Release 1.
+# The RTEMS build instructions.
#
-%include tools/rtems-kernel-4-1.cfg
+%include tools/rtems-kernel-common.cfg
diff --git a/rtems/config/tools/rtems-kernel-common.cfg b/rtems/config/tools/rtems-kernel-common.cfg
new file mode 100644
index 0000000..5a79340
--- /dev/null
+++ b/rtems/config/tools/rtems-kernel-common.cfg
@@ -0,0 +1,229 @@
+#
+# RTEMS Kernel.
+#
+# This configuration file configure's, make's and install's RTEMS.
+#
+
+#
+# If a dry-run and with download ignore errors and correct setting for tools
+# and BSPs. Only after the source to download.
+#
+%if %{_dry_run} && %{defined with_download}
+ %log Kenrel configuration errors ignored
+ %define rtems_kernel_error 0
+%else
+ %define rtems_kernel_error 1
+%endif
+
+%if %{rsb_released}
+ %define rtems_kernel_version %{rsb_version}
+%endif
+
+#
+# The target. It could be set in rtems_target.
+#
+%if %{defined rtems_target}
+ %define _target %{rtems_target}
+%endif
+%if %{_target} == %{nil} && %{rtems_kernel_error}
+ %error No RTEMS target specified: --target=<arch>-rtems<ver>.
+%endif
+
+#
+# The BSP.
+#
+%if !%{defined with_rtems_bsp} && %{rtems_kernel_error}
+ %error No RTEMS BSP specified: --with-rtems-bsp=bsp
+%endif
+%define rtems_bsp %{with_rtems_bsp}
+
+#
+# If no tools are provided use the prefix.
+#
+%ifn %{defined with_tools}
+ %define with_tools %{_prefix}
+%endif
+
+#
+# Set the path to the tools.
+#
+%{path prepend %{with_tools}/bin}
+
+#
+# Define the package.
+#
+package: rtems-%{rtems_version}-%{_target}-%{rtems_bsp}-%{_host}-%{release}
+
+#
+# Package details.
+#
+Name: %{_target}-kernel-%{rtems_bsp}-%{release}
+Summary: RTEMS v%{rtems_kernel_version} for target %{_target} BSP %{rtems_bsp}
+Version: %{rtems_kernel_version}
+Release: %{release}
+URL: https://www.rtems.org/
+
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+%include %{_configdir}/versions.cfg
+
+#
+# A magic internal path that would break if changes in the defaults.mc
+# macro file are made.
+#
+%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
+
+#
+# Check the version of autoconf. Check autoreconf as it is used.
+#
+%if %{__autoreconf_ver} <= 2.68
+ %if %{__autoreconf_bindir_ver} <= 2.68
+ %if %{__autoreconf_path_ver} <= 2.68
+ %error Autoconf (autoreconf) version 2.69 or higher is needed.
+ %endif
+ %endif
+%endif
+
+#
+# If no tools provided use the prefix.
+#
+%ifn %{defined with_tools}
+ %define with_tools %{_prefix}
+%endif
+
+#
+# Check options.
+#
+%if %{defined without_rtems_posix}
+ %define rtems_posix 0
+%endif
+
+%if %{defined with_rtems_legacy_network}
+ %define rtems_networking 1
+%endif
+
+%if %{defined with_rtems_cxx}
+ %define rtems_cxx 1
+%endif
+
+#
+# Source
+#
+%if %{rsb_released}
+ %if ! %{defined rtems_kernel_compression}
+ %define rtems_kernel_compression xz
+ %endif
+ %define rtems_kernel_version %{rtems_version}
+ %define rtems_bootstrap 0
+%else
+ #
+ # The code in git needs to be bootstrapped. Do each build because we have
+ # no way to change what changes may have happened in the code.
+ #
+ %define rtems_bootstrap 1
+%endif
+
+%if ! %{defined rtems_kernel_version}
+ %error No RTEMS kernel version defined
+%endif
+
+%source set rtems_kernel --rsb-file=rtems-kernel-%{rtems_kernel_version}.tar.bz2 https://git.rtems.org/rtems/snapshot/rtems-%{rtems_kernel_version}.tar.bz2
+
+# If C++ defined for the tool set use it to control RTEMS's setting..
+#
+%if %{defined enable_cxx}
+ %define rtems_cxx %{enable_cxx}
+%endif
+
+#
+# Default set up.
+#
+%ifn %{defined rtems_posix}
+ %define rtems_posix 1
+%endif
+%ifn %{defined rtems_networking}
+ %define rtems_networking 0
+%endif
+%ifn %{defined rtems_cxx}
+ %define rtems_cxx 0
+%endif
+%ifn %{defined rtems_tests}
+ %define rtems_tests samples
+%endif
+
+%if %{rtems_tests} == disable
+ %define rtems_tests_opt --disable-tests
+%else
+ %define rtems_tests_opt --enable-tests=%{rtems_tests}
+%endif
+
+#
+# Check the various --with/--without options we support.
+#
+# --target : The architecture
+# --with-rtems-bsp : The BSP
+# --with-tests : Supported, samples/yes/no
+# --without-tests : Not supported
+# --with-smp : Supported
+# --without-smp : Not care
+#
+#
+%if %{defined without_rtemsbsp}
+ %error Option --without-rtemsbsp is not supported.
+%endif
+%if %{defined without_rtems_tests}
+ %define with_rtems_tests no
+%endif
+
+#
+# Prepare the source code.
+#
+%prep
+ source_dir_rtems="rtems-%{rtems_kernel_version}"
+ %source setup rtems_kernel -q -c -n %{name}-%{version}
+ cd ${source_dir_rtems}
+ %patch setup rtems -p1
+%if %{rtems_bootstrap}
+ %if %{defined _internal_autotools_path}
+ export PATH="%{_internal_autotools_path}/bin:${PATH}"
+ %endif
+ ./bootstrap -c
+ %{_sbdir}/sb-bootstrap --preinstall
+ %{_sbdir}/sb-bootstrap
+%endif
+ cd ..
+
+%build
+ # Build directory support.
+ if test "%{_build}" != "%{_host}" ; then
+ build_dir="build-cxc"
+ else
+ build_dir="build"
+ fi
+ mkdir -p ${build_dir}
+ cd ${build_dir}
+
+ ../${source_dir_rtems}/configure \
+ --build=%{_build} --host=%{_host} \
+ --target=%{_target} \
+ --enable-rtemsbsp="%{rtems_bsp}" \
+ %{?rtems_posix:--enable-posix}%{!?rtems_posix:--disable-posix} \
+ %{?rtems_networking:--enable-networking}%{!?rtems_networking:--disable-networking} \
+ %{?rtems_cxx:--enable-cxx}%{!?rtems_cxx:--disable-cxx} \
+ %{?with_rtems_tests:--enable-tests=%{with_rtems_tests}} \
+ %{?with_rtems_smp:--enable-smp} \
+ --prefix=%{_prefix} --bindir=%{_bindir} \
+ --exec-prefix=%{_exec_prefix} \
+ --includedir=%{_includedir} --libdir=%{_libdir} \
+ --mandir=%{_mandir} --infodir=%{_infodir}
+
+ %{__make} %{?_smp_mflags} all
+ cd ..
+
+%install
+ %{__rmdir} $SB_BUILD_ROOT
+
+ cd ${build_dir}
+ %{__make} DESTDIR=$SB_BUILD_ROOT install
+
+ cd ..
diff --git a/rtems/config/tools/rtems-libbsd-5.cfg b/rtems/config/tools/rtems-libbsd-5.cfg
new file mode 100644
index 0000000..8f0141b
--- /dev/null
+++ b/rtems/config/tools/rtems-libbsd-5.cfg
@@ -0,0 +1,13 @@
+#
+# RTEMS 5 LibBSD
+#
+
+%define rtems_libbsd_version 313e1d5f1c8c7cd8e3d458628b040ce1c264d23c
+%hash sha512 rtems-libbsd-%{rtems_libbsd_version}.tar.bz2 1282b46eacbda01fc3eb3d3fc67c5a0d02d07f3d097b381133ad823bdbdd920c95e9faabb5430f1634ac3f1b4c797850d3a0d6a4b2aa523e677d65fe82a036a3
+%define rtems_waf_version ad6c6e8771b95dffa73a7dc1167d98d208f17cb0
+%hash sha512 rtems-waf-%{rtems_waf_version}.tar.bz2 9866ab0772cbd3aa4e641a14fad2c85acf79d8e6e08de05c32e985bb76b9f04a0a615093320b406ff4660ec1964f2c0778453b44a8b1358c6f04ccd7561cad1c
+
+#
+# The RTEMS LibBSD build instructions.
+#
+%include tools/rtems-libbsd-common.cfg
diff --git a/rtems/config/tools/rtems-libbsd-common.cfg b/rtems/config/tools/rtems-libbsd-common.cfg
new file mode 100644
index 0000000..4503e1b
--- /dev/null
+++ b/rtems/config/tools/rtems-libbsd-common.cfg
@@ -0,0 +1,79 @@
+#
+# RTEMS LibBSD
+#
+# This configuration file configure's, build's and install's libbsd.a.
+#
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+Name: rtems-libbsd-v%{rtems_libbsd_version}-%{_host}-%{release}
+Summary: RTEMS LibBSD provides libbsd, a FreeBSD kernel set of
+ services for RTEMS.
+Version: %{rtems_libbsd_version}
+Release: %{release}
+URL: https://git.rtems.org/rtems-libbsd.git/
+
+#
+# LibBSD is packaged as the release version when released.
+#
+%if %{rsb_released}
+ %define rtems_libbsd_version %{rsb_version}
+%endif
+
+#
+# RTEMS BSP support.
+#
+%include rtems-bsp.cfg
+
+#
+# LibBSD Source.
+#
+# Collect and install rtems_waf as cgit snapshots to not caputre submodules,
+# which is a good thing because we would collect the entire FreeBSD source
+
+#
+%source set rtems_libbsd https://git.rtems.org/rtems-libbsd/snapshot/rtems-libbsd-%{rtems_libbsd_version}.tar.bz2
+%source set rtems_waf https://git.rtems.org/rtems_waf/snapshot/rtems_waf-%{rtems_waf_version}.tar.bz2
+
+#
+# Prepare the source code.
+#
+%prep
+ build_top=$(pwd)
+
+ source_dir_libbsd="rtems-libbsd-%{rtems_libbsd_version}"
+ %source setup rtems_libbsd -q -n rtems-libbsd-%{rtems_libbsd_version}
+ %source setup rtems_waf -q -s 1 -c -a -n rtems-libbsd-%{rtems_libbsd_version}/rtems_waf
+
+ cd ${build_top}
+
+#
+# Build the source code.
+#
+%build
+ build_top=$(pwd)
+
+ %{host_build_flags}
+
+ cd ${source_dir_libbsd}
+
+ ./waf distclean configure \
+ --prefix=%{_prefix} \
+ %{rtems_waf_tools} \
+ %{rtems_waf_rtems}
+ --rtems-bsp=%{rtems_bsp_arch_bsp}
+
+ ./waf build
+
+ cd ${build_top}
+
+%install
+ build_top=$(pwd)
+
+ %{__rmdir} ${SB_BUILD_ROOT}
+
+ cd ${source_dir_libbsd}
+ ./waf --destdir=$SB_BUILD_ROOT%{rtems_waf_build_root_suffix} install
+ cd ${build_top}
diff --git a/rtems/config/tools/rtems-tools-common-1.cfg b/rtems/config/tools/rtems-tools-common-1.cfg
index b15fbce..c15f514 100644
--- a/rtems/config/tools/rtems-tools-common-1.cfg
+++ b/rtems/config/tools/rtems-tools-common-1.cfg
@@ -58,19 +58,6 @@ License: BSD-2-Clause + GPL-2.0
%{__rmdir} $SB_BUILD_ROOT
- #
- # If on Windows we need to add the driver prefix to the built root as waf
- # strips the driver prefix from the prefix path when joining it to the
- # destdir path. Waf is correct in doing this and the RSB is design to match
- # the configure behaviour which treats the whole path including the drive
- # prefix as part of the path as just a path.
- #
- %ifos win32 mingw ming32
- SB_BUILD_ROOT_WAF=$SB_BUILD_ROOT$(echo %{_prefix} | cut -c 1-2)
- %else
- SB_BUILD_ROOT_WAF=$SB_BUILD_ROOT
- %endif
-
cd ${source_dir_rtems_tools}
- ./waf --destdir=$SB_BUILD_ROOT_WAF install
+ ./waf --destdir=$SB_BUILD_ROOT%{rtems_waf_build_root_suffix} install
cd ${build_top}
diff --git a/source-builder/defaults.mc b/source-builder/defaults.mc
index 646be78..1feaca1 100644
--- a/source-builder/defaults.mc
+++ b/source-builder/defaults.mc
@@ -184,7 +184,7 @@ __sed: exe, required, '/usr/bin/sed'
__setup_post: exe, none, '%{__chmod} -R a+rX,g-w,o-w .'
__sh: exe, required, '/bin/sh'
__tar: exe, required, '/usr/bin/tar'
-__tar_extract: exe, none, '%{__tar} -xvvf'
+__tar_extract: exe, none, '%{__tar} -xvv'
__touch: exe, required, '/usr/bin/touch'
__unzip: exe, required, '/usr/bin/unzip'
__xz: exe, required, '/usr/bin/xz'
@@ -390,3 +390,13 @@ iso_ir_111,koi8_r,koi8_ru,koi8_u,koi8_uni,ucs_2,ucs_2_internal,\
ucs_2be,ucs_2le,ucs_4,ucs_4_internal,ucs_4be,ucs_4le,us_ascii,\
utf_16,utf_16be,utf_16le,utf_8,win_1250,win_1251,win_1252,\
win_1253,win_1254,win_1255,win_1256,win_1257,win_1258'''
+
+# Waf build root suffix, only use for win32 mingw ming32 OSs
+#
+# If on Windows we need to add the driver prefix to the built root as waf
+# strips the driver prefix from the prefix path when joining it to the
+# destdir path. Waf is correct in doing this and the RSB is design to match
+# the configure behaviour which treats the whole path including the drive
+# prefix as part of the path as just a path.
+#
+waf_build_root_suffix: none, none, ' %(echo %{_prefix} | cut -c 1-2)'
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index faa11cc..abc50c0 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -203,7 +203,7 @@ class build:
not _disable_installing and \
not _canadian_cross
- def source(self, name):
+ def source(self, name, strip_components):
#
# Return the list of sources. Merge in any macro defined sources as
# these may be overridden by user loaded macros.
@@ -246,6 +246,10 @@ class build:
url = self.config.expand(' '.join(url))
src = download.parse_url(url, '_sourcedir', self.config, self.opts, file_override)
download.get_file(src['url'], src['local'], self.opts, self.config)
+ if strip_components > 0:
+ tar_extract = '%%{__tar_extract} --strip-components %d' % (strip_components)
+ else:
+ tar_extract = '%{__tar_extract}'
if 'symlink' in src:
sname = name.replace('-', '_')
src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (src['symlink'], sname)
@@ -255,9 +259,9 @@ class build:
#
src['script'] = '%s %s' % (src['compressed'], src['local'])
if src['compressed-type'] != 'zip':
- src['script'] += ' | %{__tar_extract} -'
+ src['script'] += ' | %s -f -' % (tar_extract)
else:
- src['script'] = '%%{__tar_extract} %s' % (src['local'])
+ src['script'] = '%s -f %s' % (tar_extract, src['local'])
srcs += [src]
return srcs
@@ -266,7 +270,7 @@ class build:
setup_name = args[1]
args = args[1:]
try:
- opts, args = getopt.getopt(args[1:], 'qDcn:ba')
+ opts, args = getopt.getopt(args[1:], 'qDcn:bas:')
except getopt.GetoptError as ge:
raise error.general('source setup error: %s' % str(ge))
quiet = False
@@ -276,6 +280,7 @@ class build:
deleted_dir = False
created_dir = False
changed_dir = False
+ strip_components = 0
opt_name = None
for o in opts:
if o[0] == '-q':
@@ -290,8 +295,12 @@ class build:
unpack_before_chdir = True
elif o[0] == '-a':
unpack_before_chdir = False
+ elif o[0] == '-s':
+ if not o[1].isdigit():
+ raise error.general('source setup error: invalid strip count: %s' % (o[1]))
+ strip_components = int(o[1])
name = None
- for source in self.source(setup_name):
+ for source in self.source(setup_name, strip_components):
if name is None:
if opt_name is None:
if source:
@@ -301,7 +310,7 @@ class build:
else:
name = opt_name
self.script_build.append(self.config.expand('cd %{_builddir}'))
- if not deleted_dir and delete_before_unpack:
+ if not deleted_dir and delete_before_unpack:
self.script_build.append(self.config.expand('%{__rm} -rf ' + name))
deleted_dir = True
if not created_dir and create_dir:
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index 93a74f3..2c3a13e 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -504,9 +504,9 @@ class file:
if not f.startswith('-W'):
fflags += [f]
pkg_flags = ' '.join(fflags)
- log.trace('pkgconfig: %s: %s' % (flags, pkg_flags))
+ log.trace('pkgconfig: %s: %s' % (flags, pkg_flags))
except pkgconfig.error as pe:
- self._error('pkgconfig: %s: %s' % (flags, pe))
+ self._error('pkgconfig: %s: %s' % (flags, pe))
except:
raise error.internal('pkgconfig failure')
if pkg_flags is None:
@@ -719,7 +719,7 @@ class file:
else:
if ls[1] == 'select':
self.macros.lock_read_map()
- log.trace('config: %s: %3d: _disable_select: %s' % (self.name, self.lc,
+ log.trace('config: %s: %3d: _disable_select: %s' % (self.name, self.lc,
ls[1]))
else:
log.warning(self._name_line_msg('invalid disable statement: %s' % (ls[1])))
@@ -729,7 +729,7 @@ class file:
log.warning(self._name_line_msg('invalid select statement'))
else:
r = self.macros.set_read_map(ls[1])
- log.trace('config: %s: %3d: _select: %s %s %r' % \
+ log.trace('config: %s: %3d: _select: %s %s %r' % \
(self.name, self.lc,
r, ls[1], self.macros.maps()))
@@ -768,7 +768,7 @@ class file:
del self.macros[mn]
def _ifs(self, config, ls, label, iftrue, isvalid, dir, info):
- log.trace('config: %s: %3d: _ifs[%i]: dir=%s %i %r' % \
+ log.trace('config: %s: %3d: _ifs[%i]: dir=%s %i %r' % \
(self.name, self.lc, self.if_depth, str(dir), len(ls), ls))
in_dir = dir
in_iftrue = True
@@ -788,7 +788,7 @@ class file:
self._error(label + ' without %endif')
raise error.general('terminating build')
if r[1] == '%endif':
- log.trace('config: %s: %3d: _ifs[%i]: %%endif: dir=%s %s %s %r' % \
+ log.trace('config: %s: %3d: _ifs[%i]: %%endif: dir=%s %s %s %r' % \
(self.name, self.lc, self.if_depth,
str(dir), r[1], this_isvalid, data))
if in_dir is None:
@@ -824,7 +824,7 @@ class file:
sls = reduce(add, ls[1:], '').split()
cls = sls
- log.trace('config: %s: %3d: _if[%i]: %s' % (self.name, self.lc,
+ log.trace('config: %s: %3d: _if[%i]: %s' % (self.name, self.lc,
self.if_depth, sls))
self.if_depth += 1
@@ -839,22 +839,22 @@ class file:
elif cls[0] == '&&':
join_op = 'and'
cls = cls[1:]
- log.trace('config: %s: %3d: _if[%i]: joining: %s' % (self.name, self.lc,
- self.if_depth,
- join_op))
+ log.trace('config: %s: %3d: _if[%i]: joining: %s' % (self.name, self.lc,
+ self.if_depth,
+ join_op))
ori = 0
andi = 0
i = len(cls)
if '||' in cls:
ori = cls.index('||')
- log.trace('config: %s: %3d: _if[%i}: OR found at %i' % (self.name, self.lc,
- self.if_depth,
- ori))
+ log.trace('config: %s: %3d: _if[%i}: OR found at %i' % (self.name, self.lc,
+ self.if_depth,
+ ori))
if '&&' in cls:
andi = cls.index('&&')
- log.trace('config: %s: %3d: _if[%i]: AND found at %i' % (self.name, self.lc,
- self.if_depth,
- andi))
+ log.trace('config: %s: %3d: _if[%i]: AND found at %i' % (self.name, self.lc,
+ self.if_depth,
+ andi))
if ori > 0 or andi > 0:
if ori == 0:
i = andi
@@ -864,9 +864,9 @@ class file:
i = andi
else:
i = andi
- log.trace('config: %s: %3d: _if[%i]: next OP found at %i' % (self.name, self.lc,
- self.if_depth,
- i))
+ log.trace('config: %s: %3d: _if[%i]: next OP found at %i' % (self.name, self.lc,
+ self.if_depth,
+ i))
ls = cls[:i]
if len(ls) == 0:
self._error('invalid if expression: ' + reduce(add, sls, ''))
@@ -963,10 +963,10 @@ class file:
else:
cistrue = istrue
- log.trace('config: %s: %3d: _if[%i]: %s %s %s %s' % (self.name, self.lc,
- self.if_depth,
- ifls, str(cistrue),
- join_op, str(istrue)))
+ log.trace('config: %s: %3d: _if[%i]: %s %s %s %s' % (self.name, self.lc,
+ self.if_depth,
+ ifls, str(cistrue),
+ join_op, str(istrue)))
if invert:
cistrue = not cistrue
@@ -975,8 +975,8 @@ class file:
self.if_depth -= 1
- log.trace('config: %s: %3d: _if[%i]: %r' % (self.name, self.lc,
- self.if_depth, ifs_return))
+ log.trace('config: %s: %3d: _if[%i]: %r' % (self.name, self.lc,
+ self.if_depth, ifs_return))
return ifs_return
@@ -1036,8 +1036,12 @@ class file:
l = _clean(l)
if len(l) == 0:
continue
- log.trace('config: %s: %0d: %s %s' % \
- (self.name, self.lc, str(isvalid), l))
+ if isvalid:
+ indicator = '>'
+ else:
+ indicator = ' '
+ log.trace('config: %s: %3d:%s%s [%s]' % \
+ (self.name, self.lc, indicator, l, str(isvalid)))
lo = l
if isvalid:
l = self._expand(l)
@@ -1090,12 +1094,12 @@ class file:
elif ls[0] == '%if':
d = self._if(config, ls, isvalid, dir, info)
if len(d):
- log.trace('config: %s: %3d: %%if: %s' % (self.name, self.lc, d))
+ log.trace('config: %s: %3d: %%if: %s' % (self.name, self.lc, d))
return ('data', d)
elif ls[0] == '%ifn':
d = self._if(config, ls, isvalid, dir, info, True)
if len(d):
- log.trace('config: %s: %3d: %%ifn: %s' % (self.name, self.lc, d))
+ log.trace('config: %s: %3d: %%ifn: %s' % (self.name, self.lc, d))
return ('data', d)
elif ls[0] == '%ifos':
d = self._ifos(config, ls, isvalid, dir, info)
@@ -1142,7 +1146,7 @@ class file:
if isvalid:
for d in self._directive:
if ls[0].strip() == d:
- log.trace('config: %s: %0d: _parse: directive: %s' % \
+ log.trace('config: %s: %3d: _parse: directive: %s' % \
(self.name, self.lc, ls[0].strip()))
return ('directive', ls[0].strip(), ls[1:])
log.warning(self._name_line_msg("unknown directive: '" + ls[0] + "'"))
@@ -1176,7 +1180,7 @@ class file:
return (directive, info, data)
def _process_data(self, results, directive, info, data):
- log.trace('config: %s: %3d: _process_data: result=#%r# directive=#%s# info=#%r# data=#%r#' % \
+ log.trace('config: %s: %3d: _process_data: result=#%r# directive=#%s# info=#%r# data=#%r#' % \
(self.name, self.lc, results, directive, info, data))
new_data = []
for l in results[1]:
@@ -1192,7 +1196,7 @@ class file:
if not directive:
l = self._expand(l)
ls = self.tags.split(l, 1)
- log.trace('config: %s: %3d: _tag: %s %s' % (self.name, self.lc, l, ls))
+ log.trace('config: %s: %3d: _tag: %s %s' % (self.name, self.lc, l, ls))
if len(ls) > 1:
info = ls[0].lower()
if info[-1] == ':':
@@ -1206,7 +1210,7 @@ class file:
log.warning(self._name_line_msg("invalid format: '%s'" % (info_data[:-1])))
else:
l = self._expand(l)
- log.trace('config: %s: %3d: _data: %s %s' % (self.name, self.lc, l, new_data))
+ log.trace('config: %s: %3d: _data: %s %s' % (self.name, self.lc, l, new_data))
new_data.append(l)
return (directive, info, data + new_data)
@@ -1222,7 +1226,7 @@ class file:
self.package = _package
def _directive_extend(self, dir, data):
- log.trace('config: %s: %3d: _directive_extend: %s: %r' % (self.name, self.lc, dir, data))
+ log.trace('config: %s: %3d: _directive_extend: %s: %r' % (self.name, self.lc, dir, data))
self._packages[self.package].directive_extend(dir, data)
def _info_append(self, info, data):
@@ -1295,7 +1299,7 @@ class file:
raise error.general('no config file found: %s' % (cfgname))
try:
- log.trace('config: %s: _open: %s' % (self.name, path.host(configname)))
+ log.trace('config: %s: _open: %s' % (self.name, path.host(configname)))
config = open(path.host(configname), 'r')
except IOError as err:
raise error.general('error opening config file: %s' % (path.host(configname)))