3 %bcond_without shared # don't build shared lib support
4 %bcond_with nptl # libpthread: NPTL instead of LinuxThreads (experimental; no i386)
5 %bcond_with 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: 51660b93b8f1edb486049981fecfd148
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}-epoll.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 uclibc_root /usr/%{_target_cpu}-linux-uclibc
56 Small libc for building embedded applications.
58 %description -l pl.UTF-8
59 Mała libc do budowania aplikacji wbudowanych.
62 Summary: Development files for uClibc
63 Summary(pl.UTF-8): Pliki dla programistów uClibc
64 Group: Development/Libraries
65 Requires: %{name} = %{epoch}:%{version}-%{release}
66 Requires: linux-libc-headers >= 7:2.6.27
70 Small libc for building embedded applications.
72 %description devel -l pl.UTF-8
73 Mała libc do budowania aplikacji wbudowanych.
76 Summary: Static uClibc libraries
77 Summary(pl.UTF-8): Biblioteki statyczne uClibc
78 Group: Development/Libraries
79 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
83 Static uClibc libraries.
85 %description static -l pl.UTF-8
86 Biblioteki statyczne uClibc.
97 # ARCH is already determined by uname -m
99 defconfig=extra/Configs/defconfigs/i386
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
126 defconfig=extra/Configs/defconfigs/alpha
128 %ifarch sparc sparcv9
129 defconfig=extra/Configs/defconfigs/sparc
132 defconfig=extra/Configs/defconfigs/powerpc
135 defconfig=extra/Configs/defconfigs/ia64
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}
145 # UCLIBC_HAS_FULL_RPC is not set
146 # UCLIBC_HAS_REENTRANT_RPC is not set
147 UCLIBC_HAS_SYS_SIGLIST=y
148 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
149 LDSO_GNU_HASH_SUPPORT=y
150 %if %{without shared}
152 # HAVE_SHARED is not set
154 UCLIBC_HAS_PRINTF_M_SPEC=y
155 UCLIBC_SUSV3_LEGACY=y
156 UCLIBC_SUSV3_LEGACY_MACROS=y
159 %{?debug:SUPPORT_LD_DEBUG=y}
160 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
164 # use ld.bfd; gold doesn't work well for now
166 ln -s %{_bindir}/ld.bfd our-ld/ld
167 PATH=$(pwd)/our-ld:$PATH; export PATH
169 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
170 %{__make} -j1 defconfig \
171 %{?with_verbose:VERBOSE=1} \
172 TARGET_CPU="%{_target_cpu}" \
173 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
176 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
177 OPTIMIZATION="%{rpmcflags} -Os"
179 # The Makefile includes .config and later tries to assign same variable,
180 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
181 # for UCLIBC_LDSO in extra/gcc-uClibc.
182 # So we pass it as make arg to be sure it's proper!
183 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
186 %{?with_verbose:VERBOSE=1} \
187 TARGET_CPU="%{_target_cpu}" \
188 TARGET_ARCH=$target_arch \
189 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
192 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
193 OPTIMIZATION="%{rpmcflags} -Os"
196 rm -rf $RPM_BUILD_ROOT
197 install -d $RPM_BUILD_ROOT%{_bindir}
199 %{__make} -j1 install \
200 %{?with_verbose:VERBOSE=1} \
201 TARGET_CPU="%{_target_cpu}" \
203 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
205 OPTIMIZATION="%{rpmcflags} -Os" \
206 DESTDIR=$RPM_BUILD_ROOT
210 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
211 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
213 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
216 # these links are *needed* (by stuff in bin/)
217 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
224 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
228 mv -f $f $RPM_BUILD_ROOT%{_bindir}
235 a=${f#*/%{_target_cpu}-uclibc-}
236 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
237 mv -f $f $RPM_BUILD_ROOT%{_bindir}
241 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
246 a=${l#*/%{_target_cpu}-uclibc-}
247 ln -sf %{_bindir}/$a $f
259 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
260 for dir in asm asm-generic linux mtd rdma sound video xen; do
261 ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
265 rm -rf $RPM_BUILD_ROOT
268 %defattr(644,root,root,755)
269 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
271 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
273 %dir %{uclibc_root}/lib
274 %attr(755,root,root) %{uclibc_root}/lib/*.so*
279 %defattr(644,root,root,755)
281 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
282 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
283 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
284 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
285 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
286 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
287 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
288 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
289 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
290 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
291 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
292 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
293 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
294 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
295 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
296 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
297 %{uclibc_root}/usr/lib/*.o
298 %dir %{uclibc_root}/usr
299 %dir %{uclibc_root}/usr/bin
300 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
301 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
302 %attr(755,root,root) %{uclibc_root}/usr/bin/as
303 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
304 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
305 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
306 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
307 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
308 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
309 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
310 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
311 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
312 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
313 %attr(755,root,root) %{uclibc_root}/usr/bin/size
314 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
315 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
316 %dir %{uclibc_root}/usr/lib
318 %{uclibc_root}/usr/lib/uclibc_nonshared.a
319 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
320 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
323 %{uclibc_root}/usr/include
326 %defattr(644,root,root,755)
327 %{uclibc_root}/usr/lib/lib*.a