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