Re: [PATCH v2] rtems-kernel: Implement kernel recipe using waf

2021-10-20 Thread Chris Johns
On 14/10/21 9:08 am, Ryan Long wrote:
> Closes #4145
> ---
>  rtems/config/tools/rtems-kernel-6.cfg  |   6 +-
>  rtems/config/tools/rtems-kernel-common.cfg |  91 +--
>  source-builder/sb/options.py   | 136 
> +++--
>  3 files changed, 119 insertions(+), 114 deletions(-)
> 
> diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
> b/rtems/config/tools/rtems-kernel-6.cfg
> index f1d0990..9120862 100644
> --- a/rtems/config/tools/rtems-kernel-6.cfg
> +++ b/rtems/config/tools/rtems-kernel-6.cfg
> @@ -2,10 +2,10 @@
>  # RTEMS 5
>  #
>  
> -%define rtems_kernel_version 3ec5f20484cc4201e1d7b87844505644533b6148
> -%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
> -  
> BjMKrf5n1YR6IpiZrY5TUEzKATPRJxA2/6m6f833DdRu+RyLxccXqA4gHRdVUqFelFNQ3o0XdG4o1naBKYfhkQ==
> +%define rtems_kernel_version 3bb97a30b17b6c138dead3e3a6b329c3b301cdb3
>  
> +%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.gz \
> +  
> m/ogwrJj4X60ewDIbV6WRj1MJa/22gQHQd56XiNMfvCr0nsvcXdkXKAObLIGYIGYfUyEwlVk3SRjjRFkFalDGQ==
>  #
>  # The RTEMS build instructions.
>  #
> diff --git a/rtems/config/tools/rtems-kernel-common.cfg 
> b/rtems/config/tools/rtems-kernel-common.cfg
> index 157c7a4..2986580 100644
> --- a/rtems/config/tools/rtems-kernel-common.cfg
> +++ b/rtems/config/tools/rtems-kernel-common.cfg
> @@ -38,6 +38,15 @@
>  %define rtems_bsp %{with_rtems_bsp}
>  
>  #
> +# Configuration file used with waf
> +#
> +%ifn %{defined _bspconfig}
> +%define config_file config-%{_target}-%{rtems_bsp}.ini
> +%else
> +%define config_file %{_bspconfig}
> +%endif

This is not right given the way --with-* is handled.

> +
> +#
>  # If no tools are provided use the prefix.
>  #
>  %ifn %{defined with_tools}
> @@ -98,14 +107,6 @@ URL:   https://www.rtems.org/
>   %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
> -
>  %if %{defined with_rtems_bspopts}
>   %define bspopts %{with_rtems_bspopts}
>  %endif
> @@ -151,24 +152,28 @@ URL: https://www.rtems.org/
>  %if %{defined without_rtemsbsp}
>   %error Option --without-rtemsbsp is not supported.
>  %endif
> +
>  %if %{defined without_rtems_tests}
> - %define with_rtems_tests no
> + %define rtems_tests False
> + %define rtems_sample_tests False
>  %endif
>  %if %{defined with_rtems_tests}
>   %if %{with_rtems_tests} == 1
> -  %define with_rtems_tests yes
> +   %define rtems_tests True
> +   %define rtems_sample_tests True
>   %endif
> - %if %{with_rtems_tests} == yes || \
> - %{with_rtems_tests} == no || \
> - %{with_rtems_tests} == samples
> -  %define rtems_tests %{with_rtems_tests}
> +  %if %{with_rtems_tests} == samples
> +  %define rtems_tests False
> +  %define rtems_sample_tests True
>   %endif
>  %endif
>  %if %{defined with_rtems_smp}
>   %define rtems_smp 1
>  %endif
>  %if %{defined with_rtems_legacy_network}
> - %define rtems_networking 1
> + echo "RTEMS legacy network has been removed."
> + echo "Please review and update your configuration."
> + exit 1
>  %endif
>  %if %{defined with_rtems_bspopts}
>   %define rtems_bspopts %{with_rtems_bspopts}
> @@ -178,7 +183,9 @@ URL:   https://www.rtems.org/
>  # If C++ defined for the tool set use it to control RTEMS's setting..
>  #
>  %if %{defined enable_cxx}
> - %define rtems_cxx %{enable_cxx}
> + echo CXX has been removed."
> + echo "Please review and update your configuration."
> + exit 1
>  %endif
>  
>  #
> @@ -188,14 +195,9 @@ URL:  https://www.rtems.org/
>  %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 1
> -%endif
>  %ifn %{defined rtems_tests}
> - %define rtems_tests samples
> + %define rtems_tests False
> + %define rtems_sample_tests True
>  %endif
>  %ifn %{defined rtems_bspopts}
>   %define rtems_bspopts %{nil}
> @@ -213,8 +215,7 @@ URL:   https://www.rtems.org/
>  %if %{defined _internal_autotools_path}
>export PATH="%{_internal_autotools_path}/bin:${PATH}"
>  %endif
> -./bootstrap -c
> -./rtems-bootstrap
> +./waf distclean

