]>
Commit | Line | Data |
---|---|---|
c9753b19 | 1 | # |
66f4e461 AM |
2 | # TODO: |
3 | # - add filtering out -Wl,-z,-combreloc in gcc wrapper | |
4 | # (causes linking to be done against glibc instead of uclibc) | |
5 | # | |
c9753b19 ER |
6 | # Conditional build: |
7 | %bcond_without shared # don't build shared lib support | |
3bde88e0 ER |
8 | %bcond_with verbose # verbose mode |
9 | # | |
10 | %ifarch alpha | |
11 | %undefine with_shared | |
12 | %endif | |
c9753b19 | 13 | # |
70879d06 | 14 | Summary: C library optimized for size |
2a309db2 | 15 | Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar |
70879d06 | 16 | Name: uClibc |
835882e7 | 17 | Version: 0.9.29 |
e4b6da26 | 18 | Release: 19 |
95116193 | 19 | Epoch: 2 |
1e0be70f | 20 | License: LGPL v2.1 |
3698d221 | 21 | Group: Libraries |
22 | Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.bz2 | |
835882e7 | 23 | # Source0-md5: 61dc55f43b17a38a074f347e74095b20 |
eacf49ba | 24 | Patch0: %{name}-newsoname.patch |
835882e7 JB |
25 | Patch1: %{name}-toolchain-wrapper.patch |
26 | Patch2: %{name}-targetcpu.patch | |
21f5f0fd | 27 | Patch3: %{name}-debug.patch |
4ae50705 JB |
28 | Patch4: %{name}-stdio-unhide.patch |
29 | Patch5: %{name}-sparc.patch | |
3698d221 | 30 | URL: http://uclibc.org/ |
cd27c03b | 31 | BuildRequires: binutils-gasp |
c9753b19 | 32 | BuildRequires: cpp |
cd27c03b | 33 | BuildRequires: gcc >= 5:3.0 |
0e912c1e | 34 | BuildRequires: linux-libc-headers >= 7:2.6.24 |
91b0210c | 35 | BuildRequires: sed >= 4.0 |
d49d5dcf | 36 | BuildRequires: which |
f230b68a | 37 | ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664} |
70879d06 | 38 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
70879d06 | 39 | |
8e0ba786 ER |
40 | %define specflags -fgnu89-inline |
41 | ||
835882e7 | 42 | %define uclibc_root /usr/%{_target_cpu}-linux-uclibc |
1f16f3bd | 43 | |
70879d06 | 44 | %description |
45 | Small libc for building embedded applications. | |
46 | ||
adb3d9c8 JR |
47 | %description -l pl.UTF-8 |
48 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 49 | |
3698d221 | 50 | %package devel |
70879d06 | 51 | Summary: Development files for uClibc |
2a309db2 | 52 | Summary(pl.UTF-8): Pliki dla programistów uClibc |
70879d06 | 53 | Group: Development/Libraries |
2af21321 | 54 | Requires: %{name} = %{epoch}:%{version}-%{release} |
66ea2345 | 55 | Requires: binutils-gasp |
0e912c1e | 56 | Requires: linux-libc-headers >= 7:2.6.24 |
33f7e18e | 57 | %requires_eq gcc |
70879d06 | 58 | |
3698d221 | 59 | %description devel |
70879d06 | 60 | Small libc for building embedded applications. |
61 | ||
adb3d9c8 JR |
62 | %description devel -l pl.UTF-8 |
63 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 64 | |
3698d221 | 65 | %package static |
8ff09ad0 | 66 | Summary: Static uClibc libraries |
2a309db2 | 67 | Summary(pl.UTF-8): Biblioteki statyczne uClibc |
70879d06 | 68 | Group: Development/Libraries |
2af21321 | 69 | Requires: %{name}-devel = %{epoch}:%{version}-%{release} |
15ba795d | 70 | Provides: libc-static |
70879d06 | 71 | |
3698d221 | 72 | %description static |
8ff09ad0 | 73 | Static uClibc libraries. |
70879d06 | 74 | |
adb3d9c8 | 75 | %description static -l pl.UTF-8 |
3698d221 | 76 | Biblioteki statyczne uClibc. |
056323ce | 77 | |
70879d06 | 78 | %prep |
8733b462 | 79 | %setup -q |
30b1dd68 JB |
80 | %patch0 -p1 |
81 | %patch1 -p1 | |
fdce39e0 | 82 | %patch2 -p1 |
21f5f0fd | 83 | %patch3 -p1 |
4ae50705 | 84 | %patch4 -p1 |
b7bca0b9 | 85 | # check if it's needed now... ldso is broken on sparc anyway |
4ae50705 | 86 | #%patch5 -p1 |
70879d06 | 87 | |
df6ea0eb ER |
88 | # ARCH is already determined by uname -m |
89 | %ifarch %{ix86} | |
90 | defconfig=extra/Configs/defconfigs/i386 | |
91 | %ifarch i386 | |
92 | echo 'CONFIG_386=y' >> $defconfig | |
3698d221 | 93 | %endif |
df6ea0eb ER |
94 | %ifarch i486 |
95 | echo 'CONFIG_486=y' >> $defconfig | |
96 | %endif | |
97 | %ifarch i586 | |
98 | echo 'CONFIG_586=y' >> $defconfig | |
99 | %endif | |
100 | %ifarch i686 | |
101 | echo 'CONFIG_686=y' >> $defconfig | |
102 | %endif | |
103 | %ifarch pentium3 | |
104 | echo 'CONFIG_PENTIUMIII=y' >> $defconfig | |
105 | %endif | |
106 | %ifarch pentium4 | |
107 | echo 'CONFIG_PENTIUM4=y' >> $defconfig | |
108 | %endif | |
109 | %ifarch athlon | |
110 | echo 'CONFIG_K7=y' >> $defconfig | |
3698d221 | 111 | %endif |
9dfdc366 JB |
112 | %endif |
113 | %ifarch %{x8664} | |
df6ea0eb ER |
114 | defconfig=extra/Configs/defconfigs/x86_64 |
115 | %endif | |
116 | %ifarch alpha | |
117 | defconfig=extra/Configs/defconfigs/alpha | |
118 | %endif | |
119 | %ifarch sparc sparcv9 | |
120 | defconfig=extra/Configs/defconfigs/sparc | |
121 | %endif | |
122 | %ifarch ppc | |
123 | defconfig=extra/Configs/defconfigs/powerpc | |
124 | %endif | |
125 | %ifarch ia64 | |
126 | defconfig=extra/Configs/defconfigs/ia64 | |
3698d221 | 127 | %endif |
df6ea0eb ER |
128 | |
129 | cat <<'EOF' >> $defconfig | |
130 | UCLIBC_HAS_IPV6=y | |
131 | DO_C99_MATH=y | |
132 | UCLIBC_HAS_RPC=y | |
133 | # UCLIBC_HAS_FULL_RPC is not set | |
134 | # UCLIBC_HAS_REENTRANT_RPC is not set | |
135 | UCLIBC_HAS_SYS_SIGLIST=y | |
136 | SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib" | |
137 | %if %{without shared} | |
138 | HAVE_NO_SHARED=y | |
139 | # HAVE_SHARED is not set | |
140 | %endif | |
141 | UCLIBC_HAS_PRINTF_M_SPEC=y | |
142 | UCLIBC_SUSV3_LEGACY=y | |
143 | UCLIBC_SUSV3_LEGACY_MACROS=y | |
144 | # DOSTRIP is not set | |
145 | %{?debug:DODEBUG=y} | |
146 | %{?debug:SUPPORT_LD_DEBUG=y} | |
147 | %{?debug:SUPPORT_LD_DEBUG_EARLY=y} | |
148 | EOF | |
30b1dd68 | 149 | |
70879d06 | 150 | %build |
3bde88e0 | 151 | |
df6ea0eb ER |
152 | # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros |
153 | %{__make} defconfig \ | |
3bde88e0 | 154 | %{?with_verbose:VERBOSE=1} \ |
30b1dd68 | 155 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 | 156 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ |
5d1a434a | 157 | HOSTCC="%{__cc}" \ |
30b1dd68 | 158 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb ER |
159 | CC="%{__cc}" \ |
160 | OPTIMIZATION="%{rpmcflags} -Os" | |
161 | ||
3bde88e0 ER |
162 | # The Makefile includes .config and later tries to assign same variable, |
163 | # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value | |
164 | # for UCLIBC_LDSO in extra/gcc-uClibc. | |
165 | # So we pass it as make arg to be sure it's proper! | |
166 | target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g') | |
167 | ||
df6ea0eb | 168 | %{__make} \ |
3bde88e0 | 169 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 170 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 ER |
171 | TARGET_ARCH=$target_arch \ |
172 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ | |
cd27c03b | 173 | HOSTCC="%{__cc}" \ |
15afd9ab | 174 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb ER |
175 | CC="%{__cc}" \ |
176 | OPTIMIZATION="%{rpmcflags} -Os" | |
70879d06 | 177 | |
178 | %install | |
179 | rm -rf $RPM_BUILD_ROOT | |
3698d221 | 180 | install -d $RPM_BUILD_ROOT%{_bindir} |
70879d06 | 181 | |
415dc192 | 182 | %{__make} -j1 install \ |
3bde88e0 | 183 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 184 | TARGET_CPU="%{_target_cpu}" \ |
df6ea0eb ER |
185 | HOSTCC="%{__cc}" \ |
186 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ | |
c95f6ae8 | 187 | CC="%{__cc}" \ |
df6ea0eb ER |
188 | OPTIMIZATION="%{rpmcflags} -Os" \ |
189 | DESTDIR=$RPM_BUILD_ROOT | |
70879d06 | 190 | |
c9753b19 | 191 | %if %{with shared} |
835882e7 | 192 | mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so |
3bde88e0 ER |
193 | ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0 |
194 | chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so | |
c9753b19 | 195 | %endif |
835882e7 | 196 | |
b19cfcd2 | 197 | # these links are *needed* (by stuff in bin/) |
835882e7 | 198 | for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do |
c9753b19 ER |
199 | if [ -L $f ]; then |
200 | l=$(readlink $f) | |
201 | a=${l##*/} | |
202 | d=${l%/*} | |
203 | case "$d" in | |
204 | %{_bindir}) | |
205 | ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/} | |
206 | rm -f $f | |
207 | ;; | |
208 | $a) | |
209 | mv -f $f $RPM_BUILD_ROOT%{_bindir} | |
210 | ;; | |
211 | *) | |
212 | exit 1 | |
213 | ;; | |
214 | esac | |
215 | else | |
216 | a=${f#*/%{_target_cpu}-uclibc-} | |
217 | ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a | |
218 | mv -f $f $RPM_BUILD_ROOT%{_bindir} | |
219 | fi | |
30b1dd68 | 220 | done |
70879d06 | 221 | |
c9753b19 ER |
222 | for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do |
223 | if [ -L $f ]; then | |
224 | l=$(readlink $f) | |
225 | case "${l%/*}" in | |
226 | %{uclibc_root}/bin) | |
227 | a=${l#*/%{_target_cpu}-uclibc-} | |
228 | ln -sf %{_bindir}/$a $f | |
229 | ;; | |
230 | %{_bindir}) | |
231 | : | |
232 | ;; | |
233 | *) | |
234 | exit 2 | |
235 | ;; | |
236 | esac | |
237 | fi | |
f7ae07ef PS |
238 | done |
239 | ||
835882e7 JB |
240 | rm -rf $RPM_BUILD_ROOT%{uclibc_root}/usr/include/{linux,asm*} |
241 | ln -sf /usr/include/asm $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm | |
242 | ln -sf /usr/include/asm-generic $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-generic | |
f230b68a | 243 | # for future use |
e74b8a86 | 244 | %ifarch sparc64 |
835882e7 JB |
245 | ln -sf /usr/include/asm-sparc $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc |
246 | ln -sf /usr/include/asm-sparc64 $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc64 | |
485e7d55 | 247 | %endif |
835882e7 | 248 | ln -sf /usr/include/linux $RPM_BUILD_ROOT%{uclibc_root}/usr/include/linux |
3c259173 | 249 | |
70879d06 | 250 | %clean |
251 | rm -rf $RPM_BUILD_ROOT | |
252 | ||
70879d06 | 253 | %files |
254 | %defattr(644,root,root,755) | |
835882e7 JB |
255 | %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO |
256 | %dir %{uclibc_root} | |
f230b68a | 257 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
c9753b19 | 258 | %if %{with shared} |
835882e7 JB |
259 | %dir %{uclibc_root}/lib |
260 | %attr(755,root,root) %{uclibc_root}/lib/*.so* | |
9a46e67b | 261 | %endif |
c9753b19 | 262 | %endif |
70879d06 | 263 | |
3698d221 | 264 | %files devel |
70879d06 | 265 | %defattr(644,root,root,755) |
835882e7 | 266 | %doc docs/*.txt |
3bde88e0 ER |
267 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line |
268 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar | |
269 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as | |
270 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++ | |
271 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc | |
272 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp | |
273 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++ | |
274 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gasp | |
275 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc | |
276 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld | |
277 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm | |
278 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy | |
279 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump | |
280 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib | |
281 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size | |
282 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings | |
283 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip | |
835882e7 JB |
284 | %{uclibc_root}/usr/lib/*.o |
285 | %dir %{uclibc_root}/usr | |
286 | %dir %{uclibc_root}/usr/bin | |
3bde88e0 ER |
287 | %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line |
288 | %attr(755,root,root) %{uclibc_root}/usr/bin/ar | |
289 | %attr(755,root,root) %{uclibc_root}/usr/bin/as | |
290 | %attr(755,root,root) %{uclibc_root}/usr/bin/c++ | |
291 | %attr(755,root,root) %{uclibc_root}/usr/bin/cc | |
292 | %attr(755,root,root) %{uclibc_root}/usr/bin/cpp | |
293 | %attr(755,root,root) %{uclibc_root}/usr/bin/g++ | |
294 | %attr(755,root,root) %{uclibc_root}/usr/bin/gasp | |
295 | %attr(755,root,root) %{uclibc_root}/usr/bin/gcc | |
296 | %attr(755,root,root) %{uclibc_root}/usr/bin/ld | |
297 | %attr(755,root,root) %{uclibc_root}/usr/bin/nm | |
298 | %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy | |
299 | %attr(755,root,root) %{uclibc_root}/usr/bin/objdump | |
300 | %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib | |
301 | %attr(755,root,root) %{uclibc_root}/usr/bin/size | |
302 | %attr(755,root,root) %{uclibc_root}/usr/bin/strings | |
303 | %attr(755,root,root) %{uclibc_root}/usr/bin/strip | |
835882e7 | 304 | %dir %{uclibc_root}/usr/lib |
c9753b19 | 305 | %if %{with shared} |
835882e7 | 306 | %{uclibc_root}/usr/lib/uclibc_nonshared.a |
f230b68a | 307 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
835882e7 | 308 | %attr(755,root,root) %{uclibc_root}/usr/lib/*.so |
1a8228b3 | 309 | %endif |
c9753b19 | 310 | %endif |
835882e7 | 311 | %{uclibc_root}/usr/include |
3698d221 | 312 | |
313 | %files static | |
98274bf4 | 314 | %defattr(644,root,root,755) |
835882e7 | 315 | %{uclibc_root}/usr/lib/lib*.a |