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 URL: http://uclibc.org/
27 BuildRequires: binutils >= 2.16
30 BuildRequires: gcc >= 5:4.1
32 BuildRequires: gcc >= 5:3.0
34 BuildRequires: linux-libc-headers >= 7:2.6.27
35 BuildRequires: make >= 3.80
36 BuildRequires: ncurses-devel
37 BuildRequires: rpmbuild(macros) >= 1.453
38 BuildRequires: sed >= 4.0
39 BuildRequires: tar >= 1:1.22
42 %{?with_nptl:Requires: uname(version) >= 2.6}
43 # only these supported by this .spec; uClibc code supports some more
44 ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664}
45 %{?with_nptl:ExcludeArch: i386}
46 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
48 %if "%{cc_version}" >= "4.2"
49 %define specflags -fgnu89-inline
52 %define filterout -fstack-protector --param=ssp-buffer-size=4
54 %define uclibc_root /usr/%{_target_cpu}-linux-uclibc
57 Small libc for building embedded applications.
59 %description -l pl.UTF-8
60 Mała libc do budowania aplikacji wbudowanych.
63 Summary: Development files for uClibc
64 Summary(pl.UTF-8): Pliki dla programistów uClibc
65 Group: Development/Libraries
66 Requires: %{name} = %{epoch}:%{version}-%{release}
67 Requires: linux-libc-headers >= 7:2.6.27
71 Small libc for building embedded applications.
73 %description devel -l pl.UTF-8
74 Mała libc do budowania aplikacji wbudowanych.
77 Summary: Static uClibc libraries
78 Summary(pl.UTF-8): Biblioteki statyczne uClibc
79 Group: Development/Libraries
80 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
84 Static uClibc libraries.
86 %description static -l pl.UTF-8
87 Biblioteki statyczne uClibc.
97 # ARCH is already determined by uname -m
99 defconfig=extra/Configs/defconfigs/i386/defconfig
101 echo 'CONFIG_386=y' >> $defconfig
104 echo 'CONFIG_486=y' >> $defconfig
107 echo 'CONFIG_586=y' >> $defconfig
110 echo 'CONFIG_686=y' >> $defconfig
113 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
116 echo 'CONFIG_PENTIUM4=y' >> $defconfig
119 echo 'CONFIG_K7=y' >> $defconfig
123 defconfig=extra/Configs/defconfigs/x86_64/defconfig
126 defconfig=extra/Configs/defconfigs/alpha/defconfig
128 %ifarch sparc sparcv9
129 defconfig=extra/Configs/defconfigs/sparc/defconfig
132 defconfig=extra/Configs/defconfigs/powerpc/defconfig
135 defconfig=extra/Configs/defconfigs/ia64/defconfig
138 cat <<'EOF' >> $defconfig
139 # HAS_NO_THREADS is not set
140 %{!?with_nptl:LINUXTHREADS_OLD=y}
141 %{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=y}
146 # UCLIBC_HAS_FULL_RPC is not set
147 # UCLIBC_HAS_REENTRANT_RPC is not set
148 UCLIBC_HAS_SYS_SIGLIST=y
149 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
150 LDSO_GNU_HASH_SUPPORT=y
151 %if %{without shared}
153 # HAVE_SHARED is not set
155 UCLIBC_HAS_PRINTF_M_SPEC=y
156 UCLIBC_SUSV3_LEGACY=y
157 UCLIBC_SUSV3_LEGACY_MACROS=y
158 UCLIBC_SUSV4_LEGACY=y
160 UCLIBC_SUPPORT_AI_ADDRCONFIG=y
161 UCLIBC_HAS_RESOLVER_SUPPORT=y
162 UCLIBC_HAS_LIBRESOLV_STUB=y
163 UCLIBC_HAS_COMPAT_RES_STATE=y
164 UCLIBC_HAS_EXTRA_COMPAT_RES_STATE=y
167 %{?debug:SUPPORT_LD_DEBUG=y}
168 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
172 # use ld.bfd; gold doesn't work well for now
174 ln -s %{_bindir}/ld.bfd our-ld/ld
175 PATH=$(pwd)/our-ld:$PATH; export PATH
177 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
178 %{__make} -j1 defconfig \
179 %{?with_verbose:VERBOSE=1} \
180 TARGET_CPU="%{_target_cpu}" \
181 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
184 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
185 OPTIMIZATION="%{rpmcflags} -Os"
187 # The Makefile includes .config and later tries to assign same variable,
188 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
189 # for UCLIBC_LDSO in extra/gcc-uClibc.
190 # So we pass it as make arg to be sure it's proper!
191 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
194 %{?with_verbose:VERBOSE=1} \
195 TARGET_CPU="%{_target_cpu}" \
196 TARGET_ARCH=$target_arch \
197 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
200 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
201 OPTIMIZATION="%{rpmcflags} -Os"
204 rm -rf $RPM_BUILD_ROOT
205 install -d $RPM_BUILD_ROOT%{_bindir}
207 %{__make} -j1 install \
208 %{?with_verbose:VERBOSE=1} \
209 TARGET_CPU="%{_target_cpu}" \
211 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
213 OPTIMIZATION="%{rpmcflags} -Os" \
214 DESTDIR=$RPM_BUILD_ROOT
218 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
219 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
221 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
224 # these links are *needed* (by stuff in bin/)
225 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
232 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
236 mv -f $f $RPM_BUILD_ROOT%{_bindir}
243 a=${f#*/%{_target_cpu}-uclibc-}
244 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
245 mv -f $f $RPM_BUILD_ROOT%{_bindir}
249 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
254 a=${l#*/%{_target_cpu}-uclibc-}
255 ln -sf %{_bindir}/$a $f
267 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
268 for dir in asm asm-generic linux mtd rdma sound video xen; do
269 ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
273 rm -rf $RPM_BUILD_ROOT
276 %defattr(644,root,root,755)
277 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
279 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
281 %dir %{uclibc_root}/lib
282 %attr(755,root,root) %{uclibc_root}/lib/*.so*
287 %defattr(644,root,root,755)
289 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
290 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
291 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
292 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
293 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
294 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
295 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
296 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
297 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
298 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
299 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
300 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
301 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
302 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
303 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
304 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
305 %{uclibc_root}/usr/lib/*.o
306 %dir %{uclibc_root}/usr
307 %dir %{uclibc_root}/usr/bin
308 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
309 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
310 %attr(755,root,root) %{uclibc_root}/usr/bin/as
311 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
312 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
313 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
314 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
315 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
316 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
317 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
318 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
319 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
320 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
321 %attr(755,root,root) %{uclibc_root}/usr/bin/size
322 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
323 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
324 %dir %{uclibc_root}/usr/lib
326 %{uclibc_root}/usr/lib/uclibc_nonshared.a
327 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
328 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
331 %{uclibc_root}/usr/include
334 %defattr(644,root,root,755)
335 %{uclibc_root}/usr/lib/lib*.a