3 %bcond_without shared # don't build shared lib support
4 %bcond_with nptl # libpthread: NPTL instead of LinuxThreads (experimental; no i386)
5 %bcond_without verbose # verbose mode
11 Summary: C library optimized for size
12 Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar
19 Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.xz
20 # Source0-md5: 73e6fe215648d02246f4d195b25fb17e
21 Patch0: %{name}-newsoname.patch
22 Patch1: %{name}-toolchain-wrapper.patch
23 Patch2: %{name}-targetcpu.patch
24 Patch3: %{name}-debug.patch
25 Patch4: %{name}-stdio-unhide.patch
26 Patch5: %{name}-kernel-types.patch
27 Patch6: %{name}-features.patch
28 URL: http://uclibc.org/
29 BuildRequires: binutils >= 2.16
32 BuildRequires: gcc >= 5:4.1
34 BuildRequires: gcc >= 5:3.0
36 BuildRequires: linux-libc-headers >= 7:2.6.27
37 BuildRequires: make >= 3.80
38 BuildRequires: ncurses-devel
39 BuildRequires: rpmbuild(macros) >= 1.453
40 BuildRequires: sed >= 4.0
41 BuildRequires: tar >= 1:1.22
44 %{?with_nptl:Requires: uname(version) >= 2.6}
45 # only these supported by this .spec; uClibc code supports some more
46 ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664}
47 %{?with_nptl:ExcludeArch: i386}
48 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
50 %if "%{cc_version}" >= "4.2"
51 %define specflags -fgnu89-inline
54 %define filterout -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4
56 %define uclibc_root /usr/%{_target_cpu}-linux-uclibc
59 Small libc for building embedded applications.
61 %description -l pl.UTF-8
62 Mała libc do budowania aplikacji wbudowanych.
65 Summary: Development files for uClibc
66 Summary(pl.UTF-8): Pliki dla programistów uClibc
67 Group: Development/Libraries
68 Requires: %{name} = %{epoch}:%{version}-%{release}
69 Requires: linux-libc-headers >= 7:2.6.27
73 Small libc for building embedded applications.
75 %description devel -l pl.UTF-8
76 Mała libc do budowania aplikacji wbudowanych.
79 Summary: Static uClibc libraries
80 Summary(pl.UTF-8): Biblioteki statyczne uClibc
81 Group: Development/Libraries
82 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
86 Static uClibc libraries.
88 %description static -l pl.UTF-8
89 Biblioteki statyczne uClibc.
101 # ARCH is already determined by uname -m
103 defconfig=extra/Configs/defconfigs/i386/defconfig
105 echo 'CONFIG_386=y' >> $defconfig
108 echo 'CONFIG_486=y' >> $defconfig
111 echo 'CONFIG_586=y' >> $defconfig
114 echo 'CONFIG_686=y' >> $defconfig
117 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
120 echo 'CONFIG_PENTIUM4=y' >> $defconfig
123 echo 'CONFIG_K7=y' >> $defconfig
127 defconfig=extra/Configs/defconfigs/x86_64/defconfig
130 defconfig=extra/Configs/defconfigs/alpha/defconfig
132 %ifarch sparc sparcv9
133 defconfig=extra/Configs/defconfigs/sparc/defconfig
136 defconfig=extra/Configs/defconfigs/powerpc/defconfig
139 defconfig=extra/Configs/defconfigs/ia64/defconfig
142 cat <<'EOF' >> $defconfig
143 # HAS_NO_THREADS is not set
144 %{!?with_nptl:LINUXTHREADS_OLD=y}
145 %{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=y}
150 # UCLIBC_HAS_FULL_RPC is not set
151 # UCLIBC_HAS_REENTRANT_RPC is not set
152 UCLIBC_HAS_SYS_SIGLIST=y
153 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
154 LDSO_GNU_HASH_SUPPORT=y
155 %if %{without shared}
157 # HAVE_SHARED is not set
159 UCLIBC_HAS_PRINTF_M_SPEC=y
160 UCLIBC_SUSV3_LEGACY=y
161 UCLIBC_SUSV3_LEGACY_MACROS=y
162 UCLIBC_SUSV4_LEGACY=y
164 UCLIBC_SUPPORT_AI_ADDRCONFIG=y
165 UCLIBC_HAS_RESOLVER_SUPPORT=y
166 UCLIBC_HAS_LIBRESOLV_STUB=y
167 UCLIBC_HAS_COMPAT_RES_STATE=y
168 UCLIBC_HAS_EXTRA_COMPAT_RES_STATE=y
171 %{?debug:SUPPORT_LD_DEBUG=y}
172 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
176 # use ld.bfd; gold doesn't work well for now
178 ln -s %{_bindir}/ld.bfd our-ld/ld
179 PATH=$(pwd)/our-ld:$PATH; export PATH
181 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
182 %{__make} -j1 defconfig \
183 %{?with_verbose:VERBOSE=1} \
184 TARGET_CPU="%{_target_cpu}" \
185 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
188 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
189 OPTIMIZATION="%{rpmcflags} -Os"
191 # The Makefile includes .config and later tries to assign same variable,
192 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
193 # for UCLIBC_LDSO in extra/gcc-uClibc.
194 # So we pass it as make arg to be sure it's proper!
195 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
198 %{?with_verbose:VERBOSE=1} \
199 TARGET_CPU="%{_target_cpu}" \
200 TARGET_ARCH=$target_arch \
201 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
204 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
205 OPTIMIZATION="%{rpmcflags} -Os"
208 rm -rf $RPM_BUILD_ROOT
209 install -d $RPM_BUILD_ROOT%{_bindir}
211 %{__make} -j1 install \
212 %{?with_verbose:VERBOSE=1} \
213 TARGET_CPU="%{_target_cpu}" \
215 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
217 OPTIMIZATION="%{rpmcflags} -Os" \
218 DESTDIR=$RPM_BUILD_ROOT
222 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
223 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
225 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
228 # these links are *needed* (by stuff in bin/)
229 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
236 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
240 mv -f $f $RPM_BUILD_ROOT%{_bindir}
247 a=${f#*/%{_target_cpu}-uclibc-}
248 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
249 mv -f $f $RPM_BUILD_ROOT%{_bindir}
253 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
258 a=${l#*/%{_target_cpu}-uclibc-}
259 ln -sf %{_bindir}/$a $f
271 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
272 for dir in asm asm-generic linux mtd rdma sound video xen; do
273 ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
277 rm -rf $RPM_BUILD_ROOT
280 %defattr(644,root,root,755)
281 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
283 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
285 %dir %{uclibc_root}/lib
286 %attr(755,root,root) %{uclibc_root}/lib/*.so*
291 %defattr(644,root,root,755)
293 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
294 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
295 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
296 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
297 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
298 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
299 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
300 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
301 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
302 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
303 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
304 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
305 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
306 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
307 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
308 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
309 %{uclibc_root}/usr/lib/*.o
310 %dir %{uclibc_root}/usr
311 %dir %{uclibc_root}/usr/bin
312 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
313 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
314 %attr(755,root,root) %{uclibc_root}/usr/bin/as
315 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
316 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
317 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
318 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
319 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
320 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
321 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
322 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
323 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
324 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
325 %attr(755,root,root) %{uclibc_root}/usr/bin/size
326 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
327 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
328 %dir %{uclibc_root}/usr/lib
330 %{uclibc_root}/usr/lib/uclibc_nonshared.a
331 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
332 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
335 %{uclibc_root}/usr/include
338 %defattr(644,root,root,755)
339 %{uclibc_root}/usr/lib/lib*.a