]> git.pld-linux.org Git - packages/uClibc.git/blob - uClibc.spec
- release 4
[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:        4
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 # use ld.bfd; gold doesn't work well for now
165 install -d our-ld
166 ln -s %{_bindir}/ld.bfd our-ld/ld
167 PATH=$(pwd)/our-ld:$PATH; export PATH
168
169 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
170 %{__make} -j1 defconfig \
171         %{?with_verbose:VERBOSE=1} \
172         TARGET_CPU="%{_target_cpu}" \
173         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
174         HOSTCC="%{__cc}" \
175         CC="%{__cc}" \
176         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
177         OPTIMIZATION="%{rpmcflags} -Os"
178
179 # The Makefile includes .config and later tries to assign same variable,
180 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
181 # for UCLIBC_LDSO in extra/gcc-uClibc.
182 # So we pass it as make arg to be sure it's proper!
183 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
184
185 %{__make} -j1 \
186         %{?with_verbose:VERBOSE=1} \
187         TARGET_CPU="%{_target_cpu}" \
188         TARGET_ARCH=$target_arch \
189         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
190         HOSTCC="%{__cc}" \
191         CC="%{__cc}" \
192         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
193         OPTIMIZATION="%{rpmcflags} -Os"
194
195 %install
196 rm -rf $RPM_BUILD_ROOT
197 install -d $RPM_BUILD_ROOT%{_bindir}
198
199 %{__make} -j1 install \
200         %{?with_verbose:VERBOSE=1} \
201         TARGET_CPU="%{_target_cpu}" \
202         HOSTCC="%{__cc}" \
203         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
204         CC="%{__cc}" \
205         OPTIMIZATION="%{rpmcflags} -Os" \
206         DESTDIR=$RPM_BUILD_ROOT
207
208 %if %{with shared}
209 %if %{without nptl}
210 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
211 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
212 %endif
213 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
214 %endif
215
216 # these links are *needed* (by stuff in bin/)
217 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
218         if [ -L $f ]; then
219                 l=$(readlink $f)
220                 a=${l##*/}
221                 d=${l%/*}
222                 case "$d" in
223                 %{_bindir})
224                         ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
225                         rm -f $f
226                         ;;
227                 $a)
228                         mv -f $f $RPM_BUILD_ROOT%{_bindir}
229                         ;;
230                 *)
231                         exit 1
232                         ;;
233                 esac
234         else
235                 a=${f#*/%{_target_cpu}-uclibc-}
236                 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
237                 mv -f $f $RPM_BUILD_ROOT%{_bindir}
238         fi
239 done
240
241 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
242         if [ -L $f ]; then
243                 l=$(readlink $f)
244                 case "${l%/*}" in
245                 %{uclibc_root}/bin)
246                         a=${l#*/%{_target_cpu}-uclibc-}
247                         ln -sf %{_bindir}/$a $f
248                         ;;
249                 %{_bindir})
250                         :
251                         ;;
252                 *)
253                         exit 2
254                         ;;
255                 esac
256         fi
257 done
258
259 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
260 for dir in asm asm-generic linux mtd rdma sound video xen; do
261         ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
262 done
263
264 %clean
265 rm -rf $RPM_BUILD_ROOT
266
267 %files
268 %defattr(644,root,root,755)
269 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
270 %dir %{uclibc_root}
271 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
272 %if %{with shared}
273 %dir %{uclibc_root}/lib
274 %attr(755,root,root) %{uclibc_root}/lib/*.so*
275 %endif
276 %endif
277
278 %files devel
279 %defattr(644,root,root,755)
280 %doc docs/*.txt
281 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
282 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
283 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
284 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
285 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
286 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
287 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
288 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
289 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
290 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
291 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
292 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
293 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
294 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
295 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
296 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
297 %{uclibc_root}/usr/lib/*.o
298 %dir %{uclibc_root}/usr
299 %dir %{uclibc_root}/usr/bin
300 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
301 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
302 %attr(755,root,root) %{uclibc_root}/usr/bin/as
303 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
304 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
305 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
306 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
307 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
308 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
309 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
310 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
311 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
312 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
313 %attr(755,root,root) %{uclibc_root}/usr/bin/size
314 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
315 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
316 %dir %{uclibc_root}/usr/lib
317 %if %{with shared}
318 %{uclibc_root}/usr/lib/uclibc_nonshared.a
319 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
320 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
321 %endif
322 %endif
323 %{uclibc_root}/usr/include
324
325 %files static
326 %defattr(644,root,root,755)
327 %{uclibc_root}/usr/lib/lib*.a
This page took 0.044638 seconds and 4 git commands to generate.