]> git.pld-linux.org Git - packages/uClibc.git/blob - uClibc.spec
799901f0f25aad933e1d685b63b7ffd2fae74405
[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.33.2
15 Release:        3
16 Epoch:          4
17 License:        LGPL v2.1
18 Group:          Libraries
19 Source0:        http://uclibc.org/downloads/%{name}-%{version}.tar.xz
20 # Source0-md5:  73e6fe215648d02246f4d195b25fb17e
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 URL:            http://uclibc.org/
27 BuildRequires:  binutils >= 2.16
28 BuildRequires:  cpp
29 %if %{with nptl}
30 BuildRequires:  gcc >= 5:4.1
31 %else
32 BuildRequires:  gcc >= 5:3.0
33 %endif
34 BuildRequires:  linux-libc-headers >= 7:2.6.27
35 BuildRequires:  make >= 3.80
36 BuildRequires:  ncurses-devel
37 BuildRequires:  rpmbuild(macros) >= 1.453
38 BuildRequires:  sed >= 4.0
39 BuildRequires:  tar >= 1:1.22
40 BuildRequires:  which
41 BuildRequires:  xz
42 %{?with_nptl:Requires:  uname(version) >= 2.6}
43 # only these supported by this .spec; uClibc code supports some more
44 ExclusiveArch:  alpha %{ix86} ppc sparc sparcv9 %{x8664}
45 %{?with_nptl:ExcludeArch:       i386}
46 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
47
48 %if "%{cc_version}" >= "4.2"
49 %define         specflags       -fgnu89-inline
50 %endif
51
52 %define         uclibc_root     /usr/%{_target_cpu}-linux-uclibc
53
54 %description
55 Small libc for building embedded applications.
56
57 %description -l pl.UTF-8
58 Mała libc do budowania aplikacji wbudowanych.
59
60 %package devel
61 Summary:        Development files for uClibc
62 Summary(pl.UTF-8):      Pliki dla programistów uClibc
63 Group:          Development/Libraries
64 Requires:       %{name} = %{epoch}:%{version}-%{release}
65 Requires:       linux-libc-headers >= 7:2.6.27
66 %requires_eq    gcc
67
68 %description devel
69 Small libc for building embedded applications.
70
71 %description devel -l pl.UTF-8
72 Mała libc do budowania aplikacji wbudowanych.
73
74 %package static
75 Summary:        Static uClibc libraries
76 Summary(pl.UTF-8):      Biblioteki statyczne uClibc
77 Group:          Development/Libraries
78 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
79 Provides:       libc-static
80
81 %description static
82 Static uClibc libraries.
83
84 %description static -l pl.UTF-8
85 Biblioteki statyczne uClibc.
86
87 %prep
88 %setup -q
89 %patch0 -p1
90 %patch1 -p1
91 %patch2 -p1
92 %patch3 -p1
93 %patch4 -p1
94
95 # ARCH is already determined by uname -m
96 %ifarch %{ix86}
97 defconfig=extra/Configs/defconfigs/i386/defconfig
98 %ifarch i386
99 echo 'CONFIG_386=y' >> $defconfig
100 %endif
101 %ifarch i486
102 echo 'CONFIG_486=y' >> $defconfig
103 %endif
104 %ifarch i586
105 echo 'CONFIG_586=y' >> $defconfig
106 %endif
107 %ifarch i686
108 echo 'CONFIG_686=y' >> $defconfig
109 %endif
110 %ifarch pentium3
111 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
112 %endif
113 %ifarch pentium4
114 echo 'CONFIG_PENTIUM4=y' >> $defconfig
115 %endif
116 %ifarch athlon
117 echo 'CONFIG_K7=y' >> $defconfig
118 %endif
119 %endif
120 %ifarch %{x8664}
121 defconfig=extra/Configs/defconfigs/x86_64/defconfig
122 %endif
123 %ifarch alpha
124 defconfig=extra/Configs/defconfigs/alpha/defconfig
125 %endif
126 %ifarch sparc sparcv9
127 defconfig=extra/Configs/defconfigs/sparc/defconfig
128 %endif
129 %ifarch ppc
130 defconfig=extra/Configs/defconfigs/powerpc/defconfig
131 %endif
132 %ifarch ia64
133 defconfig=extra/Configs/defconfigs/ia64/defconfig
134 %endif
135
136 cat <<'EOF' >> $defconfig
137 # HAS_NO_THREADS is not set
138 %{!?with_nptl:LINUXTHREADS_OLD=y}
139 %{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=y}
140 UCLIBC_HAS_IPV6=y
141 DO_C99_MATH=y
142 UCLIBC_HAS_RPC=y
143 # UCLIBC_HAS_FULL_RPC is not set
144 # UCLIBC_HAS_REENTRANT_RPC is not set
145 UCLIBC_HAS_SYS_SIGLIST=y
146 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
147 LDSO_GNU_HASH_SUPPORT=y
148 %if %{without shared}
149 HAVE_NO_SHARED=y
150 # HAVE_SHARED is not set
151 %endif
152 UCLIBC_HAS_PRINTF_M_SPEC=y
153 UCLIBC_SUSV3_LEGACY=y
154 UCLIBC_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}
159 EOF
160
161 %build
162 # use ld.bfd; gold doesn't work well for now
163 install -d our-ld
164 ln -s %{_bindir}/ld.bfd our-ld/ld
165 PATH=$(pwd)/our-ld:$PATH; export PATH
166
167 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
168 %{__make} -j1 defconfig \
169         %{?with_verbose:VERBOSE=1} \
170         TARGET_CPU="%{_target_cpu}" \
171         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
172         HOSTCC="%{__cc}" \
173         CC="%{__cc}" \
174         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
175         OPTIMIZATION="%{rpmcflags} -Os"
176
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!
181 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
182
183 %{__make} -j1 \
184         %{?with_verbose:VERBOSE=1} \
185         TARGET_CPU="%{_target_cpu}" \
186         TARGET_ARCH=$target_arch \
187         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
188         HOSTCC="%{__cc}" \
189         CC="%{__cc}" \
190         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
191         OPTIMIZATION="%{rpmcflags} -Os"
192
193 %install
194 rm -rf $RPM_BUILD_ROOT
195 install -d $RPM_BUILD_ROOT%{_bindir}
196
197 %{__make} -j1 install \
198         %{?with_verbose:VERBOSE=1} \
199         TARGET_CPU="%{_target_cpu}" \
200         HOSTCC="%{__cc}" \
201         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
202         CC="%{__cc}" \
203         OPTIMIZATION="%{rpmcflags} -Os" \
204         DESTDIR=$RPM_BUILD_ROOT
205
206 %if %{with shared}
207 %if %{without nptl}
208 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
209 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
210 %endif
211 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
212 %endif
213
214 # these links are *needed* (by stuff in bin/)
215 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
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
237 done
238
239 for 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
255 done
256
257 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
258 for 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}
260 done
261
262 %clean
263 rm -rf $RPM_BUILD_ROOT
264
265 %files
266 %defattr(644,root,root,755)
267 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
268 %dir %{uclibc_root}
269 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
270 %if %{with shared}
271 %dir %{uclibc_root}/lib
272 %attr(755,root,root) %{uclibc_root}/lib/*.so*
273 %endif
274 %endif
275
276 %files devel
277 %defattr(644,root,root,755)
278 %doc docs/*.txt
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++
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
295 %{uclibc_root}/usr/lib/*.o
296 %dir %{uclibc_root}/usr
297 %dir %{uclibc_root}/usr/bin
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++
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
314 %dir %{uclibc_root}/usr/lib
315 %if %{with shared}
316 %{uclibc_root}/usr/lib/uclibc_nonshared.a
317 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
318 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
319 %endif
320 %endif
321 %{uclibc_root}/usr/include
322
323 %files static
324 %defattr(644,root,root,755)
325 %{uclibc_root}/usr/lib/lib*.a
This page took 0.074361 seconds and 2 git commands to generate.