3 %bcond_without shared # don't build shared lib support
4 %bcond_with verbose # verbose mode
10 Summary: C library optimized for size
11 Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar
18 Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.bz2
19 # Source0-md5: 1a4b84e5536ad8170563ffa88c34679c
20 Patch0: %{name}-newsoname.patch
21 Patch1: %{name}-toolchain-wrapper.patch
22 Patch2: %{name}-targetcpu.patch
23 Patch3: %{name}-debug.patch
24 Patch4: %{name}-stdio-unhide.patch
25 Patch5: %{name}-sparc.patch
26 Patch6: %{name}-ppoll.patch
27 Patch7: %{name}-ldouble_wrappers.patch
28 Patch8: %{name}-getline.patch
29 URL: http://uclibc.org/
30 BuildRequires: binutils-gasp
32 BuildRequires: gcc >= 5:3.0
33 BuildRequires: linux-libc-headers >= 7:2.6.24
34 BuildRequires: ncurses-devel
35 BuildRequires: rpmbuild(macros) >= 1.453
36 BuildRequires: sed >= 4.0
38 ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664}
39 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 %if "%{cc_version}" >= "4.2"
42 %define specflags -fgnu89-inline
45 %define uclibc_root /usr/%{_target_cpu}-linux-uclibc
48 Small libc for building embedded applications.
50 %description -l pl.UTF-8
51 Mała libc do budowania aplikacji wbudowanych.
54 Summary: Development files for uClibc
55 Summary(pl.UTF-8): Pliki dla programistów uClibc
56 Group: Development/Libraries
57 Requires: %{name} = %{epoch}:%{version}-%{release}
58 Requires: binutils-gasp
59 Requires: linux-libc-headers >= 7:2.6.24
63 Small libc for building embedded applications.
65 %description devel -l pl.UTF-8
66 Mała libc do budowania aplikacji wbudowanych.
69 Summary: Static uClibc libraries
70 Summary(pl.UTF-8): Biblioteki statyczne uClibc
71 Group: Development/Libraries
72 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
76 Static uClibc libraries.
78 %description static -l pl.UTF-8
79 Biblioteki statyczne uClibc.
88 # check if it's needed now... ldso is broken on sparc anyway
94 # ARCH is already determined by uname -m
96 defconfig=extra/Configs/defconfigs/i386
98 echo 'CONFIG_386=y' >> $defconfig
101 echo 'CONFIG_486=y' >> $defconfig
104 echo 'CONFIG_586=y' >> $defconfig
107 echo 'CONFIG_686=y' >> $defconfig
110 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
113 echo 'CONFIG_PENTIUM4=y' >> $defconfig
116 echo 'CONFIG_K7=y' >> $defconfig
120 defconfig=extra/Configs/defconfigs/x86_64
123 defconfig=extra/Configs/defconfigs/alpha
125 %ifarch sparc sparcv9
126 defconfig=extra/Configs/defconfigs/sparc
129 defconfig=extra/Configs/defconfigs/powerpc
132 defconfig=extra/Configs/defconfigs/ia64
135 cat <<'EOF' >> $defconfig
139 # UCLIBC_HAS_FULL_RPC is not set
140 # UCLIBC_HAS_REENTRANT_RPC is not set
141 UCLIBC_HAS_SYS_SIGLIST=y
142 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
143 LDSO_GNU_HASH_SUPPORT=y
144 %if %{without shared}
146 # HAVE_SHARED is not set
148 UCLIBC_HAS_PRINTF_M_SPEC=y
149 UCLIBC_SUSV3_LEGACY=y
150 UCLIBC_SUSV3_LEGACY_MACROS=y
153 %{?debug:SUPPORT_LD_DEBUG=y}
154 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
159 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
160 %{__make} -j1 defconfig \
161 %{?with_verbose:VERBOSE=1} \
162 TARGET_CPU="%{_target_cpu}" \
163 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
166 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
167 OPTIMIZATION="%{rpmcflags} -Os"
169 # The Makefile includes .config and later tries to assign same variable,
170 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
171 # for UCLIBC_LDSO in extra/gcc-uClibc.
172 # So we pass it as make arg to be sure it's proper!
173 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
176 %{?with_verbose:VERBOSE=1} \
177 TARGET_CPU="%{_target_cpu}" \
178 TARGET_ARCH=$target_arch \
179 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
182 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
183 OPTIMIZATION="%{rpmcflags} -Os"
186 rm -rf $RPM_BUILD_ROOT
187 install -d $RPM_BUILD_ROOT%{_bindir}
189 %{__make} -j1 install \
190 %{?with_verbose:VERBOSE=1} \
191 TARGET_CPU="%{_target_cpu}" \
193 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
195 OPTIMIZATION="%{rpmcflags} -Os" \
196 DESTDIR=$RPM_BUILD_ROOT
199 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
200 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
201 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
204 # these links are *needed* (by stuff in bin/)
205 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
212 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
216 mv -f $f $RPM_BUILD_ROOT%{_bindir}
223 a=${f#*/%{_target_cpu}-uclibc-}
224 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
225 mv -f $f $RPM_BUILD_ROOT%{_bindir}
229 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
234 a=${l#*/%{_target_cpu}-uclibc-}
235 ln -sf %{_bindir}/$a $f
247 rm -rf $RPM_BUILD_ROOT%{uclibc_root}/usr/include/{linux,asm*}
248 ln -sf /usr/include/asm $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm
249 ln -sf /usr/include/asm-generic $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-generic
252 ln -sf /usr/include/asm-sparc $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc
253 ln -sf /usr/include/asm-sparc64 $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc64
255 ln -sf /usr/include/linux $RPM_BUILD_ROOT%{uclibc_root}/usr/include/linux
258 rm -rf $RPM_BUILD_ROOT
261 %defattr(644,root,root,755)
262 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
264 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
266 %dir %{uclibc_root}/lib
267 %attr(755,root,root) %{uclibc_root}/lib/*.so*
272 %defattr(644,root,root,755)
274 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
275 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
276 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
277 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
278 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
279 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
280 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
281 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gasp
282 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
283 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
284 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
285 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
286 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
287 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
288 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
289 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
290 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
291 %{uclibc_root}/usr/lib/*.o
292 %dir %{uclibc_root}/usr
293 %dir %{uclibc_root}/usr/bin
294 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
295 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
296 %attr(755,root,root) %{uclibc_root}/usr/bin/as
297 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
298 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
299 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
300 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
301 %attr(755,root,root) %{uclibc_root}/usr/bin/gasp
302 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
303 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
304 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
305 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
306 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
307 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
308 %attr(755,root,root) %{uclibc_root}/usr/bin/size
309 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
310 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
311 %dir %{uclibc_root}/usr/lib
313 %{uclibc_root}/usr/lib/uclibc_nonshared.a
314 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
315 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
318 %{uclibc_root}/usr/include
321 %defattr(644,root,root,755)
322 %{uclibc_root}/usr/lib/lib*.a