mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
rtems/bsps: Fix building 3rd party packages with various options
- Fix locating valid tools and BSP. If either is found in the staging area use that else use the specific --with-* option and if not present use the --prefix. - Locate the tools by checking if the arch's C compiler is a valid file. No other checks are made on the tools. - Locate a BSB by checking for a valid pkgconfig file for the BSP. - Only filter flags if the BSP is in the staging area Closes #3893
This commit is contained in:
parent
96d55ab432
commit
abd98a2440
@ -10,10 +10,10 @@
|
||||
# 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
|
||||
# Provide the path to the RTEMS tools if 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
|
||||
# Provide the path to the installed RTEMS kernel if 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
|
||||
@ -31,6 +31,14 @@
|
||||
%define rtems_bsp_error 1
|
||||
%endif
|
||||
|
||||
#
|
||||
# Set up how we manage pkgconfig. Enable support when crosscompiling,
|
||||
# and filter specific optimisation and warning from the flags that
|
||||
# RTEMS exports.
|
||||
#
|
||||
%{pkgconfig crosscompile yes}
|
||||
%{pkgconfig filter-flags yes}
|
||||
|
||||
#
|
||||
# We need a host from the user to specifiy the RTEMS architecture and major
|
||||
# version. It can be defined in rtems_host.
|
||||
@ -60,10 +68,13 @@
|
||||
# root.
|
||||
#
|
||||
%ifn %{defined with_tools}
|
||||
%if %{install_mode} == staging
|
||||
%if %{install_mode} == staging && \
|
||||
%{path check isfile %{stagingroot}/bin/%{_host}-%{_host_cc}}
|
||||
%define rtems_tools_staged 1
|
||||
%define with_tools %{stagingroot}
|
||||
%define rtems_waf_tools --rtems-tools=%{with_tools}
|
||||
%else
|
||||
%define rtems_tools_staged 1
|
||||
%define with_tools %{_prefix}
|
||||
%define rtems_waf_tools %{nil}
|
||||
%endif
|
||||
@ -71,11 +82,20 @@
|
||||
%define rtems_waf_tools --rtems-tools=%{with_tools}
|
||||
%endif
|
||||
|
||||
%define rtems_host_cc_valid \
|
||||
%{path check isfile %{with_tools}/bin/%{_host}-%{_host_cc}}
|
||||
%if !%{rtems_host_cc_valid} && %{rtems_bsp_error} && !%{_rsb_getting_source}
|
||||
%error RTEMS tools not found (%{_host}-%{_host_cc}) found; Please check the --with-tools option or --prefix.
|
||||
%endif
|
||||
|
||||
%ifn %{defined with_rtems}
|
||||
%if %{install_mode} == staging
|
||||
%{pkgconfig prefix %{stagingroot}/lib/pkgconfig}
|
||||
%if %{install_mode} == staging && %{pkgconfig check %{_host}-%{rtems_bsp}}
|
||||
%define rtems_bsp_staged 1
|
||||
%define with_rtems %{stagingroot}
|
||||
%define rtems_waf_rtems --rtems=%{with_rtems}
|
||||
%else
|
||||
%define rtems_bsp_staged 0
|
||||
%define with_rtems %{_prefix}
|
||||
%define rtems_waf_rtems %{nil}
|
||||
%endif
|
||||
@ -83,6 +103,18 @@
|
||||
%define rtems_waf_rtems --rtems=%{with_rtems}
|
||||
%endif
|
||||
|
||||
#
|
||||
# Set the pkgconfig prefix path to the RTEMS prefix.
|
||||
#
|
||||
%{pkgconfig prefix %{with_rtems}/lib/pkgconfig}
|
||||
|
||||
#
|
||||
# Check we can find the BSP's pkgconfig file.
|
||||
#
|
||||
%if !%{pkgconfig check %{_host}-%{rtems_bsp}} && %{rtems_bsp_error} && !%{_rsb_getting_source}
|
||||
%error RTEMS BSP not found (%{_host}-%{rtems_bsp}.pc); Please check the --with-rtems option or --prefix.
|
||||
%endif
|
||||
|
||||
#
|
||||
# Set the path to the tools.
|
||||
#
|
||||
@ -111,15 +143,6 @@
|
||||
%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
|
||||
#
|
||||
@ -155,9 +178,9 @@
|
||||
|
||||
#
|
||||
# Filter the flags converting any prefix to the staging path if this is a
|
||||
# staging build.
|
||||
# staging build of the BSP.
|
||||
#
|
||||
%if %{install_mode} == staging
|
||||
%if %{rtems_bsp_staged}
|
||||
%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})
|
||||
|
Loading…
x
Reference in New Issue
Block a user