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