1 | # |
---|
2 | # RTEMS BSP Support |
---|
3 | # |
---|
4 | |
---|
5 | # |
---|
6 | # The RTEMS BSP support requires the host turple, the RTEMS BSP and the path to |
---|
7 | # the tools. The prefix is set to an installed RTEMS. The built package is |
---|
8 | # installed into the prefix. |
---|
9 | # |
---|
10 | # Keeping the package's installed path in the RTEMS install path and separate |
---|
11 | # to the tools lets the tools version vary independently. If --rtems-tools |
---|
12 | # (--with-tools) is not provided use the prefix. |
---|
13 | # |
---|
14 | |
---|
15 | # |
---|
16 | # If a dry-run and with download ignore errors and correct setting for tools |
---|
17 | # and BSPs. Only after the source to download. |
---|
18 | # |
---|
19 | %if %{_dry_run} && %{defined with_download} |
---|
20 | %log BSP configuration errors ignored |
---|
21 | %define rtems_bsp_error 0 |
---|
22 | %else |
---|
23 | %define rtems_bsp_error 1 |
---|
24 | %endif |
---|
25 | |
---|
26 | %if %{_target} == %{nil} && %{rtems_bsp_error} |
---|
27 | %error No RTEMS target specified: --rtems-bsp=arch/bsp (or --target=target) |
---|
28 | %endif |
---|
29 | |
---|
30 | %if %{_host} != %{_build} |
---|
31 | %error Canadian cross building for BSP is not supported. |
---|
32 | %endif |
---|
33 | |
---|
34 | %ifn %{defined with_rtems_bsp} |
---|
35 | %if %{rtems_bsp_error} |
---|
36 | %error No RTEMS BSP specified: --rtems-bsp=arch/bsp (or --with-rtems-bsp=bsp) |
---|
37 | %endif |
---|
38 | %define with_rtems_bsp sparc/erc32 |
---|
39 | %endif |
---|
40 | |
---|
41 | %ifn %{defined with_tools} |
---|
42 | %define with_tools %{_prefix} |
---|
43 | %endif |
---|
44 | |
---|
45 | # |
---|
46 | # Set the host to the target. |
---|
47 | # |
---|
48 | %define _host %{_target} |
---|
49 | |
---|
50 | # |
---|
51 | # Set the path to the tools. |
---|
52 | # |
---|
53 | %{path prepend %{with_tools}/bin} |
---|
54 | |
---|
55 | # |
---|
56 | # Set up how we manage pkgconfig. Set the prefix path to the RTEMS prefix, |
---|
57 | # enable support when crosscompiling, and filter specific optimisation and |
---|
58 | # warning from the flags that RTEMS exports. |
---|
59 | # |
---|
60 | %{pkgconfig prefix %{_prefix}/lib/pkgconfig} |
---|
61 | %{pkgconfig crosscompile yes} |
---|
62 | %{pkgconfig filter-flags yes} |
---|
63 | |
---|
64 | # |
---|
65 | # The RTEMS BSP Flags |
---|
66 | # |
---|
67 | %define rtems_bsp %{with_rtems_bsp} |
---|
68 | %define rtems_bsp_ccflags %{pkgconfig ccflags %{_host}-%{rtems_bsp}} |
---|
69 | %define rtems_bsp_cflags %{pkgconfig cflags %{_host}-%{rtems_bsp}} |
---|
70 | %define rtems_bsp_ldflags %{pkgconfig ldflags %{_host}-%{rtems_bsp}} |
---|
71 | %define rtems_bsp_libs %{pkgconfig libs %{_host}-%{rtems_bsp}} |
---|
72 | |
---|
73 | %if %{rtems_bsp_cflags} == %{nil} && %{rtems_bsp_error} |
---|
74 | %error No RTEMS target CFLAGS found; Please check the --rtems-bsp option. |
---|
75 | %endif |
---|
76 | |
---|
77 | %if %{rtems_bsp_ccflags} == %{nil} |
---|
78 | %define rtems_bsp_ccflags %{rtems_bsp_cflags} |
---|
79 | %endif |
---|
80 | |
---|
81 | # |
---|
82 | # Map to names used for cross compiling. |
---|
83 | # |
---|
84 | %define host_cflags %{rtems_bsp_cflags} |
---|
85 | %define host_cxxflags %{rtems_bsp_ccflags} |
---|
86 | %define host_ldflags %{rtems_bsp_ldflags} |
---|
87 | %define host_libs %{rtems_bsp_libs} |
---|
88 | |
---|
89 | # |
---|
90 | # Update the configure paths to be BSP specific. |
---|
91 | # |
---|
92 | %define rtems_bsp_prefix %{_prefix}/%{_host}/%{rtems_bsp} |
---|
93 | %define _exec_prefix %{rtems_bsp_prefix} |
---|
94 | %define _bindir %{_exec_prefix}/bin |
---|
95 | %define _sbindir %{_exec_prefix}/sbin |
---|
96 | %define _libexecdir %{_exec_prefix}/libexec |
---|
97 | %define _datarootdir %{_exec_prefix}/share |
---|
98 | %define _datadir %{_datarootdir} |
---|
99 | %define _sysconfdir %{_exec_prefix}/etc |
---|
100 | %define _sharedstatedir %{_exec_prefix}/com |
---|
101 | %define _localstatedir %{_exec_prefix}/var |
---|
102 | %define _includedir %{_libdir}/include |
---|
103 | %define _lib lib |
---|
104 | %define _libdir %{_exec_prefix}/%{_lib} |
---|
105 | %define _libexecdir %{_exec_prefix}/libexec |
---|
106 | %define _mandir %{_datarootdir}/man |
---|
107 | %define _infodir %{_datarootdir}/info |
---|
108 | %define _localedir %{_datarootdir}/locale |
---|
109 | %define _localedir %{_datadir}/locale |
---|
110 | %define _localstatedir %{_exec_prefix}/var |
---|