3 # - add filtering out -Wl,-z,-combreloc in gcc wrapper
4 # (causes linking to be done against glibc instead of uclibc)
5 # - 0.9.30 is broken. First build it and then try to build
6 # lvm2.spec on i686 (or any *.c program like printf("test")).
7 # Fails with: symbol '_stdio_openlist_use_count': can't resolve symbol ...
10 %bcond_without shared # don't build shared lib support
11 %bcond_with verbose # verbose mode
17 Summary: C library optimized for size
18 Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar
25 Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.bz2
26 # Source0-md5: e5766e2566e0297adebebbcc0aba1f2d
27 Patch0: %{name}-newsoname.patch
28 Patch1: %{name}-toolchain-wrapper.patch
29 Patch2: %{name}-targetcpu.patch
30 Patch3: %{name}-debug.patch
31 Patch4: %{name}-stdio-unhide.patch
32 Patch5: %{name}-sparc.patch
33 Patch6: %{name}-headers.patch
34 URL: http://uclibc.org/
35 BuildRequires: binutils-gasp
37 BuildRequires: gcc >= 5:3.0
38 BuildRequires: linux-libc-headers >= 7:2.6.24
39 BuildRequires: sed >= 4.0
41 ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664}
42 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
44 %define specflags -fgnu89-inline
46 %define uclibc_root /usr/%{_target_cpu}-linux-uclibc
49 Small libc for building embedded applications.
51 %description -l pl.UTF-8
52 Mała libc do budowania aplikacji wbudowanych.
55 Summary: Development files for uClibc
56 Summary(pl.UTF-8): Pliki dla programistów uClibc
57 Group: Development/Libraries
58 Requires: %{name} = %{epoch}:%{version}-%{release}
59 Requires: binutils-gasp
60 Requires: linux-libc-headers >= 7:2.6.24
64 Small libc for building embedded applications.
66 %description devel -l pl.UTF-8
67 Mała libc do budowania aplikacji wbudowanych.
70 Summary: Static uClibc libraries
71 Summary(pl.UTF-8): Biblioteki statyczne uClibc
72 Group: Development/Libraries
73 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
77 Static uClibc libraries.
79 %description static -l pl.UTF-8
80 Biblioteki statyczne uClibc.
89 # check if it's needed now... ldso is broken on sparc anyway
93 # ARCH is already determined by uname -m
95 defconfig=extra/Configs/defconfigs/i386
97 echo 'CONFIG_386=y' >> $defconfig
100 echo 'CONFIG_486=y' >> $defconfig
103 echo 'CONFIG_586=y' >> $defconfig
106 echo 'CONFIG_686=y' >> $defconfig
109 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
112 echo 'CONFIG_PENTIUM4=y' >> $defconfig
115 echo 'CONFIG_K7=y' >> $defconfig
119 defconfig=extra/Configs/defconfigs/x86_64
122 defconfig=extra/Configs/defconfigs/alpha
124 %ifarch sparc sparcv9
125 defconfig=extra/Configs/defconfigs/sparc
128 defconfig=extra/Configs/defconfigs/powerpc
131 defconfig=extra/Configs/defconfigs/ia64
134 cat <<'EOF' >> $defconfig
138 # UCLIBC_HAS_FULL_RPC is not set
139 # UCLIBC_HAS_REENTRANT_RPC is not set
140 UCLIBC_HAS_SYS_SIGLIST=y
141 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
142 %if %{without shared}
144 # HAVE_SHARED is not set
146 UCLIBC_HAS_PRINTF_M_SPEC=y
147 UCLIBC_SUSV3_LEGACY=y
148 UCLIBC_SUSV3_LEGACY_MACROS=y
151 %{?debug:SUPPORT_LD_DEBUG=y}
152 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
157 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
158 %{__make} -j1 defconfig \
159 %{?with_verbose:VERBOSE=1} \
160 TARGET_CPU="%{_target_cpu}" \
161 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
163 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
165 OPTIMIZATION="%{rpmcflags} -Os"
167 # The Makefile includes .config and later tries to assign same variable,
168 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
169 # for UCLIBC_LDSO in extra/gcc-uClibc.
170 # So we pass it as make arg to be sure it's proper!
171 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
174 %{?with_verbose:VERBOSE=1} \
175 TARGET_CPU="%{_target_cpu}" \
176 TARGET_ARCH=$target_arch \
177 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
179 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
181 OPTIMIZATION="%{rpmcflags} -Os"
184 rm -rf $RPM_BUILD_ROOT
185 install -d $RPM_BUILD_ROOT%{_bindir}
187 %{__make} -j1 install \
188 %{?with_verbose:VERBOSE=1} \
189 TARGET_CPU="%{_target_cpu}" \
191 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
193 OPTIMIZATION="%{rpmcflags} -Os" \
194 DESTDIR=$RPM_BUILD_ROOT
197 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
198 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
199 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
202 # these links are *needed* (by stuff in bin/)
203 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
210 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
214 mv -f $f $RPM_BUILD_ROOT%{_bindir}
221 a=${f#*/%{_target_cpu}-uclibc-}
222 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
223 mv -f $f $RPM_BUILD_ROOT%{_bindir}
227 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
232 a=${l#*/%{_target_cpu}-uclibc-}
233 ln -sf %{_bindir}/$a $f
245 rm -rf $RPM_BUILD_ROOT%{uclibc_root}/usr/include/{linux,asm*}
246 ln -sf /usr/include/asm $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm
247 ln -sf /usr/include/asm-generic $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-generic
250 ln -sf /usr/include/asm-sparc $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc
251 ln -sf /usr/include/asm-sparc64 $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc64
253 ln -sf /usr/include/linux $RPM_BUILD_ROOT%{uclibc_root}/usr/include/linux
256 rm -rf $RPM_BUILD_ROOT
259 %defattr(644,root,root,755)
260 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
262 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
264 %dir %{uclibc_root}/lib
265 %attr(755,root,root) %{uclibc_root}/lib/*.so*
270 %defattr(644,root,root,755)
272 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
273 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
274 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
275 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
276 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
277 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
278 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
279 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gasp
280 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
281 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
282 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
283 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
284 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
285 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
286 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
287 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
288 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
289 %{uclibc_root}/usr/lib/*.o
290 %dir %{uclibc_root}/usr
291 %dir %{uclibc_root}/usr/bin
292 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
293 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
294 %attr(755,root,root) %{uclibc_root}/usr/bin/as
295 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
296 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
297 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
298 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
299 %attr(755,root,root) %{uclibc_root}/usr/bin/gasp
300 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
301 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
302 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
303 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
304 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
305 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
306 %attr(755,root,root) %{uclibc_root}/usr/bin/size
307 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
308 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
309 %dir %{uclibc_root}/usr/lib
311 %{uclibc_root}/usr/lib/uclibc_nonshared.a
312 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
313 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
316 %{uclibc_root}/usr/include
319 %defattr(644,root,root,755)
320 %{uclibc_root}/usr/lib/lib*.a