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