The sources need to be fresh on every build if building in the source tree. Is
this needed?

>%endif
>cd ..
>  
> @@ -225,32 +226,34 @@ URL: https://www.rtems.org/
>else
>  build_dir="build"
>fi
> +
> +  cd ${source_dir_rtems}
> +
> +%ifn %{defined _bspconfig}
> +  cpu=`echo %{_target} | cut -d- -f1`
> +  echo "[${cpu}/%{rtems_bsp}]" > %{config_file}
> +  echo "RTEMS_POSIX_API = %{?rtems_posix:True}%{!?rtems_posix:False}" >> 
> %{config_file}
> +  echo "RTEMS_SMP = %{?rtems_smp:True}%{!?rtems_smp:False}" >> %{config_file}
> +  echo "BUILD_TESTS = %{rtems_tests}" >> %{config_file}
> +  echo "BUILD_SAMPLES = %{rtems_sample_tests}" >> %{config_file}
> +%endif
> +
>mkdir 

RE: [PATCH v2] rtems-kernel: Implement kernel recipe using waf

2021-10-19 Thread Ryan Long
ping

-Original Message-
From: Ryan Long 
Sent: Wednesday, October 13, 2021 5:08 PM
To: devel@rtems.org
Cc: Ryan Long 
Subject: [PATCH v2] rtems-kernel: Implement kernel recipe using waf

Closes #4145
---
 rtems/config/tools/rtems-kernel-6.cfg  |   6 +-
 rtems/config/tools/rtems-kernel-common.cfg |  91 +--
 source-builder/sb/options.py   | 136 +++--
 3 files changed, 119 insertions(+), 114 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
b/rtems/config/tools/rtems-kernel-6.cfg
index f1d0990..9120862 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,10 @@
 # RTEMS 5
 #
 
-%define rtems_kernel_version 3ec5f20484cc4201e1d7b87844505644533b6148
-%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-  
BjMKrf5n1YR6IpiZrY5TUEzKATPRJxA2/6m6f833DdRu+RyLxccXqA4gHRdVUqFelFNQ3o0XdG4o1naBKYfhkQ==
+%define rtems_kernel_version 3bb97a30b17b6c138dead3e3a6b329c3b301cdb3
 
+%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.gz \
+  
+m/ogwrJj4X60ewDIbV6WRj1MJa/22gQHQd56XiNMfvCr0nsvcXdkXKAObLIGYIGYfUyEwlV
+k3SRjjRFkFalDGQ==
 #
 # The RTEMS build instructions.
 #
diff --git a/rtems/config/tools/rtems-kernel-common.cfg 
b/rtems/config/tools/rtems-kernel-common.cfg
index 157c7a4..2986580 100644
--- a/rtems/config/tools/rtems-kernel-common.cfg
+++ b/rtems/config/tools/rtems-kernel-common.cfg
@@ -38,6 +38,15 @@
 %define rtems_bsp %{with_rtems_bsp}
 
 #
+# Configuration file used with waf
+#
+%ifn %{defined _bspconfig}
+%define config_file config-%{_target}-%{rtems_bsp}.ini
+%else
+%define config_file %{_bspconfig}
+%endif
+
+#
 # If no tools are provided use the prefix.
 #
 %ifn %{defined with_tools}
@@ -98,14 +107,6 @@ URL: https://www.rtems.org/
  %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
-
 %if %{defined with_rtems_bspopts}
  %define bspopts %{with_rtems_bspopts}
 %endif
@@ -151,24 +152,28 @@ URL:   https://www.rtems.org/
 %if %{defined without_rtemsbsp}
  %error Option --without-rtemsbsp is not supported.
 %endif
+
 %if %{defined without_rtems_tests}
- %define with_rtems_tests no
+ %define rtems_tests False
+ %define rtems_sample_tests False
 %endif
 %if %{defined with_rtems_tests}
  %if %{with_rtems_tests} == 1
