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