source: rtems-source-builder/rtems/config/tools/rtems-kernel-common.cfg @ dbc11a8

Last change on this file since dbc11a8 was def9347, checked in by Ryan Long <ryan.long@…>, on 10/12/21 at 19:01:44

rtems-kernel: Implement kernel recipe using waf

Closes #4145

  • Property mode set to 100644
File size: 6.6 KB
Line 
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 Kernel 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%if %{defined with_rtems_bsp_config}
23 %define _target %(%{_sbdir}/sb/rtems-kernel-config-check -v %{rtems_version} -t %{with_rtems_bsp_config})
24 %define rtems_bsp %(%{_sbdir}/sb/rtems-kernel-config-check -b %{with_rtems_bsp_config})
25%endif
26
27#
28# The target. It could be set in rtems_target.
29#
30%if %{defined rtems_target} && !%{defined with_rtems_bsp_config}
31 %define _target %{rtems_target}
32%endif
33%if %{_target} == %{nil} && %{rtems_kernel_error}
34 %error No RTEMS target specified: --target=<arch>-rtems<ver>.
35%endif
36
37#
38# The BSP.
39#
40%if !%{defined with_rtems_bsp} && %{rtems_kernel_error} && !%{defined with_rtems_bsp_config}
41 %error No RTEMS BSP specified: --with-rtems-bsp=bsp
42%endif
43%if !%{defined with_rtems_bsp_config}
44 %define rtems_bsp %{with_rtems_bsp}
45%endif
46
47#
48# Configuration file used with waf
49#
50%ifn %{defined with_rtems_bsp_config}
51 %define config_file config-%{_target}-%{rtems_bsp}.ini
52%else
53 %define config_file %{with_rtems_bsp_config}
54%endif
55
56#
57# If no tools are provided use the prefix.
58#
59%ifn %{defined with_tools}
60 %define with_tools %{_prefix}
61%endif
62
63#
64# Set the path to the tools.
65#
66%{path prepend %{with_tools}/bin}
67
68#
69# Define the package.
70#
71package: rtems-%{rtems_version}-%{_target}-%{rtems_bsp}-%{_host}-%{release}
72
73#
74# Package details.
75#
76Name:    %{_target}-kernel-%{rtems_bsp}-%{release}
77Summary: RTEMS v%{rtems_kernel_version} for target %{_target} BSP %{rtems_bsp}
78Version: %{rtems_kernel_version}
79Release: %{release}
80URL:     https://www.rtems.org/
81
82%include %{_configdir}/checks.cfg
83%include %{_configdir}/base.cfg
84%include %{_configdir}/versions.cfg
85
86#
87# A magic internal path that would break if changes in the defaults.mc
88# macro file are made.
89#
90%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
91
92#
93# Check the version of autoconf. Check autoreconf as it is used.
94#
95%if %{__autoreconf_ver} <= 2.68
96 %if %{__autoreconf_bindir_ver} <= 2.68
97  %if %{__autoreconf_path_ver} <= 2.68
98   %error Autoconf (autoreconf) version 2.69 or higher is needed.
99  %endif
100 %endif
101%endif
102
103#
104# If no tools provided use the prefix.
105#
106%ifn %{defined with_tools}
107 %define with_tools %{_prefix}
108%endif
109
110#
111# Check options.
112#
113%if %{defined without_rtems_posix}
114 %define rtems_posix 0
115%endif
116
117%if %{defined with_rtems_bspopts}
118 %define bspopts %{with_rtems_bspopts}
119%endif
120
121#
122# Source
123#
124%if %{rsb_released}
125 %define rtems_kernel_file rtems-%{rtems_kernel_version}.tar.xz
126 %define rtems_bootstrap 0
127%else
128 %define rtems_kernel_file rtems-kernel-%{rtems_kernel_version}.tar.bz2
129 #
130 # The code in git needs to be bootstrapped. Do each build because we have
131 # no way to change what changes may have happened in the code.
132 #
133 %define rtems_bootstrap 1
134%endif
135
136%if ! %{defined rtems_kernel_version}
137 %error No RTEMS kernel version defined
138%endif
139
140%source set rtems_kernel --rsb-file=%{rtems_kernel_file} \
141              https://git.rtems.org/rtems/snapshot/rtems-%{rtems_kernel_version}.tar.bz2
142
143#
144# Check the various --with/--without options we support. These are
145# turned into the internal settings.
146#
147# --target                       : The architecture
148# --with-rtems-bsp               : The BSP
149# --without-rtems-bsp            : Not supported
150# --with-rtems-tests             : Supported, samples/yes/no
151# --without-rtems-tests          : Supported, forced to no
152# --with-rtems-smp               : Supported
153# --without-rtems-smp            : Don't care
154# --with-rtems-legacy-network    : Unsupported
155# --without-rtems-legacy-network : Don't care
156%if %{defined without_rtemsbsp}
157 %error Option --without-rtemsbsp is not supported.
158%endif
159%if %{defined with_rtems_legacy_network}
160 echo "RTEMS legacy network has been removed."
161 echo "Please review and update your configuration."
162 exit 1
163%endif
164%if %{defined enable_cxx}
165 echo CXX has been removed."
166 echo "Please review and update your configuration."
167 exit 1
168%endif
169
170%if %{defined without_rtems_tests}
171 %define rtems_tests False
172 %define rtems_sample_tests False
173%endif
174%if %{defined with_rtems_tests}
175 %if %{with_rtems_tests} == 1
176   %define rtems_tests True
177   %define rtems_sample_tests True
178 %endif
179  %if %{with_rtems_tests} == samples
180      %define rtems_tests False
181      %define rtems_sample_tests True
182 %endif
183%endif
184%if %{defined with_rtems_smp}
185 %define rtems_smp 1
186%endif
187%if %{defined with_rtems_bspopts}
188 %define rtems_bspopts %{with_rtems_bspopts}
189%endif
190
191
192#
193# Default set up. Override these in a BSP if you want a
194# specific setup.
195#
196%ifn %{defined rtems_posix}
197 %define rtems_posix 1
198%endif
199%ifn %{defined rtems_tests}
200 %define rtems_tests False
201 %define rtems_sample_tests True
202%endif
203%ifn %{defined rtems_bspopts}
204 %define rtems_bspopts %{nil}
205%endif
206
207#
208# Prepare the source code.
209#
210%prep
211  source_dir_rtems="rtems-%{rtems_kernel_version}"
212  %source setup rtems_kernel -q -c -n %{name}-%{version}
213  cd ${source_dir_rtems}
214  %patch setup rtems_kernel -p1
215  %if %{rtems_bootstrap}
216    %if %{defined _internal_autotools_path}
217      export PATH="%{_internal_autotools_path}/bin:${PATH}"
218    %endif
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
230  cd ${source_dir_rtems}
231
232  %if %{defined without_rtems_bsp_config}
233    cpu=`echo %{_target} | cut -d- -f1`
234    echo "[${cpu}/%{rtems_bsp}]" > %{config_file}
235    echo "RTEMS_POSIX_API = %{?rtems_posix:True}%{!?rtems_posix:False}" >> %{config_file}
236    echo "RTEMS_SMP = %{?rtems_smp:True}%{!?rtems_smp:False}" >> %{config_file}
237    echo "BUILD_TESTS = %{rtems_tests}" >> %{config_file}
238    echo "BUILD_SAMPLES = %{rtems_sample_tests}" >> %{config_file}
239  %endif
240
241  mkdir -p ${build_dir}
242
243  ./waf configure \
244    --rtems-bsps=%{_target}/%{rtems_bsp} \
245    --prefix=%{_prefix} --bindir=%{_bindir} \
246    --rtems-config=%{config_file}
247
248  ./waf %{?_smp_mflags}
249
250  cd ..
251
252%install
253  %{__rmdir} $SB_BUILD_ROOT
254
255  cd ${source_dir_rtems}
256  ./waf --destdir=$SB_BUILD_ROOT install
257
258  echo "rtems_tests: %{rtems_tests}"
259
260  %if %{rtems_tests} != False
261   %define rtems_test_install %{_target}/%{rtems_bsp}/tests
262   mkdir -p $SB_BUILD_ROOT/%{_prefix}/%{rtems_test_install}
263   find . -name \*.exe -and -not -name \*.norun.exe \
264      -exec cp -v \{\} $SB_BUILD_ROOT/%{_prefix}/%{rtems_test_install}/ \;
265  %endif
266
267  cd -
Note: See TracBrowser for help on using the repository browser.