1 | # |
---|
2 | # RTEMS 4.xx Version 1. |
---|
3 | # |
---|
4 | # This configuration file configure's, make's and install's RTEMS. |
---|
5 | # |
---|
6 | |
---|
7 | %if %{rsb_released} |
---|
8 | %define rtems_kernel_version %{rsb_version} |
---|
9 | %else |
---|
10 | %define rtems_kernel_version %{rtems_version} |
---|
11 | %endif |
---|
12 | |
---|
13 | # |
---|
14 | # Package details. |
---|
15 | # |
---|
16 | Name: %{_target}-kernel-%{rtems_kernel_version}-%{release} |
---|
17 | Summary: RTEMS v%{rtems_kernel_version} for target %{_target} on host %{_host} |
---|
18 | Version: %{rtems_kernel_version} |
---|
19 | Release: %{release} |
---|
20 | URL: http://www.rtems.org/ |
---|
21 | BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n) |
---|
22 | |
---|
23 | # |
---|
24 | # Build if the RSB is released or optionally enable/disable building the RTEMS |
---|
25 | # kernel via the command line. |
---|
26 | # |
---|
27 | %if %{rsb_released} || %{defined with_rtems} |
---|
28 | %define rtems_kernel_build 1 |
---|
29 | %else |
---|
30 | %define rtems_kernel_build 0 |
---|
31 | %endif |
---|
32 | %if %{defined without_rtems} |
---|
33 | %define rtems_kernel_build 0 |
---|
34 | %endif |
---|
35 | |
---|
36 | %if %{rtems_kernel_build} |
---|
37 | %include %{_configdir}/checks.cfg |
---|
38 | %include %{_configdir}/base.cfg |
---|
39 | %include %{_configdir}/versions.cfg |
---|
40 | |
---|
41 | # |
---|
42 | # A magic internal path that would break if changes in the defaults.mc |
---|
43 | # macro file are made. |
---|
44 | # |
---|
45 | %define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN} |
---|
46 | |
---|
47 | # |
---|
48 | # Check the version of autoconf. Check autoreconf as it is used. |
---|
49 | # |
---|
50 | %if %{__autoreconf_ver} <= 2.68 |
---|
51 | %if %{__autoreconf_bindir_ver} <= 2.68 |
---|
52 | %if %{__autoreconf_path_ver} <= 2.68 |
---|
53 | %error Autoconf (autoreconf) version 2.69 or higher is needed. |
---|
54 | %endif |
---|
55 | %endif |
---|
56 | %endif |
---|
57 | |
---|
58 | # |
---|
59 | # Source |
---|
60 | # |
---|
61 | %if %{rsb_released} |
---|
62 | %if ! %{defined rtems_kernel_compression} |
---|
63 | %define rtems_kernel_compression xz |
---|
64 | %endif |
---|
65 | %define rtems_bootstrap 0 |
---|
66 | %else |
---|
67 | %if ! %{defined rtems_kernel_version} |
---|
68 | %define rtems_kernel_version HEAD |
---|
69 | %endif |
---|
70 | %if %{defined rtems_kernel_git_commit_hash} |
---|
71 | %define rtems_kernel_git_checkout ?checkout=%{defined rtems_kernel_git_commit_hash} |
---|
72 | %else |
---|
73 | %define rtems_kernel_git_checkout %{nil} |
---|
74 | %endif |
---|
75 | |
---|
76 | %source set rtems git://git.rtems.org/rtems.git?reset=hard?branch=%{rtems_kernel_version}?pull%{rtems_kernel_git_checkout} |
---|
77 | |
---|
78 | # |
---|
79 | # The code in git needs to be bootstrapped. Do each build because we have |
---|
80 | # no way to change what changes may have happened in the code. |
---|
81 | # |
---|
82 | %define rtems_bootstrap 1 |
---|
83 | %endif |
---|
84 | |
---|
85 | # |
---|
86 | # If C++ defined for the tool set use it to control RTEMS's setting.. |
---|
87 | # |
---|
88 | %if %{defined enable_cxx} |
---|
89 | %define rtems_cxx %{enable_cxx} |
---|
90 | %endif |
---|
91 | |
---|
92 | # |
---|
93 | # Default set up. |
---|
94 | # |
---|
95 | %ifn %{defined rtems_posix} |
---|
96 | %define rtems_posix 1 |
---|
97 | %endif |
---|
98 | %ifn %{defined rtems_networking} |
---|
99 | %define rtems_networking 1 |
---|
100 | %endif |
---|
101 | %ifn %{defined rtems_cxx} |
---|
102 | %define rtems_cxx 1 |
---|
103 | %endif |
---|
104 | %ifn %{defined rtems_tests} |
---|
105 | %define rtems_tests samples |
---|
106 | %endif |
---|
107 | |
---|
108 | %if %{rtems_tests} == disable |
---|
109 | %define rtems_tests_opt --disable-tests |
---|
110 | %else |
---|
111 | %define rtems_tests_opt --enable-tests=%{rtems_tests} |
---|
112 | %endif |
---|
113 | |
---|
114 | # |
---|
115 | # Check the various --with/--without options we support. |
---|
116 | # |
---|
117 | # --with-rtemsbsp : Supported, list of BSPs |
---|
118 | # --without-rtemsbsp: Not supported |
---|
119 | # --with-tests : Supported, samples/yes/no |
---|
120 | # --without-tests : Not supported |
---|
121 | # --with-smp : Supported |
---|
122 | # --without-smp : Not care |
---|
123 | # |
---|
124 | # |
---|
125 | %if %{defined without_rtemsbsp} |
---|
126 | %error Option --without-rtemsbsp is not supported. |
---|
127 | %endif |
---|
128 | %if %{defined without_rtems_tests} |
---|
129 | %define with_rtems_tests no |
---|
130 | %endif |
---|
131 | |
---|
132 | # |
---|
133 | # Prepare the source code. |
---|
134 | # |
---|
135 | %prep |
---|
136 | source_dir_rtems="rtems-%{rtems_kernel_version}" |
---|
137 | %source setup rtems -q -c -n %{name}-%{version} |
---|
138 | cd ${source_dir_rtems} |
---|
139 | %patch setup rtems -p1 |
---|
140 | %if %{rtems_bootstrap} |
---|
141 | %if %{defined _internal_autotools_path} |
---|
142 | export PATH="%{_internal_autotools_path}/bin:${PATH}" |
---|
143 | %endif |
---|
144 | ./bootstrap -c |
---|
145 | %{_sbdir}/sb-bootstrap --preinstall |
---|
146 | %{_sbdir}/sb-bootstrap |
---|
147 | %endif |
---|
148 | cd .. |
---|
149 | |
---|
150 | %build |
---|
151 | # Build directory support. |
---|
152 | if test "%{_build}" != "%{_host}" ; then |
---|
153 | build_dir="build-cxc" |
---|
154 | else |
---|
155 | build_dir="build" |
---|
156 | fi |
---|
157 | mkdir -p ${build_dir} |
---|
158 | cd ${build_dir} |
---|
159 | |
---|
160 | ../${source_dir_rtems}/configure \ |
---|
161 | --build=%{_build} --host=%{_host} \ |
---|
162 | --target=%{_target} \ |
---|
163 | %{?rtems_posix:--enable-posix}%{!?rtems_posix:--disable-posix} \ |
---|
164 | %{?rtems_networking:--enable-networking}%{!?rtems_networking:--disable-networking} \ |
---|
165 | %{?rtems_cxx:--enable-cxx}%{!?rtems_cxx:--disable-cxx} \ |
---|
166 | %{?with_rtems_tests:--enable-tests=%{with_rtems_tests}} \ |
---|
167 | %{?with_rtemsbsp:--enable-rtemsbsp="%{with_rtemsbsp}"} \ |
---|
168 | %{?with_rtems_smp:--enable-smp} \ |
---|
169 | --prefix=%{_prefix} --bindir=%{_bindir} \ |
---|
170 | --exec-prefix=%{_exec_prefix} \ |
---|
171 | --includedir=%{_includedir} --libdir=%{_libdir} \ |
---|
172 | --mandir=%{_mandir} --infodir=%{_infodir} |
---|
173 | |
---|
174 | %{__make} %{?_smp_mflags} all |
---|
175 | cd .. |
---|
176 | |
---|
177 | %install |
---|
178 | %{__rmdir} $SB_BUILD_ROOT |
---|
179 | |
---|
180 | cd ${build_dir} |
---|
181 | %{__make} DESTDIR=$SB_BUILD_ROOT install |
---|
182 | |
---|
183 | cd .. |
---|
184 | |
---|
185 | %endif |
---|