1 | # |
---|
2 | # RTEMS Kernel. |
---|
3 | # |
---|
4 | # This configuration file configure's, make's and install's RTEMS. |
---|
5 | # |
---|
6 | |
---|
7 | # |
---|
8 | # If a dry-run and with download ignore errors and correct setting for tools |
---|
9 | # and BSPs. Only after the source to download. |
---|
10 | # |
---|
11 | %if %{_dry_run} && %{defined with_download} |
---|
12 | %log Kenrel configuration errors ignored |
---|
13 | %define rtems_kernel_error 0 |
---|
14 | %else |
---|
15 | %define rtems_kernel_error 1 |
---|
16 | %endif |
---|
17 | |
---|
18 | %if %{rsb_released} |
---|
19 | %define rtems_kernel_version %{rsb_version} |
---|
20 | %endif |
---|
21 | |
---|
22 | # |
---|
23 | # The target. It could be set in rtems_target. |
---|
24 | # |
---|
25 | %if %{defined rtems_target} |
---|
26 | %define _target %{rtems_target} |
---|
27 | %endif |
---|
28 | %if %{_target} == %{nil} && %{rtems_kernel_error} |
---|
29 | %error No RTEMS target specified: --target=<arch>-rtems<ver>. |
---|
30 | %endif |
---|
31 | |
---|
32 | # |
---|
33 | # The BSP. |
---|
34 | # |
---|
35 | %if !%{defined with_rtems_bsp} && %{rtems_kernel_error} |
---|
36 | %error No RTEMS BSP specified: --with-rtems-bsp=bsp |
---|
37 | %endif |
---|
38 | %define rtems_bsp %{with_rtems_bsp} |
---|
39 | |
---|
40 | # |
---|
41 | # If no tools are provided use the prefix. |
---|
42 | # |
---|
43 | %ifn %{defined with_tools} |
---|
44 | %define with_tools %{_prefix} |
---|
45 | %endif |
---|
46 | |
---|
47 | # |
---|
48 | # Set the path to the tools. |
---|
49 | # |
---|
50 | %{path prepend %{with_tools}/bin} |
---|
51 | |
---|
52 | # |
---|
53 | # Define the package. |
---|
54 | # |
---|
55 | package: rtems-%{rtems_version}-%{_target}-%{rtems_bsp}-%{_host}-%{release} |
---|
56 | |
---|
57 | # |
---|
58 | # Package details. |
---|
59 | # |
---|
60 | Name: %{_target}-kernel-%{rtems_bsp}-%{release} |
---|
61 | Summary: RTEMS v%{rtems_kernel_version} for target %{_target} BSP %{rtems_bsp} |
---|
62 | Version: %{rtems_kernel_version} |
---|
63 | Release: %{release} |
---|
64 | URL: https://www.rtems.org/ |
---|
65 | |
---|
66 | %include %{_configdir}/checks.cfg |
---|
67 | %include %{_configdir}/base.cfg |
---|
68 | %include %{_configdir}/versions.cfg |
---|
69 | |
---|
70 | # |
---|
71 | # A magic internal path that would break if changes in the defaults.mc |
---|
72 | # macro file are made. |
---|
73 | # |
---|
74 | %define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN} |
---|
75 | |
---|
76 | # |
---|
77 | # Check the version of autoconf. Check autoreconf as it is used. |
---|
78 | # |
---|
79 | %if %{__autoreconf_ver} <= 2.68 |
---|
80 | %if %{__autoreconf_bindir_ver} <= 2.68 |
---|
81 | %if %{__autoreconf_path_ver} <= 2.68 |
---|
82 | %error Autoconf (autoreconf) version 2.69 or higher is needed. |
---|
83 | %endif |
---|
84 | %endif |
---|
85 | %endif |
---|
86 | |
---|
87 | # |
---|
88 | # If no tools provided use the prefix. |
---|
89 | # |
---|
90 | %ifn %{defined with_tools} |
---|
91 | %define with_tools %{_prefix} |
---|
92 | %endif |
---|
93 | |
---|
94 | # |
---|
95 | # Check options. |
---|
96 | # |
---|
97 | %if %{defined without_rtems_posix} |
---|
98 | %define rtems_posix 0 |
---|
99 | %endif |
---|
100 | |
---|
101 | %if %{defined with_rtems_legacy_network} |
---|
102 | %define rtems_networking 1 |
---|
103 | %endif |
---|
104 | |
---|
105 | %if %{defined with_rtems_cxx} |
---|
106 | %define rtems_cxx 1 |
---|
107 | %endif |
---|
108 | |
---|
109 | %if %{defined with_rtems_bspopts} |
---|
110 | %define bspopts %{with_rtems_bspopts} |
---|
111 | %endif |
---|
112 | |
---|
113 | # |
---|
114 | # Source |
---|
115 | # |
---|
116 | %if %{rsb_released} |
---|
117 | %define rtems_kernel_file rtems-%{rtems_kernel_version}.tar.xz |
---|
118 | %define rtems_bootstrap 0 |
---|
119 | %else |
---|
120 | %define rtems_kernel_file rtems-kernel-%{rtems_kernel_version}.tar.bz2 |
---|
121 | # |
---|
122 | # The code in git needs to be bootstrapped. Do each build because we have |
---|
123 | # no way to change what changes may have happened in the code. |
---|
124 | # |
---|
125 | %define rtems_bootstrap 1 |
---|
126 | %endif |
---|
127 | |
---|
128 | %if ! %{defined rtems_kernel_version} |
---|
129 | %error No RTEMS kernel version defined |
---|
130 | %endif |
---|
131 | |
---|
132 | %source set rtems_kernel --rsb-file=%{rtems_kernel_file} \ |
---|
133 | https://git.rtems.org/rtems/snapshot/rtems-%{rtems_kernel_version}.tar.bz2 |
---|
134 | |
---|
135 | # |
---|
136 | # Check the various --with/--without options we support. These are |
---|
137 | # turned into the internal settings. |
---|
138 | # |
---|
139 | # --target : The architecture |
---|
140 | # --with-rtems-bsp : The BSP |
---|
141 | # --without-rtems-bsp : Not supported |
---|
142 | # --with-rtems-tests : Supported, samples/yes/no |
---|
143 | # --without-rtems-tests : Supported, forced to no |
---|
144 | # --with-rtems-smp : Supported |
---|
145 | # --without-rtems-smp : Don't care |
---|
146 | # --with-rtems-legacy-network : Supported |
---|
147 | # --without-rtems-legacy-network : Don't care |
---|
148 | # --with-rtems-bspopts : Supported, quote for a list |
---|
149 | # --without-rtems-bspopts : Don't care |
---|
150 | # |
---|
151 | %if %{defined without_rtemsbsp} |
---|
152 | %error Option --without-rtemsbsp is not supported. |
---|
153 | %endif |
---|
154 | %if %{defined without_rtems_tests} |
---|
155 | %define with_rtems_tests no |
---|
156 | %endif |
---|
157 | %if %{defined with_rtems_tests} |
---|
158 | %if %{with_rtems_tests} == 1 |
---|
159 | %define with_rtems_tests yes |
---|
160 | %endif |
---|
161 | %if %{with_rtems_tests} == yes || \ |
---|
162 | %{with_rtems_tests} == no || \ |
---|
163 | %{with_rtems_tests} == samples |
---|
164 | %define rtems_tests %{with_rtems_tests} |
---|
165 | %endif |
---|
166 | %endif |
---|
167 | %if %{defined with_rtems_smp} |
---|
168 | %define rtems_smp 1 |
---|
169 | %endif |
---|
170 | %if %{defined with_rtems_legacy_network} |
---|
171 | %define rtems_networking 1 |
---|
172 | %endif |
---|
173 | %if %{defined with_rtems_bspopts} |
---|
174 | %define rtems_bspopts %{with_rtems_bspopts} |
---|
175 | %endif |
---|
176 | |
---|
177 | # |
---|
178 | # If C++ defined for the tool set use it to control RTEMS's setting.. |
---|
179 | # |
---|
180 | %if %{defined enable_cxx} |
---|
181 | %define rtems_cxx %{enable_cxx} |
---|
182 | %endif |
---|
183 | |
---|
184 | # |
---|
185 | # Default set up. Override these in a BSP if you want a |
---|
186 | # specific setup. |
---|
187 | # |
---|
188 | %ifn %{defined rtems_posix} |
---|
189 | %define rtems_posix 1 |
---|
190 | %endif |
---|
191 | %ifn %{defined rtems_networking} |
---|
192 | %define rtems_networking 0 |
---|
193 | %endif |
---|
194 | %ifn %{defined rtems_cxx} |
---|
195 | %define rtems_cxx 1 |
---|
196 | %endif |
---|
197 | %ifn %{defined rtems_tests} |
---|
198 | %define rtems_tests samples |
---|
199 | %endif |
---|
200 | %ifn %{defined rtems_bspopts} |
---|
201 | %define rtems_bspopts %{nil} |
---|
202 | %endif |
---|
203 | |
---|
204 | # |
---|
205 | # Prepare the source code. |
---|
206 | # |
---|
207 | %prep |
---|
208 | source_dir_rtems="rtems-%{rtems_kernel_version}" |
---|
209 | %source setup rtems_kernel -q -c -n %{name}-%{version} |
---|
210 | cd ${source_dir_rtems} |
---|
211 | %patch setup rtems_kernel -p1 |
---|
212 | %if %{rtems_bootstrap} |
---|
213 | %if %{defined _internal_autotools_path} |
---|
214 | export PATH="%{_internal_autotools_path}/bin:${PATH}" |
---|
215 | %endif |
---|
216 | ./bootstrap -c |
---|
217 | %{_sbdir}/sb-bootstrap --preinstall |
---|
218 | %{_sbdir}/sb-bootstrap |
---|
219 | %endif |
---|
220 | cd .. |
---|
221 | |
---|
222 | %build |
---|
223 | # Build directory support. |
---|
224 | if test "%{_build}" != "%{_host}" ; then |
---|
225 | build_dir="build-cxc" |
---|
226 | else |
---|
227 | build_dir="build" |
---|
228 | fi |
---|
229 | mkdir -p ${build_dir} |
---|
230 | cd ${build_dir} |
---|
231 | |
---|
232 | ../${source_dir_rtems}/configure \ |
---|
233 | --build=%{_build} --host=%{_host} \ |
---|
234 | --target=%{_target} \ |
---|
235 | --enable-rtemsbsp="%{rtems_bsp}" \ |
---|
236 | %{?rtems_cxx:--enable-cxx}%{!?rtems_cxx:--disable-cxx} \ |
---|
237 | %{?rtems_posix:--enable-posix}%{!?rtems_posix:--disable-posix} \ |
---|
238 | %{?rtems_networking:--enable-networking}%{!?rtems_networking:--disable-networking} \ |
---|
239 | %{?rtems_tests:--enable-tests=%{rtems_tests}} \ |
---|
240 | %{?rtems_smp:--enable-smp} \ |
---|
241 | --prefix=%{_prefix} --bindir=%{_bindir} \ |
---|
242 | --exec-prefix=%{_exec_prefix} \ |
---|
243 | --includedir=%{_includedir} --libdir=%{_libdir} \ |
---|
244 | --mandir=%{_mandir} --infodir=%{_infodir} \ |
---|
245 | %{rtems_bspopts} |
---|
246 | |
---|
247 | %{__make} %{?_smp_mflags} all |
---|
248 | cd .. |
---|
249 | |
---|
250 | %install |
---|
251 | %{__rmdir} $SB_BUILD_ROOT |
---|
252 | |
---|
253 | cd ${build_dir} |
---|
254 | %{__make} DESTDIR=$SB_BUILD_ROOT install |
---|
255 | |
---|
256 | %if %{rtems_tests} != no |
---|
257 | %define rtems_test_install %{_target}/%{rtems_bsp}/tests |
---|
258 | mkdir -p $SB_BUILD_ROOT/%{_prefix}/%{rtems_test_install} |
---|
259 | find . -name \*.exe -and -not -name \*.norun.exe \ |
---|
260 | -exec cp -v \{\} $SB_BUILD_ROOT/%{_prefix}/%{rtems_test_install}/ \; |
---|
261 | %endif |
---|
262 | |
---|
263 | cd .. |
---|