]> git.pld-linux.org Git - packages/uClibc.git/blob - uClibc.spec
- gcc 6.4 rebuild
[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_without  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:        21
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 Patch5:         %{name}-kernel-types.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         filterout       -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4
54
55 %define         uclibc_root     /usr/%{_target_cpu}-linux-uclibc
56
57 %description
58 Small libc for building embedded applications.
59
60 %description -l pl.UTF-8
61 Mała libc do budowania aplikacji wbudowanych.
62
63 %package devel
64 Summary:        Development files for uClibc
65 Summary(pl.UTF-8):      Pliki dla programistów uClibc
66 Group:          Development/Libraries
67 Requires:       %{name} = %{epoch}:%{version}-%{release}
68 Requires:       linux-libc-headers >= 7:2.6.27
69 %requires_eq    gcc
70
71 %description devel
72 Small libc for building embedded applications.
73
74 %description devel -l pl.UTF-8
75 Mała libc do budowania aplikacji wbudowanych.
76
77 %package static
78 Summary:        Static uClibc libraries
79 Summary(pl.UTF-8):      Biblioteki statyczne uClibc
80 Group:          Development/Libraries
81 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
82 Provides:       libc-static
83
84 %description static
85 Static uClibc libraries.
86
87 %description static -l pl.UTF-8
88 Biblioteki statyczne uClibc.
89
90 %prep
91 %setup -q
92 %patch0 -p1
93 %patch1 -p1
94 %patch2 -p1
95 %patch3 -p1
96 %patch4 -p1
97 %patch5 -p1
98
99 # ARCH is already determined by uname -m
100 %ifarch %{ix86}
101 defconfig=extra/Configs/defconfigs/i386/defconfig
102 %ifarch i386
103 echo 'CONFIG_386=y' >> $defconfig
104 %endif
105 %ifarch i486
106 echo 'CONFIG_486=y' >> $defconfig
107 %endif
108 %ifarch i586
109 echo 'CONFIG_586=y' >> $defconfig
110 %endif
111 %ifarch i686
112 echo 'CONFIG_686=y' >> $defconfig
113 %endif
114 %ifarch pentium3
115 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
116 %endif
117 %ifarch pentium4
118 echo 'CONFIG_PENTIUM4=y' >> $defconfig
119 %endif
120 %ifarch athlon
121 echo 'CONFIG_K7=y' >> $defconfig
122 %endif
123 %endif
124 %ifarch %{x8664}
125 defconfig=extra/Configs/defconfigs/x86_64/defconfig
126 %endif
127 %ifarch alpha
128 defconfig=extra/Configs/defconfigs/alpha/defconfig
129 %endif
130 %ifarch sparc sparcv9
131 defconfig=extra/Configs/defconfigs/sparc/defconfig
132 %endif
133 %ifarch ppc
134 defconfig=extra/Configs/defconfigs/powerpc/defconfig
135 %endif
136 %ifarch ia64
137 defconfig=extra/Configs/defconfigs/ia64/defconfig
138 %endif
139
140 cat <<'EOF' >> $defconfig
141 # HAS_NO_THREADS is not set
142 %{!?with_nptl:LINUXTHREADS_OLD=y}
143 %{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=y}
144 UCLIBC_HAS_IPV4=y
145 UCLIBC_HAS_IPV6=y
146 DO_C99_MATH=y
147 UCLIBC_HAS_RPC=y
148 # UCLIBC_HAS_FULL_RPC is not set
149 # UCLIBC_HAS_REENTRANT_RPC is not set
150 UCLIBC_HAS_SYS_SIGLIST=y
151 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
152 LDSO_GNU_HASH_SUPPORT=y
153 %if %{without shared}
154 HAVE_NO_SHARED=y
155 # HAVE_SHARED is not set
156 %endif
157 UCLIBC_HAS_PRINTF_M_SPEC=y
158 UCLIBC_SUSV3_LEGACY=y
159 UCLIBC_SUSV3_LEGACY_MACROS=y
160 UCLIBC_SUSV4_LEGACY=y
161 UCLIBC_USE_NETLINK=y
162 UCLIBC_SUPPORT_AI_ADDRCONFIG=y
163 UCLIBC_HAS_RESOLVER_SUPPORT=y
164 UCLIBC_HAS_LIBRESOLV_STUB=y
165 UCLIBC_HAS_COMPAT_RES_STATE=y
166 UCLIBC_HAS_EXTRA_COMPAT_RES_STATE=y
167 # DOSTRIP is not set
168 %{?debug:DODEBUG=y}
169 %{?debug:SUPPORT_LD_DEBUG=y}
170 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
171 EOF
172
173 %build
174 # use ld.bfd; gold doesn't work well for now
175 install -d our-ld
176 ln -s %{_bindir}/ld.bfd our-ld/ld
177 PATH=$(pwd)/our-ld:$PATH; export PATH
178
179 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
180 %{__make} -j1 defconfig \
181         %{?with_verbose:VERBOSE=1} \
182         TARGET_CPU="%{_target_cpu}" \
183         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
184         HOSTCC="%{__cc}" \
185         CC="%{__cc}" \
186         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
187         OPTIMIZATION="%{rpmcflags} -Os"
188
189 # The Makefile includes .config and later tries to assign same variable,
190 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
191 # for UCLIBC_LDSO in extra/gcc-uClibc.
192 # So we pass it as make arg to be sure it's proper!
193 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
194
195 %{__make} -j1 \
196         %{?with_verbose:VERBOSE=1} \
197         TARGET_CPU="%{_target_cpu}" \
198         TARGET_ARCH=$target_arch \
199         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
200         HOSTCC="%{__cc}" \
201         CC="%{__cc}" \
202         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
203         OPTIMIZATION="%{rpmcflags} -Os"
204
205 %install
206 rm -rf $RPM_BUILD_ROOT
207 install -d $RPM_BUILD_ROOT%{_bindir}
208
209 %{__make} -j1 install \
210         %{?with_verbose:VERBOSE=1} \
211         TARGET_CPU="%{_target_cpu}" \
212         HOSTCC="%{__cc}" \
213         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
214         CC="%{__cc}" \
215         OPTIMIZATION="%{rpmcflags} -Os" \
216         DESTDIR=$RPM_BUILD_ROOT
217
218 %if %{with shared}
219 %if %{without nptl}
220 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
221 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
222 %endif
223 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
224 %endif
225
226 # these links are *needed* (by stuff in bin/)
227 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
228         if [ -L $f ]; then
229                 l=$(readlink $f)
230                 a=${l##*/}
231                 d=${l%/*}
232                 case "$d" in
233                 %{_bindir})
234                         ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
235                         rm -f $f
236                         ;;
237                 $a)
238                         mv -f $f $RPM_BUILD_ROOT%{_bindir}
239                         ;;
240                 *)
241                         exit 1
242                         ;;
243                 esac
244         else
245                 a=${f#*/%{_target_cpu}-uclibc-}
246                 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
247                 mv -f $f $RPM_BUILD_ROOT%{_bindir}
248         fi
249 done
250
251 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
252         if [ -L $f ]; then
253                 l=$(readlink $f)
254                 case "${l%/*}" in
255                 %{uclibc_root}/bin)
256                         a=${l#*/%{_target_cpu}-uclibc-}
257                         ln -sf %{_bindir}/$a $f
258                         ;;
259                 %{_bindir})
260                         :
261                         ;;
262                 *)
263                         exit 2
264                         ;;
265                 esac
266         fi
267 done
268
269 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
270 for dir in asm asm-generic linux mtd rdma sound video xen; do
271         ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
272 done
273
274 %clean
275 rm -rf $RPM_BUILD_ROOT
276
277 %files
278 %defattr(644,root,root,755)
279 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
280 %dir %{uclibc_root}
281 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
282 %if %{with shared}
283 %dir %{uclibc_root}/lib
284 %attr(755,root,root) %{uclibc_root}/lib/*.so*
285 %endif
286 %endif
287
288 %files devel
289 %defattr(644,root,root,755)
290 %doc docs/*.txt
291 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
292 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
293 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
294 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
295 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
296 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
297 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
298 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
299 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
300 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
301 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
302 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
303 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
304 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
305 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
306 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
307 %{uclibc_root}/usr/lib/*.o
308 %dir %{uclibc_root}/usr
309 %dir %{uclibc_root}/usr/bin
310 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
311 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
312 %attr(755,root,root) %{uclibc_root}/usr/bin/as
313 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
314 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
315 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
316 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
317 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
318 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
319 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
320 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
321 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
322 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
323 %attr(755,root,root) %{uclibc_root}/usr/bin/size
324 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
325 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
326 %dir %{uclibc_root}/usr/lib
327 %if %{with shared}
328 %{uclibc_root}/usr/lib/uclibc_nonshared.a
329 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
330 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
331 %endif
332 %endif
333 %{uclibc_root}/usr/include
334
335 %files static
336 %defattr(644,root,root,755)
337 %{uclibc_root}/usr/lib/lib*.a
This page took 0.048009 seconds and 4 git commands to generate.