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