# # 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} && %{defined with_download} %log BSP configuration errors ignored %define rtems_bsp_error 0 %else %define rtems_bsp_error 1 %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. # %if %{_host} == %{nil} && %{rtems_bsp_error} %error No RTEMS host or BSP specified: --host=-rtems %endif # # We need a BSP from the user. # %ifn %{defined with_rtems_bsp} %if %{rtems_bsp_error} %error No RTEMS BSP specified: --rtems-bsp=arch/bsp (or --with-rtems-bsp=bsp) %endif %define with_rtems_bsp sparc/erc32 %endif # # If no tools or RTEMS provided use the prefix. # %ifn %{defined with_tools} %define with_tools %{_prefix} %endif %ifn %{defined with_rtems} %define with_rtems %{_prefix} %endif # # Set the path to the tools. # %{path prepend %{with_tools}/bin} # # 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 %{with_rtems_bsp} %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} %error No RTEMS BSP CFLAGS found; Please check the --rtems-bsp option. %endif %if %{rtems_bsp_ccflags} == %{nil} %define rtems_bsp_ccflags %{rtems_bsp_cflags} %endif # # RTEMS BSP paths # %define rtems_bsp_cc %{_host}-gcc %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 # # 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 # # Map to names used for cross compiling. # %define host_includes -I%{_includedir} %define host_cflags %{rtems_bsp_cflags} %define host_cxxflags %{rtems_bsp_ccflags} %define host_ldflags %{rtems_bsp_ldflags} %define host_libs %{rtems_bsp_libs}