# # RTEMS BSP Support # # # The RTEMS BSP support requires the host tuple, the RTEMS BSP and the path to # the tools. The prefix is set to an installed RTEMS. The built package is # installed into the prefix. # # Keeping the package's installed path in the RTEMS install path and separate # to the tools lets the tools version vary independently. # # Provide the path to the RTEMS tools is not in the prefix with the # --with-tools option. If --with-tools is not provided use the prefix. # # Provide the path to the installed RTEMS kernel is not in the prefix with the # --with-rtems option. If --with-rtems is not provided use the prefix. # # Note, only a single path (--with-rtems) for the RTEMS kernel and any other # add on or 3rd party libraries is supported. # # # 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} %log BSP configuration errors ignored %define rtems_bsp_error 0 %else %define rtems_bsp_error 1 %endif # # We need a host from the user to specifiy the RTEMS architecture and major # version. It can be defined in rtems_host. # %if %{defined rtems_host} %{triplet _host %{rtems_host}} %endif %if %{rtems_bsp_error} %if %{_host} == %{nil} || %{_host} == %{_build} %error No RTEMS host or BSP specified: --host=-rtems %endif %endif # # We need a BSP from the user. # %ifn %{defined with_rtems_bsp} %if %{rtems_bsp_error} %error No RTEMS BSP specified: --with-rtems-bsp=bsp %endif %define with_rtems_bsp sparc/erc32 %endif %define rtems_bsp %{with_rtems_bsp} # # If no tools or RTEMS provided use the prefix. If staging use the staging # root. # %ifn %{defined with_tools} %if %{install_mode} == staging %define with_tools %{stagingroot} %define rtems_waf_tools --rtems-tools=%{with_tools} %else %define with_tools %{_prefix} %define rtems_waf_tools %{nil} %endif %else %define rtems_waf_tools --rtems-tools=%{with_tools} %endif %ifn %{defined with_rtems} %if %{install_mode} == staging %define with_rtems %{stagingroot} %define rtems_waf_rtems --rtems=%{with_rtems} %else %define with_rtems %{_prefix} %define rtems_waf_rtems %{nil} %endif %else %define rtems_waf_rtems --rtems=%{with_rtems} %endif # # Set the path to the tools. # %{path prepend %{with_tools}/bin} # # Update the configure paths to be BSP specific. # %define rtems_bsp_prefix %{_prefix}/%{_host}/%{rtems_bsp} %define _exec_prefix %{rtems_bsp_prefix} %define _bindir %{_exec_prefix}/bin %define _sbindir %{_exec_prefix}/sbin %define _libexecdir %{_exec_prefix}/libexec %define _datarootdir %{_exec_prefix}/share %define _datadir %{_datarootdir} %define _sysconfdir %{_exec_prefix}/etc %define _sharedstatedir %{_exec_prefix}/com %define _localstatedir %{_exec_prefix}/var %define _includedir %{_libdir}/include %define _lib lib %define _libdir %{_exec_prefix}/%{_lib} %define _libexecdir %{_exec_prefix}/libexec %define _mandir %{_datarootdir}/man %define _infodir %{_datarootdir}/info %define _localedir %{_datarootdir}/locale %define _localedir %{_datadir}/locale %define _localstatedir %{_exec_prefix}/var # # Set up how we manage pkgconfig. Set the prefix path to the RTEMS prefix, # enable support when crosscompiling, and filter specific optimisation and # warning from the flags that RTEMS exports. # %{pkgconfig prefix %{with_rtems}/lib/pkgconfig} %{pkgconfig crosscompile yes} %{pkgconfig filter-flags yes} # # The RTEMS BSP Flags # %define rtems_bsp_includes -I%{_includedir} %define rtems_bsp_ccflags %{pkgconfig ccflags %{_host}-%{rtems_bsp}} %define rtems_bsp_cflags %{pkgconfig cflags %{_host}-%{rtems_bsp}} %define rtems_bsp_ldflags %{pkgconfig ldflags %{_host}-%{rtems_bsp}} %define rtems_bsp_libs %{pkgconfig libs %{_host}-%{rtems_bsp}} %if %{rtems_bsp_cflags} == %{nil} && %{rtems_bsp_error} && !%{_rsb_getting_source} %error No RTEMS BSP CFLAGS found; Please check the --with-rtems-bsp option. %endif # # C++ flags are the C flags. # %if %{rtems_bsp_ccflags} == %{nil} %define rtems_bsp_ccflags %{rtems_bsp_cflags} %endif # # If there are no LDFLAGS create a path to RTEMS. # %if %{rtems_bsp_ldflags} == %{nil} %define rtems_bsp_ldflags -L%{rtems_bsp_prefix}/lib %endif # # Support for RTEMS's Makefile.inc support. # %define rtems_bsp_makefile_inc %{rtems_bsp_prefix} %define rtems_bsp_rtems_root %{_prefix} # # Filter the flags converting any prefix to the staging path if this is a # staging build. # %if %{install_mode} == staging %define staging_filter sed -e 's|%{_prefix}|%{stagingroot}|g' %define rtems_bsp_prefix $(echo %{rtems_bsp_prefix} | %{staging_filter}) %define rtems_bsp_includes $(echo %{rtems_bsp_includes} | %{staging_filter}) %define rtems_bsp_ccflags $(echo %{rtems_bsp_ccflags} | %{staging_filter}) %define rtems_bsp_cflags $(echo %{rtems_bsp_cflags} | %{staging_filter}) %define rtems_bsp_ldflags $(echo %{rtems_bsp_ldflags} | %{staging_filter}) %define rtems_bsp_rtems_root %{stagingroot} %endif %if %{rtems_bsp_ccflags} == %{nil} %define rtems_bsp_ccflags %{rtems_bsp_cflags} %endif # # The RTEMS BSP architecture/bsp. # %define rtems_bsp_arch_bsp %{_host_arch}/%{rtems_bsp} # # RTEMS BSP paths # %define rtems_bsp_cc %{_host}-gcc %define rtems_bsp_cxx %{_host}-g++ %define rtems_bsp_incpath %{with_rtems}/%{_host}/%{rtems_bsp}/include %define rtems_bsp_libpath %{with_rtems}/%{_host}/%{rtems_bsp}/lib # # Check for installed libraries. # # - Check is LibBSD is install # - Add librtemsdefaultconfig so configure scripts work. # # Note: default BSP flags include the standard RTEMS libraries. # %define rtems-dep-check %(%{_sbdir}/sb/rtems-build-dep -c %{with_tools}/bin/%{rtems_bsp_cc} %define rtems-libbsd %{rtems-dep-check} -L %{rtems_bsp_libpath} -l libbsd.a) %if %{rtems-libbsd} == found %define rtems_bsp_libs %{rtems_bsp_libs} -lbsd -lm -lz %endif %define rtems-defaultconfig %{rtems-dep-check} -L %{rtems_bsp_libpath} -l librtemsdefaultconfig.a) %if %{rtems-defaultconfig} == found %define rtems_bsp_libs %{rtems_bsp_libs} -lrtemsdefaultconfig %endif # # The linker flags need to include the machine options for the BSP. # %define mflags_filter awk '{for (i=1;i