-  %define with_rtems_tests yes
+   %define rtems_tests True
+   %define rtems_sample_tests True
  %endif
- %if %{with_rtems_tests} == yes || \
- %{with_rtems_tests} == no || \
- %{with_rtems_tests} == samples
-  %define rtems_tests %{with_rtems_tests}
+  %if %{with_rtems_tests} == samples
+  %define rtems_tests False
+  %define rtems_sample_tests True
  %endif
 %endif
 %if %{defined with_rtems_smp}
  %define rtems_smp 1
 %endif
 %if %{defined with_rtems_legacy_network}
- %define rtems_networking 1
+ echo "RTEMS legacy network has been removed."
+ echo "Please review and update your configuration."
+ exit 1
 %endif
 %if %{defined with_rtems_bspopts}
  %define rtems_bspopts %{with_rtems_bspopts}
@@ -178,7 +183,9 @@ URL: https://www.rtems.org/
 # If C++ defined for the tool set use it to control RTEMS's setting..
 #
 %if %{defined enable_cxx}
- %define rtems_cxx %{enable_cxx}
+ echo CXX has been removed."
+ echo "Please review and update your configuration."
+ exit 1
 %endif
 
 #
@@ -188,14 +195,9 @@ URL:https://www.rtems.org/
 %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 1
-%endif
 %ifn %{defined rtems_tests}
- %define rtems_tests samples
+ %define rtems_tests False
+ %define rtems_sample_tests True
 %endif
 %ifn %{defined rtems_bspopts}
  %define rtems_bspopts %{nil}
@@ -213,8 +215,7 @@ URL: https://www.rtems.org/
 %if %{defined _internal_autotools_path}
   export PATH="%{_internal_autotools_path}/bin:${PATH}"
 %endif
-./bootstrap -c
-./rtems-bootstrap
+./waf distclean
   %endif
   cd ..
 
@@ -225,32 +226,34 @@ URL:   https://www.rtems.org/
   else
 build_dir="build"
   fi
+
+  cd ${source_dir_rtems}
+
+%ifn %{defined _bspconfig}
+  cpu=`echo %{_target} | cut -d- -f1`
+  echo "[${cpu}/%{rtems_bsp}]" > %{config_file}
+  echo "RTEMS_POSIX_API = %{?rtems_posix:True}%{!?rtems_posix:False}" 
+>> %{config_file}
+  echo "RTEMS_SMP = %{?rtems_smp:True}%{!?rtems_smp:False}" >> 
+%{config_file}
+  echo "BUILD_TESTS = %{rtems_tests}" >> %{config_file}
+  echo "BUILD_SAMPLES = %{rtems_sample_tests}" >> %{config_file} %endif
+
   mkdir -p ${build_dir}
-  cd ${build_dir}
-
-  ../${source_dir_rtems}/configure \
---build=%{_build} --host=%{_host} \
---target=%{_target} \

[PATCH v2] rtems-kernel: Implement kernel recipe using waf

2021-10-13 Thread Ryan Long
Closes #4145
---
 rtems/config/tools/rtems-kernel-6.cfg  |   6 +-
 rtems/config/tools/rtems-kernel-common.cfg |  91 +--
 source-builder/sb/options.py   | 136 +++--
 3 files changed, 119 insertions(+), 114 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
b/rtems/config/tools/rtems-kernel-6.cfg
index f1d0990..9120862 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,10 @@
 # RTEMS 5
 #
 
-%define rtems_kernel_version 3ec5f20484cc4201e1d7b87844505644533b6148
-%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-  
BjMKrf5n1YR6IpiZrY5TUEzKATPRJxA2/6m6f833DdRu+RyLxccXqA4gHRdVUqFelFNQ3o0XdG4o1naBKYfhkQ==
+%define rtems_kernel_version 3bb97a30b17b6c138dead3e3a6b329c3b301cdb3
 
+%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.gz \
+  
m/ogwrJj4X60ewDIbV6WRj1MJa/22gQHQd56XiNMfvCr0nsvcXdkXKAObLIGYIGYfUyEwlVk3SRjjRFkFalDGQ==
 #
 # The RTEMS build instructions.
 #
diff --git a/rtems/config/tools/rtems-kernel-common.cfg 
b/rtems/config/tools/rtems-kernel-common.cfg
index 157c7a4..2986580 100644
--- a/rtems/config/tools/rtems-kernel-common.cfg
+++ b/rtems/config/tools/rtems-kernel-common.cfg
@@ -38,6 +38,15 @@
 %define rtems_bsp %{with_rtems_bsp}
 
 #
