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