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: 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 uclibc_root /usr/%{_target_cpu}-linux-uclibc
55 Small libc for building embedded applications.
57 %description -l pl.UTF-8
58 Mała libc do budowania aplikacji wbudowanych.
61 Summary: Development files for uClibc
62 Summary(pl.UTF-8): Pliki dla programistów uClibc
63 Group: Development/Libraries
64 Requires: %{name} = %{epoch}:%{version}-%{release}
65 Requires: linux-libc-headers >= 7:2.6.27
69 Small libc for building embedded applications.
71 %description devel -l pl.UTF-8
72 Mała libc do budowania aplikacji wbudowanych.
75 Summary: Static uClibc libraries
76 Summary(pl.UTF-8): Biblioteki statyczne uClibc
77 Group: Development/Libraries
78 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
82 Static uClibc libraries.
84 %description static -l pl.UTF-8
85 Biblioteki statyczne uClibc.
95 # ARCH is already determined by uname -m
97 defconfig=extra/Configs/defconfigs/i386/defconfig
99 echo 'CONFIG_386=y' >> $defconfig
102 echo 'CONFIG_486=y' >> $defconfig
105 echo 'CONFIG_586=y' >> $defconfig
108 echo 'CONFIG_686=y' >> $defconfig
111 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
114 echo 'CONFIG_PENTIUM4=y' >> $defconfig
117 echo 'CONFIG_K7=y' >> $defconfig
121 defconfig=extra/Configs/defconfigs/x86_64/defconfig
124 defconfig=extra/Configs/defconfigs/alpha/defconfig
126 %ifarch sparc sparcv9
127 defconfig=extra/Configs/defconfigs/sparc/defconfig
130 defconfig=extra/Configs/defconfigs/powerpc/defconfig
133 defconfig=extra/Configs/defconfigs/ia64/defconfig
136 cat <<'EOF' >> $defconfig
137 # HAS_NO_THREADS is not set
138 %{!?with_nptl:LINUXTHREADS_OLD=y}
139 %{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=y}
143 # UCLIBC_HAS_FULL_RPC is not set
144 # UCLIBC_HAS_REENTRANT_RPC is not set
145 UCLIBC_HAS_SYS_SIGLIST=y
146 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
147 LDSO_GNU_HASH_SUPPORT=y
148 %if %{without shared}
150 # HAVE_SHARED is not set
152 UCLIBC_HAS_PRINTF_M_SPEC=y
153 UCLIBC_SUSV3_LEGACY=y
154 UCLIBC_SUSV3_LEGACY_MACROS=y
157 %{?debug:SUPPORT_LD_DEBUG=y}
158 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
162 # use ld.bfd; gold doesn't work well for now
164 ln -s %{_bindir}/ld.bfd our-ld/ld
165 PATH=$(pwd)/our-ld:$PATH; export PATH
167 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
168 %{__make} -j1 defconfig \
169 %{?with_verbose:VERBOSE=1} \
170 TARGET_CPU="%{_target_cpu}" \
171 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
174 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
175 OPTIMIZATION="%{rpmcflags} -Os"
177 # The Makefile includes .config and later tries to assign same variable,
178 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
179 # for UCLIBC_LDSO in extra/gcc-uClibc.
180 # So we pass it as make arg to be sure it's proper!
181 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
184 %{?with_verbose:VERBOSE=1} \
185 TARGET_CPU="%{_target_cpu}" \
186 TARGET_ARCH=$target_arch \
187 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
190 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
191 OPTIMIZATION="%{rpmcflags} -Os"
194 rm -rf $RPM_BUILD_ROOT
195 install -d $RPM_BUILD_ROOT%{_bindir}
197 %{__make} -j1 install \
198 %{?with_verbose:VERBOSE=1} \
199 TARGET_CPU="%{_target_cpu}" \
201 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
203 OPTIMIZATION="%{rpmcflags} -Os" \
204 DESTDIR=$RPM_BUILD_ROOT
208 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
209 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
211 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
214 # these links are *needed* (by stuff in bin/)
215 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
222 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
226 mv -f $f $RPM_BUILD_ROOT%{_bindir}
233 a=${f#*/%{_target_cpu}-uclibc-}
234 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
235 mv -f $f $RPM_BUILD_ROOT%{_bindir}
239 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
244 a=${l#*/%{_target_cpu}-uclibc-}
245 ln -sf %{_bindir}/$a $f
257 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
258 for dir in asm asm-generic linux mtd rdma sound video xen; do
259 ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
263 rm -rf $RPM_BUILD_ROOT
266 %defattr(644,root,root,755)
267 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
269 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
271 %dir %{uclibc_root}/lib
272 %attr(755,root,root) %{uclibc_root}/lib/*.so*
277 %defattr(644,root,root,755)
279 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
280 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
281 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
282 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
283 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
284 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
285 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
286 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
287 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
288 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
289 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
290 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
291 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
292 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
293 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
294 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
295 %{uclibc_root}/usr/lib/*.o
296 %dir %{uclibc_root}/usr
297 %dir %{uclibc_root}/usr/bin
298 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
299 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
300 %attr(755,root,root) %{uclibc_root}/usr/bin/as
301 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
302 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
303 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
304 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
305 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
306 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
307 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
308 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
309 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
310 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
311 %attr(755,root,root) %{uclibc_root}/usr/bin/size
312 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
313 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
314 %dir %{uclibc_root}/usr/lib
316 %{uclibc_root}/usr/lib/uclibc_nonshared.a
317 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
318 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
321 %{uclibc_root}/usr/include
324 %defattr(644,root,root,755)
325 %{uclibc_root}/usr/lib/lib*.a