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 URL: http://uclibc.org/
28 BuildRequires: binutils >= 2.16
31 BuildRequires: gcc >= 5:4.1
33 BuildRequires: gcc >= 5:3.0
35 BuildRequires: linux-libc-headers >= 7:2.6.27
36 BuildRequires: make >= 3.80
37 BuildRequires: ncurses-devel
38 BuildRequires: rpmbuild(macros) >= 1.453
39 BuildRequires: sed >= 4.0
40 BuildRequires: tar >= 1:1.22
43 %{?with_nptl:Requires: uname(version) >= 2.6}
44 # only these supported by this .spec; uClibc code supports some more
45 ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664}
46 %{?with_nptl:ExcludeArch: i386}
47 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49 %if "%{cc_version}" >= "4.2"
50 %define specflags -fgnu89-inline
53 %define filterout -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4
55 %define uclibc_root /usr/%{_target_cpu}-linux-uclibc
58 Small libc for building embedded applications.
60 %description -l pl.UTF-8
61 Mała libc do budowania aplikacji wbudowanych.
64 Summary: Development files for uClibc
65 Summary(pl.UTF-8): Pliki dla programistów uClibc
66 Group: Development/Libraries
67 Requires: %{name} = %{epoch}:%{version}-%{release}
68 Requires: linux-libc-headers >= 7:2.6.27
72 Small libc for building embedded applications.
74 %description devel -l pl.UTF-8
75 Mała libc do budowania aplikacji wbudowanych.
78 Summary: Static uClibc libraries
79 Summary(pl.UTF-8): Biblioteki statyczne uClibc
80 Group: Development/Libraries
81 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
85 Static uClibc libraries.
87 %description static -l pl.UTF-8
88 Biblioteki statyczne uClibc.
99 # ARCH is already determined by uname -m
101 defconfig=extra/Configs/defconfigs/i386/defconfig
103 echo 'CONFIG_386=y' >> $defconfig
106 echo 'CONFIG_486=y' >> $defconfig
109 echo 'CONFIG_586=y' >> $defconfig
112 echo 'CONFIG_686=y' >> $defconfig
115 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
118 echo 'CONFIG_PENTIUM4=y' >> $defconfig
121 echo 'CONFIG_K7=y' >> $defconfig
125 defconfig=extra/Configs/defconfigs/x86_64/defconfig
128 defconfig=extra/Configs/defconfigs/alpha/defconfig
130 %ifarch sparc sparcv9
131 defconfig=extra/Configs/defconfigs/sparc/defconfig
134 defconfig=extra/Configs/defconfigs/powerpc/defconfig
137 defconfig=extra/Configs/defconfigs/ia64/defconfig
140 cat <<'EOF' >> $defconfig
141 # HAS_NO_THREADS is not set
142 %{!?with_nptl:LINUXTHREADS_OLD=y}
143 %{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=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"
152 LDSO_GNU_HASH_SUPPORT=y
153 %if %{without shared}
155 # HAVE_SHARED is not set
157 UCLIBC_HAS_PRINTF_M_SPEC=y
158 UCLIBC_SUSV3_LEGACY=y
159 UCLIBC_SUSV3_LEGACY_MACROS=y
160 UCLIBC_SUSV4_LEGACY=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
169 %{?debug:SUPPORT_LD_DEBUG=y}
170 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
174 # use ld.bfd; gold doesn't work well for now
176 ln -s %{_bindir}/ld.bfd our-ld/ld
177 PATH=$(pwd)/our-ld:$PATH; export PATH
179 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
180 %{__make} -j1 defconfig \
181 %{?with_verbose:VERBOSE=1} \
182 TARGET_CPU="%{_target_cpu}" \
183 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
186 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
187 OPTIMIZATION="%{rpmcflags} -Os"
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')
196 %{?with_verbose:VERBOSE=1} \
197 TARGET_CPU="%{_target_cpu}" \
198 TARGET_ARCH=$target_arch \
199 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
202 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
203 OPTIMIZATION="%{rpmcflags} -Os"
206 rm -rf $RPM_BUILD_ROOT
207 install -d $RPM_BUILD_ROOT%{_bindir}
209 %{__make} -j1 install \
210 %{?with_verbose:VERBOSE=1} \
211 TARGET_CPU="%{_target_cpu}" \
213 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
215 OPTIMIZATION="%{rpmcflags} -Os" \
216 DESTDIR=$RPM_BUILD_ROOT
220 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
221 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
223 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
226 # these links are *needed* (by stuff in bin/)
227 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
234 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
238 mv -f $f $RPM_BUILD_ROOT%{_bindir}
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}
251 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
256 a=${l#*/%{_target_cpu}-uclibc-}
257 ln -sf %{_bindir}/$a $f
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}
275 rm -rf $RPM_BUILD_ROOT
278 %defattr(644,root,root,755)
279 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
281 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
283 %dir %{uclibc_root}/lib
284 %attr(755,root,root) %{uclibc_root}/lib/*.so*
289 %defattr(644,root,root,755)
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++
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
307 %{uclibc_root}/usr/lib/*.o
308 %dir %{uclibc_root}/usr
309 %dir %{uclibc_root}/usr/bin
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++
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
326 %dir %{uclibc_root}/usr/lib
328 %{uclibc_root}/usr/lib/uclibc_nonshared.a
329 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
330 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
333 %{uclibc_root}/usr/include
336 %defattr(644,root,root,755)
337 %{uclibc_root}/usr/lib/lib*.a