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