]> git.pld-linux.org Git - packages/uClibc.git/blame_incremental - uClibc.spec
- (gcc related rebuild)
[packages/uClibc.git] / uClibc.spec
... / ...
CommitLineData
1#
2# Conditional build:
3%bcond_without shared # don't build shared lib support
4%bcond_with nptl # libpthread: NPTL instead of LinuxThreads (experimental; no i386)
5%bcond_without verbose # verbose mode
6#
7%ifarch alpha
8%undefine with_shared
9%endif
10#
11Summary: C library optimized for size
12Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar
13Name: uClibc
14Version: 0.9.33.2
15Release: 15
16Epoch: 4
17License: LGPL v2.1
18Group: Libraries
19Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.xz
20# Source0-md5: 73e6fe215648d02246f4d195b25fb17e
21Patch0: %{name}-newsoname.patch
22Patch1: %{name}-toolchain-wrapper.patch
23Patch2: %{name}-targetcpu.patch
24Patch3: %{name}-debug.patch
25Patch4: %{name}-stdio-unhide.patch
26Patch5: %{name}-kernel-types.patch
27URL: http://uclibc.org/
28BuildRequires: binutils >= 2.16
29BuildRequires: cpp
30%if %{with nptl}
31BuildRequires: gcc >= 5:4.1
32%else
33BuildRequires: gcc >= 5:3.0
34%endif
35BuildRequires: linux-libc-headers >= 7:2.6.27
36BuildRequires: make >= 3.80
37BuildRequires: ncurses-devel
38BuildRequires: rpmbuild(macros) >= 1.453
39BuildRequires: sed >= 4.0
40BuildRequires: tar >= 1:1.22
41BuildRequires: which
42BuildRequires: xz
43%{?with_nptl:Requires: uname(version) >= 2.6}
44# only these supported by this .spec; uClibc code supports some more
45ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664}
46%{?with_nptl:ExcludeArch: i386}
47BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
48
49%if "%{cc_version}" >= "4.2"
50%define specflags -fgnu89-inline
51%endif
52
53%define filterout -fstack-protector --param=ssp-buffer-size=4
54
55%define uclibc_root /usr/%{_target_cpu}-linux-uclibc
56
57%description
58Small libc for building embedded applications.
59
60%description -l pl.UTF-8
61Mała libc do budowania aplikacji wbudowanych.
62
63%package devel
64Summary: Development files for uClibc
65Summary(pl.UTF-8): Pliki dla programistów uClibc
66Group: Development/Libraries
67Requires: %{name} = %{epoch}:%{version}-%{release}
68Requires: linux-libc-headers >= 7:2.6.27
69%requires_eq gcc
70
71%description devel
72Small libc for building embedded applications.
73
74%description devel -l pl.UTF-8
75Mała libc do budowania aplikacji wbudowanych.
76
77%package static
78Summary: Static uClibc libraries
79Summary(pl.UTF-8): Biblioteki statyczne uClibc
80Group: Development/Libraries
81Requires: %{name}-devel = %{epoch}:%{version}-%{release}
82Provides: libc-static
83
84%description static
85Static uClibc libraries.
86
87%description static -l pl.UTF-8
88Biblioteki statyczne uClibc.
89
90%prep
91%setup -q
92%patch0 -p1
93%patch1 -p1
94%patch2 -p1
95%patch3 -p1
96%patch4 -p1
97%patch5 -p1
98
99# ARCH is already determined by uname -m
100%ifarch %{ix86}
101defconfig=extra/Configs/defconfigs/i386/defconfig
102%ifarch i386
103echo 'CONFIG_386=y' >> $defconfig
104%endif
105%ifarch i486
106echo 'CONFIG_486=y' >> $defconfig
107%endif
108%ifarch i586
109echo 'CONFIG_586=y' >> $defconfig
110%endif
111%ifarch i686
112echo 'CONFIG_686=y' >> $defconfig
113%endif
114%ifarch pentium3
115echo 'CONFIG_PENTIUMIII=y' >> $defconfig
116%endif
117%ifarch pentium4
118echo 'CONFIG_PENTIUM4=y' >> $defconfig
119%endif
120%ifarch athlon
121echo 'CONFIG_K7=y' >> $defconfig
122%endif
123%endif
124%ifarch %{x8664}
125defconfig=extra/Configs/defconfigs/x86_64/defconfig
126%endif
127%ifarch alpha
128defconfig=extra/Configs/defconfigs/alpha/defconfig
129%endif
130%ifarch sparc sparcv9
131defconfig=extra/Configs/defconfigs/sparc/defconfig
132%endif
133%ifarch ppc
134defconfig=extra/Configs/defconfigs/powerpc/defconfig
135%endif
136%ifarch ia64
137defconfig=extra/Configs/defconfigs/ia64/defconfig
138%endif
139
140cat <<'EOF' >> $defconfig
141# HAS_NO_THREADS is not set
142%{!?with_nptl:LINUXTHREADS_OLD=y}
143%{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=y}
144UCLIBC_HAS_IPV4=y
145UCLIBC_HAS_IPV6=y
146DO_C99_MATH=y
147UCLIBC_HAS_RPC=y
148# UCLIBC_HAS_FULL_RPC is not set
149# UCLIBC_HAS_REENTRANT_RPC is not set
150UCLIBC_HAS_SYS_SIGLIST=y
151SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
152LDSO_GNU_HASH_SUPPORT=y
153%if %{without shared}
154HAVE_NO_SHARED=y
155# HAVE_SHARED is not set
156%endif
157UCLIBC_HAS_PRINTF_M_SPEC=y
158UCLIBC_SUSV3_LEGACY=y
159UCLIBC_SUSV3_LEGACY_MACROS=y
160UCLIBC_SUSV4_LEGACY=y
161UCLIBC_USE_NETLINK=y
162UCLIBC_SUPPORT_AI_ADDRCONFIG=y
163UCLIBC_HAS_RESOLVER_SUPPORT=y
164UCLIBC_HAS_LIBRESOLV_STUB=y
165UCLIBC_HAS_COMPAT_RES_STATE=y
166UCLIBC_HAS_EXTRA_COMPAT_RES_STATE=y
167# DOSTRIP is not set
168%{?debug:DODEBUG=y}
169%{?debug:SUPPORT_LD_DEBUG=y}
170%{?debug:SUPPORT_LD_DEBUG_EARLY=y}
171EOF
172
173%build
174# use ld.bfd; gold doesn't work well for now
175install -d our-ld
176ln -s %{_bindir}/ld.bfd our-ld/ld
177PATH=$(pwd)/our-ld:$PATH; export PATH
178
179# NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
180%{__make} -j1 defconfig \
181 %{?with_verbose:VERBOSE=1} \
182 TARGET_CPU="%{_target_cpu}" \
183 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
184 HOSTCC="%{__cc}" \
185 CC="%{__cc}" \
186 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
187 OPTIMIZATION="%{rpmcflags} -Os"
188
189# The Makefile includes .config and later tries to assign same variable,
190# eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
191# for UCLIBC_LDSO in extra/gcc-uClibc.
192# So we pass it as make arg to be sure it's proper!
193target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
194
195%{__make} -j1 \
196 %{?with_verbose:VERBOSE=1} \
197 TARGET_CPU="%{_target_cpu}" \
198 TARGET_ARCH=$target_arch \
199 GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
200 HOSTCC="%{__cc}" \
201 CC="%{__cc}" \
202 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
203 OPTIMIZATION="%{rpmcflags} -Os"
204
205%install
206rm -rf $RPM_BUILD_ROOT
207install -d $RPM_BUILD_ROOT%{_bindir}
208
209%{__make} -j1 install \
210 %{?with_verbose:VERBOSE=1} \
211 TARGET_CPU="%{_target_cpu}" \
212 HOSTCC="%{__cc}" \
213 HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
214 CC="%{__cc}" \
215 OPTIMIZATION="%{rpmcflags} -Os" \
216 DESTDIR=$RPM_BUILD_ROOT
217
218%if %{with shared}
219%if %{without nptl}
220mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
221ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
222%endif
223chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
224%endif
225
226# these links are *needed* (by stuff in bin/)
227for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
228 if [ -L $f ]; then
229 l=$(readlink $f)
230 a=${l##*/}
231 d=${l%/*}
232 case "$d" in
233 %{_bindir})
234 ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
235 rm -f $f
236 ;;
237 $a)
238 mv -f $f $RPM_BUILD_ROOT%{_bindir}
239 ;;
240 *)
241 exit 1
242 ;;
243 esac
244 else
245 a=${f#*/%{_target_cpu}-uclibc-}
246 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
247 mv -f $f $RPM_BUILD_ROOT%{_bindir}
248 fi
249done
250
251for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
252 if [ -L $f ]; then
253 l=$(readlink $f)
254 case "${l%/*}" in
255 %{uclibc_root}/bin)
256 a=${l#*/%{_target_cpu}-uclibc-}
257 ln -sf %{_bindir}/$a $f
258 ;;
259 %{_bindir})
260 :
261 ;;
262 *)
263 exit 2
264 ;;
265 esac
266 fi
267done
268
269# rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
270for dir in asm asm-generic linux mtd rdma sound video xen; do
271 ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
272done
273
274%clean
275rm -rf $RPM_BUILD_ROOT
276
277%files
278%defattr(644,root,root,755)
279%doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
280%dir %{uclibc_root}
281%ifarch %{ix86} %{x8664} ppc sparc sparcv9
282%if %{with shared}
283%dir %{uclibc_root}/lib
284%attr(755,root,root) %{uclibc_root}/lib/*.so*
285%endif
286%endif
287
288%files devel
289%defattr(644,root,root,755)
290%doc docs/*.txt
291%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
292%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
293%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
294%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
295%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
296%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
297%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
298%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
299%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
300%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
301%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
302%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
303%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
304%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
305%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
306%attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
307%{uclibc_root}/usr/lib/*.o
308%dir %{uclibc_root}/usr
309%dir %{uclibc_root}/usr/bin
310%attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
311%attr(755,root,root) %{uclibc_root}/usr/bin/ar
312%attr(755,root,root) %{uclibc_root}/usr/bin/as
313%attr(755,root,root) %{uclibc_root}/usr/bin/c++
314%attr(755,root,root) %{uclibc_root}/usr/bin/cc
315%attr(755,root,root) %{uclibc_root}/usr/bin/cpp
316%attr(755,root,root) %{uclibc_root}/usr/bin/g++
317%attr(755,root,root) %{uclibc_root}/usr/bin/gcc
318%attr(755,root,root) %{uclibc_root}/usr/bin/ld
319%attr(755,root,root) %{uclibc_root}/usr/bin/nm
320%attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
321%attr(755,root,root) %{uclibc_root}/usr/bin/objdump
322%attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
323%attr(755,root,root) %{uclibc_root}/usr/bin/size
324%attr(755,root,root) %{uclibc_root}/usr/bin/strings
325%attr(755,root,root) %{uclibc_root}/usr/bin/strip
326%dir %{uclibc_root}/usr/lib
327%if %{with shared}
328%{uclibc_root}/usr/lib/uclibc_nonshared.a
329%ifarch %{ix86} %{x8664} ppc sparc sparcv9
330%attr(755,root,root) %{uclibc_root}/usr/lib/*.so
331%endif
332%endif
333%{uclibc_root}/usr/include
334
335%files static
336%defattr(644,root,root,755)
337%{uclibc_root}/usr/lib/lib*.a
This page took 0.024456 seconds and 4 git commands to generate.