+# Configuration file used with waf
+#
+%ifn %{defined _bspconfig}
+%define config_file config-%{_target}-%{rtems_bsp}.ini
+%else
+%define config_file %{_bspconfig}
+%endif
+
+#
 # If no tools are provided use the prefix.
 #
 %ifn %{defined with_tools}
@@ -98,14 +107,6 @@ URL: https://www.rtems.org/
  %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
-
 %if %{defined with_rtems_bspopts}
  %define bspopts %{with_rtems_bspopts}
 %endif
@@ -151,24 +152,28 @@ URL:   https://www.rtems.org/
 %if %{defined without_rtemsbsp}
  %error Option --without-rtemsbsp is not supported.
 %endif
+
 %if %{defined without_rtems_tests}
- %define with_rtems_tests no
+ %define rtems_tests False
+ %define rtems_sample_tests False
 %endif
 %if %{defined with_rtems_tests}
  %if %{with_rtems_tests} == 1
-  %define with_rtems_tests yes
+   %define rtems_tests True
+   %define rtems_sample_tests True
  %endif
- %if %{with_rtems_tests} == yes || \
- %{with_rtems_tests} == no || \
- %{with_rtems_tests} == samples
-  %define rtems_tests %{with_rtems_tests}
+  %if %{with_rtems_tests} == samples
+  %define rtems_tests False
+  %define rtems_sample_tests True
  %endif
 %endif
 %if %{defined with_rtems_smp}
  %define rtems_smp 1
 %endif
 %if %{defined with_rtems_legacy_network}
- %define rtems_networking 1
+ echo "RTEMS legacy network has been removed."
+ echo "Please review and update your configuration."
+ exit 1
 %endif
 %if %{defined with_rtems_bspopts}
  %define rtems_bspopts %{with_rtems_bspopts}
@@ -178,7 +183,9 @@ URL: https://www.rtems.org/
 # If C++ defined for the tool set use it to control RTEMS's setting..
 #
 %if %{defined enable_cxx}
- %define rtems_cxx %{enable_cxx}
+ echo CXX has been removed."
+ echo "Please review and update your configuration."
+ exit 1
 %endif
 
 #
@@ -188,14 +195,9 @@ URL:https://www.rtems.org/
 %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 1
-%endif
 %ifn %{defined rtems_tests}
- %define rtems_tests samples
+ %define rtems_tests False
+ %define rtems_sample_tests True
 %endif
 %ifn %{defined rtems_bspopts}
  %define rtems_bspopts %{nil}
@@ -213,8 +215,7 @@ URL: https://www.rtems.org/
 %if %{defined _internal_autotools_path}
   export PATH="%{_internal_autotools_path}/bin:${PATH}"
 %endif
-./bootstrap -c
-./rtems-bootstrap
+./waf distclean
   %endif
   cd ..
 
@@ -225,32 +226,34 @@ URL:   https://www.rtems.org/
   else
 build_dir="build"
   fi
+
+  cd ${source_dir_rtems}
+
+%ifn %{defined _bspconfig}
+  cpu=`echo %{_target} | cut -d- -f1`
+  echo "[${cpu}/%{rtems_bsp}]" > %{config_file}
+  echo "RTEMS_POSIX_API = %{?rtems_posix:True}%{!?rtems_posix:False}" >> 
%{config_file}
+  echo "RTEMS_SMP = %{?rtems_smp:True}%{!?rtems_smp:False}" >> %{config_file}
+  echo "BUILD_TESTS = %{rtems_tests}" >> %{config_file}
+  echo "BUILD_SAMPLES = %{rtems_sample_tests}" >> %{config_file}
+%endif
+
   mkdir -p ${build_dir}
-  cd ${build_dir}
-
-  ../${source_dir_rtems}/configure \
---build=%{_build} --host=%{_host} \
---target=%{_target} \
---enable-rtemsbsp="%{rtems_bsp}" \
-%{?rtems_cxx:--enable-cxx}%{!?rtems_cxx:--disable-cxx} \
-%{?rtems_posix:--enable-posix}%{!?rtems_posix:--disable-posix} \
-
%{?rtems_networking:--enable-networking}%{!?rtems_networking:--disable-networking}
 \
-%{?rtems_tests:--enable-tests=%{rtems_tests}} \
-%{?rtems_smp:--enable-smp