1 | # |
---|
2 | # RTEMS BSP Support |
---|
3 | # |
---|
4 | |
---|
5 | # |
---|
6 | # The RTEMS BSP support requires the host tuple, 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. |
---|
12 | # |
---|
13 | # Provide the path to the RTEMS tools is not in the prefix with the |
---|
14 | # --with-tools option. If --with-tools is not provided use the prefix. |
---|
15 | # |
---|
16 | # Provide the path to the installed RTEMS kernel is not in the prefix with the |
---|
17 | # --with-rtems option. If --with-rtems is not provided use the prefix. |
---|
18 | # |
---|
19 | # Note, only a single path (--with-rtems) for the RTEMS kernel and any other |
---|
20 | # add on or 3rd party libraries is supported. |
---|
21 | # |
---|
22 | |
---|
23 | # |
---|
24 | # If a dry-run and with download ignore errors and correct setting for tools |
---|
25 | # and BSPs. Only after the source to download. |
---|
26 | # |
---|
27 | %if %{_dry_run} && %{defined with_download} |
---|
28 | %log BSP configuration errors ignored |
---|
29 | %define rtems_bsp_error 0 |
---|
30 | %else |
---|
31 | %define rtems_bsp_error 1 |
---|
32 | %endif |
---|
33 | |
---|
34 | # |
---|
35 | # We need a host from the user to specifiy the RTEMS architecture and major |
---|
36 | # version. It can be defined in rtems_host. |
---|
37 | # |
---|
38 | %if %{defined rtems_host} |
---|
39 | %define _host %{rtems_host} |
---|
40 | %endif |
---|
41 | %if %{rtems_bsp_error} |
---|
42 | %if %{_host} == %{nil} || %{_host} == %{_build} |
---|
43 | %error No RTEMS host or BSP specified: --host=<arch>-rtems<ver> |
---|
44 | %endif |
---|
45 | %endif |
---|
46 | |
---|
47 | # |
---|
48 | # We need a BSP from the user. |
---|
49 | # |
---|
50 | %ifn %{defined with_rtems_bsp} |
---|
51 | %if %{rtems_bsp_error} |
---|
52 | %error No RTEMS BSP specified: --with-rtems-bsp=bsp |
---|
53 | %endif |
---|
54 | %define with_rtems_bsp sparc/erc32 |
---|
55 | %endif |
---|
56 | |
---|
57 | # |
---|
58 | # If no tools or RTEMS provided use the prefix. |
---|
59 | # |
---|
60 | %ifn %{defined with_tools} |
---|
61 | %define with_tools %{_prefix} |
---|
62 | %define rtems_waf_tools %{nil} |
---|
63 | %else |
---|
64 | %define rtems_waf_tools --rtems-tools=%{with_tools} |
---|
65 | %endif |
---|
66 | |
---|
67 | %ifn %{defined with_rtems} |
---|
68 | %define with_rtems %{_prefix} |
---|
69 | %define rtems_waf_rtems %{nil} |
---|
70 | %else |
---|
71 | %define rtems_waf_rtems --rtems=%{with_rtems} |
---|
72 | %endif |
---|
73 | |
---|
74 | # |
---|
75 | # Set the path to the tools. |
---|
76 | # |
---|
77 | %{path prepend %{with_tools}/bin} |
---|
78 | |
---|
79 | # |
---|
80 | # Set up how we manage pkgconfig. Set the prefix path to the RTEMS prefix, |
---|
81 | # enable support when crosscompiling, and filter specific optimisation and |
---|
82 | # warning from the flags that RTEMS exports. |
---|
83 | # |
---|
84 | %{pkgconfig prefix %{with_rtems}/lib/pkgconfig} |
---|
85 | %{pkgconfig crosscompile yes} |
---|
86 | %{pkgconfig filter-flags yes} |
---|
87 | |
---|
88 | # |
---|
89 | # The RTEMS BSP Flags |
---|
90 | # |
---|
91 | %define rtems_bsp %{with_rtems_bsp} |
---|
92 | %define rtems_bsp_ccflags %{pkgconfig ccflags %{_host}-%{rtems_bsp}} |
---|
93 | %define rtems_bsp_cflags %{pkgconfig cflags %{_host}-%{rtems_bsp}} |
---|
94 | %define rtems_bsp_ldflags %{pkgconfig ldflags %{_host}-%{rtems_bsp}} |
---|
95 | %define rtems_bsp_libs %{pkgconfig libs %{_host}-%{rtems_bsp}} |
---|
96 | |
---|
97 | %if %{rtems_bsp_cflags} == %{nil} && %{rtems_bsp_error} |
---|
98 | %error No RTEMS BSP CFLAGS found; Please check the --with-rtems-bsp option. |
---|
99 | %endif |
---|
100 | |
---|
101 | %if %{rtems_bsp_ccflags} == %{nil} |
---|
102 | %define rtems_bsp_ccflags %{rtems_bsp_cflags} |
---|
103 | %endif |
---|
104 | |
---|
105 | # |
---|
106 | # The RTEMS BSP architecture/bsp. |
---|
107 | # |
---|
108 | %define rtems_bsp_arch_bsp %{_host_arch}/%{rtems_bsp} |
---|
109 | |
---|
110 | # |
---|
111 | # RTEMS BSP paths |
---|
112 | # |
---|
113 | %define rtems_bsp_cc %{_host}-gcc |
---|
114 | %define rtems_bsp_incpath %{with_rtems}/%{_host}/%{rtems_bsp}/include |
---|
115 | %define rtems_bsp_libpath %{with_rtems}/%{_host}/%{rtems_bsp}/lib |
---|
116 | |
---|
117 | # |
---|
118 | # Check for installed libraries. |
---|
119 | # |
---|
120 | # - Check is LibBSD is install |
---|
121 | # - Add librtemsdefaultconfig so configure scripts work. |
---|
122 | # |
---|
123 | # Note: default BSP flags include the standard RTEMS libraries. |
---|
124 | # |
---|
125 | %define rtems-dep-check %(%{_sbdir}/sb/rtems-build-dep -c %{with_tools}/bin/%{rtems_bsp_cc} |
---|
126 | |
---|
127 | %define rtems-libbsd %{rtems-dep-check} -L %{rtems_bsp_libpath} -l libbsd.a) |
---|
128 | %if %{rtems-libbsd} == found |
---|
129 | %define rtems_bsp_libs %{rtems_bsp_libs} -lbsd -lm -lz |
---|
130 | %endif |
---|
131 | |
---|
132 | %define rtems-defaultconfig %{rtems-dep-check} -L %{rtems_bsp_libpath} -l librtemsdefaultconfig.a) |
---|
133 | %if %{rtems-defaultconfig} == found |
---|
134 | %define rtems_bsp_libs %{rtems_bsp_libs} -lrtemsdefaultconfig |
---|
135 | %endif |
---|
136 | |
---|
137 | # |
---|
138 | # Update the configure paths to be BSP specific. |
---|
139 | # |
---|
140 | %define rtems_bsp_prefix %{_prefix}/%{_host}/%{rtems_bsp} |
---|
141 | %define _exec_prefix %{rtems_bsp_prefix} |
---|
142 | %define _bindir %{_exec_prefix}/bin |
---|
143 | %define _sbindir %{_exec_prefix}/sbin |
---|
144 | %define _libexecdir %{_exec_prefix}/libexec |
---|
145 | %define _datarootdir %{_exec_prefix}/share |
---|
146 | %define _datadir %{_datarootdir} |
---|
147 | %define _sysconfdir %{_exec_prefix}/etc |
---|
148 | %define _sharedstatedir %{_exec_prefix}/com |
---|
149 | %define _localstatedir %{_exec_prefix}/var |
---|
150 | %define _includedir %{_libdir}/include |
---|
151 | %define _lib lib |
---|
152 | %define _libdir %{_exec_prefix}/%{_lib} |
---|
153 | %define _libexecdir %{_exec_prefix}/libexec |
---|
154 | %define _mandir %{_datarootdir}/man |
---|
155 | %define _infodir %{_datarootdir}/info |
---|
156 | %define _localedir %{_datarootdir}/locale |
---|
157 | %define _localedir %{_datadir}/locale |
---|
158 | %define _localstatedir %{_exec_prefix}/var |
---|
159 | |
---|
160 | # |
---|
161 | # Map to names used for cross compiling. |
---|
162 | # |
---|
163 | %define host_includes -I%{_includedir} |
---|
164 | %define host_cflags %{rtems_bsp_cflags} |
---|
165 | %define host_cxxflags %{rtems_bsp_ccflags} |
---|
166 | %define host_ldflags %{rtems_bsp_ldflags} |
---|
167 | %define host_libs %{rtems_bsp_libs} |
---|
168 | |
---|
169 | # |
---|
170 | # Handle the Waf install root. |
---|
171 | # |
---|
172 | %ifos win32 mingw ming32 |
---|
173 | %define rtems_waf_build_root_suffix %{waf_build_root_suffix} |
---|
174 | %else |
---|
175 | %define rtems_waf_build_root_suffix %{nil} |
---|
176 | %endif |
---|