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