3 # - add filtering out -Wl,-z,-combreloc in gcc wrapper
4 # (causes linking to be done against glibc instead of uclibc)
7 %bcond_without shared # don't build shared lib support
8 %bcond_with verbose # verbose mode
14 Summary: C library optimized for size
15 Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar
22 Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.bz2
23 # Source0-md5: 61dc55f43b17a38a074f347e74095b20
24 Patch0: %{name}-newsoname.patch
25 Patch1: %{name}-toolchain-wrapper.patch
26 Patch2: %{name}-targetcpu.patch
27 Patch3: %{name}-debug.patch
28 Patch4: %{name}-stdio-unhide.patch
29 Patch5: %{name}-sparc.patch
30 URL: http://uclibc.org/
31 BuildRequires: binutils-gasp
33 BuildRequires: gcc >= 5:3.0
34 BuildRequires: linux-libc-headers >= 7:2.6.24
35 BuildRequires: sed >= 4.0
37 ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664}
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
40 %define specflags -fgnu89-inline
42 %define uclibc_root /usr/%{_target_cpu}-linux-uclibc
45 Small libc for building embedded applications.
47 %description -l pl.UTF-8
48 Mała libc do budowania aplikacji wbudowanych.
51 Summary: Development files for uClibc
52 Summary(pl.UTF-8): Pliki dla programistów uClibc
53 Group: Development/Libraries
54 Requires: %{name} = %{epoch}:%{version}-%{release}
56 Requires: linux-libc-headers >= 7:2.6.24
60 Small libc for building embedded applications.
62 %description devel -l pl.UTF-8
63 Mała libc do budowania aplikacji wbudowanych.
66 Summary: Static uClibc libraries
67 Summary(pl.UTF-8): Biblioteki statyczne uClibc
68 Group: Development/Libraries
69 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
73 Static uClibc libraries.
75 %description static -l pl.UTF-8
76 Biblioteki statyczne uClibc.
85 # check if it's needed now... ldso is broken on sparc anyway
88 # ARCH is already determined by uname -m
90 defconfig=extra/Configs/defconfigs/i386
92 echo 'CONFIG_386=y' >> $defconfig
95 echo 'CONFIG_486=y' >> $defconfig
98 echo 'CONFIG_586=y' >> $defconfig
101 echo 'CONFIG_686=y' >> $defconfig
104 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
107 echo 'CONFIG_PENTIUM4=y' >> $defconfig
110 echo 'CONFIG_K7=y' >> $defconfig
114 defconfig=extra/Configs/defconfigs/x86_64
117 defconfig=extra/Configs/defconfigs/alpha
119 %ifarch sparc sparcv9
120 defconfig=extra/Configs/defconfigs/sparc
123 defconfig=extra/Configs/defconfigs/powerpc
126 defconfig=extra/Configs/defconfigs/ia64
129 cat <<'EOF' >> $defconfig
133 # UCLIBC_HAS_FULL_RPC is not set
134 # UCLIBC_HAS_REENTRANT_RPC is not set
135 UCLIBC_HAS_SYS_SIGLIST=y
136 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
137 %if %{without shared}
139 # HAVE_SHARED is not set
141 UCLIBC_HAS_PRINTF_M_SPEC=y
142 UCLIBC_SUSV3_LEGACY=y
143 UCLIBC_SUSV3_LEGACY_MACROS=y
146 %{?debug:SUPPORT_LD_DEBUG=y}
147 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
152 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
153 %{__make} defconfig \
154 %{?with_verbose:VERBOSE=1} \
155 TARGET_CPU="%{_target_cpu}" \
156 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
158 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
160 OPTIMIZATION="%{rpmcflags} -Os"
162 # The Makefile includes .config and later tries to assign same variable,
163 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
164 # for UCLIBC_LDSO in extra/gcc-uClibc.
165 # So we pass it as make arg to be sure it's proper!
166 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
169 %{?with_verbose:VERBOSE=1} \
170 TARGET_CPU="%{_target_cpu}" \
171 TARGET_ARCH=$target_arch \
172 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
174 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
176 OPTIMIZATION="%{rpmcflags} -Os"
179 rm -rf $RPM_BUILD_ROOT
180 install -d $RPM_BUILD_ROOT%{_bindir}
182 %{__make} -j1 install \
183 %{?with_verbose:VERBOSE=1} \
184 TARGET_CPU="%{_target_cpu}" \
186 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
188 OPTIMIZATION="%{rpmcflags} -Os" \
189 DESTDIR=$RPM_BUILD_ROOT
192 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
193 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
194 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
197 # these links are *needed* (by stuff in bin/)
198 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
205 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
209 mv -f $f $RPM_BUILD_ROOT%{_bindir}
216 a=${f#*/%{_target_cpu}-uclibc-}
217 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
218 mv -f $f $RPM_BUILD_ROOT%{_bindir}
222 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
227 a=${l#*/%{_target_cpu}-uclibc-}
228 ln -sf %{_bindir}/$a $f
240 rm -rf $RPM_BUILD_ROOT%{uclibc_root}/usr/include/{linux,asm*}
241 ln -sf /usr/include/asm $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm
242 ln -sf /usr/include/asm-generic $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-generic
245 ln -sf /usr/include/asm-sparc $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc
246 ln -sf /usr/include/asm-sparc64 $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc64
248 ln -sf /usr/include/linux $RPM_BUILD_ROOT%{uclibc_root}/usr/include/linux
251 rm -rf $RPM_BUILD_ROOT
254 %defattr(644,root,root,755)
255 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
257 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
259 %dir %{uclibc_root}/lib
260 %attr(755,root,root) %{uclibc_root}/lib/*.so*
265 %defattr(644,root,root,755)
267 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
268 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
269 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
270 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
271 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
272 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
273 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
274 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gasp
275 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
276 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
277 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
278 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
279 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
280 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
281 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
282 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
283 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
284 %{uclibc_root}/usr/lib/*.o
285 %dir %{uclibc_root}/usr
286 %dir %{uclibc_root}/usr/bin
287 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
288 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
289 %attr(755,root,root) %{uclibc_root}/usr/bin/as
290 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
291 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
292 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
293 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
294 %attr(755,root,root) %{uclibc_root}/usr/bin/gasp
295 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
296 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
297 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
298 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
299 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
300 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
301 %attr(755,root,root) %{uclibc_root}/usr/bin/size
302 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
303 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
304 %dir %{uclibc_root}/usr/lib
306 %{uclibc_root}/usr/lib/uclibc_nonshared.a
307 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
308 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
311 %{uclibc_root}/usr/include
314 %defattr(644,root,root,755)
315 %{uclibc_root}/usr/lib/lib*.a