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