rtems-kernel: Install tests when tests are built

The tests in RTEMS are not installed so if a user requests the
tests be built install them. Given the RSB cleans up building the
tests and not installing does nothing.

- Fix the options handling the kernel build to be consistent

Updates #3956
This commit is contained in:
Chris Johns 2020-04-28 11:05:20 +10:00
parent d5ad66747c
commit d14da0a252

View File

@ -132,6 +132,51 @@ URL: https://www.rtems.org/
%source set rtems_kernel --rsb-file=%{rtems_kernel_file} \
https://git.rtems.org/rtems/snapshot/rtems-%{rtems_kernel_version}.tar.bz2
#
# Check the various --with/--without options we support. These are
# turned into the internal settings.
#
# --target : The architecture
# --with-rtems-bsp : The BSP
# --without-rtems-bsp : Not supported
# --with-rtems-tests : Supported, samples/yes/no
# --without-rtems-tests : Supported, forced to no
# --with-rtems-smp : Supported
# --without-rtems-smp : Don't care
# --with-rtems-legacy-network : Supported
# --without-rtems-legacy-network : Don't care
# --with-rtems-bspopts : Supported, quote for a list
# --without-rtems-bspopts : Don't care
#
%if %{defined without_rtemsbsp}
%error Option --without-rtemsbsp is not supported.
%endif
%if %{defined without_rtems_tests}
%define with_rtems_tests no
%endif
%if %{defined with_rtems_tests}
%if %{with_rtems_tests} == 1
%define with_rtems_tests yes
%endif
%if %{with_rtems_tests} == yes || \
%{with_rtems_tests} == no || \
%{with_rtems_tests} == samples
%define rtems_tests %{with_rtems_tests}
%endif
%else
%error invalid with-rtems-tests value
%endif
%if %{defined with_rtems_smp}
%define rtems_smp 1
%endif
%if %{defined with_rtems_legacy_network}
%define rtems_networking 1
%endif
%if %{defined with_rtems_bspopts}
%define rtems_bspopts %{with_rtems_bspopts}
%endif
#
# If C++ defined for the tool set use it to control RTEMS's setting..
#
%if %{defined enable_cxx}
@ -139,7 +184,8 @@ URL: https://www.rtems.org/
%endif
#
# Default set up.
# Default set up. Override these in a BSP if you want a
# specific setup.
#
%ifn %{defined rtems_posix}
%define rtems_posix 1
@ -148,37 +194,13 @@ URL: https://www.rtems.org/
%define rtems_networking 0
%endif
%ifn %{defined rtems_cxx}
%define rtems_cxx 0
%define rtems_cxx 1
%endif
%ifn %{defined rtems_tests}
%define rtems_tests samples
%endif
%ifn %{defined bspopts}
%define bspopts %{nil}
%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
%ifn %{defined rtems_bspopts}
%define rtems_bspopts %{nil}
%endif
#
@ -213,16 +235,16 @@ URL: https://www.rtems.org/
--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_cxx:--enable-cxx}%{!?rtems_cxx:--disable-cxx} \
%{?with_rtems_tests:--enable-tests=%{with_rtems_tests}} \
%{?with_rtems_smp:--enable-smp} \
%{?rtems_tests:--enable-tests=%{rtems_tests}} \
%{?rtems_smp:--enable-smp} \
--prefix=%{_prefix} --bindir=%{_bindir} \
--exec-prefix=%{_exec_prefix} \
--includedir=%{_includedir} --libdir=%{_libdir} \
--mandir=%{_mandir} --infodir=%{_infodir} \
%{bspopts}
%{rtems_bspopts}
%{__make} %{?_smp_mflags} all
cd ..
@ -233,4 +255,11 @@ URL: https://www.rtems.org/
cd ${build_dir}
%{__make} DESTDIR=$SB_BUILD_ROOT install
%if %{rtems_tests} != no
%define rtems_test_install %{_target}/%{rtems_bsp}/tests
mkdir -p $SB_BUILD_ROOT/%{_prefix}/%{rtems_test_install}
find . -name \*.exe -and -not -name \*.norun.exe \
-exec cp -v \{\} $SB_BUILD_ROOT/%{_prefix}/%{rtems_test_install}/ \;
%endif
cd ..