]> git.pld-linux.org Git - packages/uClibc.git/blob - uClibc.spec
- 0.9.30 is broken
[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 # - 0.9.30 is broken. First build it and then try to build
6 #   lvm2.spec on i686 (or any *.c program like printf("test")).
7 #   Fails with: symbol '_stdio_openlist_use_count': can't resolve symbol ...
8 #
9 # Conditional build:
10 %bcond_without  shared          # don't build shared lib support
11 %bcond_with     verbose         # verbose mode
12 #
13 %ifarch alpha
14 %undefine       with_shared
15 %endif
16 #
17 Summary:        C library optimized for size
18 Summary(pl.UTF-8):      Biblioteka C zoptymalizowana na rozmiar
19 Name:           uClibc
20 Version:        0.9.30
21 Release:        3.1
22 Epoch:          2
23 License:        LGPL v2.1
24 Group:          Libraries
25 Source0:        http://uclibc.org/downloads/%{name}-%{version}.tar.bz2
26 # Source0-md5:  e5766e2566e0297adebebbcc0aba1f2d
27 Patch0:         %{name}-newsoname.patch
28 Patch1:         %{name}-toolchain-wrapper.patch
29 Patch2:         %{name}-targetcpu.patch
30 Patch3:         %{name}-debug.patch
31 Patch4:         %{name}-stdio-unhide.patch
32 Patch5:         %{name}-sparc.patch
33 Patch6:         %{name}-headers.patch
34 URL:            http://uclibc.org/
35 BuildRequires:  binutils-gasp
36 BuildRequires:  cpp
37 BuildRequires:  gcc >= 5:3.0
38 BuildRequires:  linux-libc-headers >= 7:2.6.24
39 BuildRequires:  sed >= 4.0
40 BuildRequires:  which
41 ExclusiveArch:  alpha %{ix86} ppc sparc sparcv9 %{x8664}
42 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43
44 %define         specflags       -fgnu89-inline
45
46 %define         uclibc_root     /usr/%{_target_cpu}-linux-uclibc
47
48 %description
49 Small libc for building embedded applications.
50
51 %description -l pl.UTF-8
52 Mała libc do budowania aplikacji wbudowanych.
53
54 %package devel
55 Summary:        Development files for uClibc
56 Summary(pl.UTF-8):      Pliki dla programistów uClibc
57 Group:          Development/Libraries
58 Requires:       %{name} = %{epoch}:%{version}-%{release}
59 Requires:       binutils-gasp
60 Requires:       linux-libc-headers >= 7:2.6.24
61 %requires_eq    gcc
62
63 %description devel
64 Small libc for building embedded applications.
65
66 %description devel -l pl.UTF-8
67 Mała libc do budowania aplikacji wbudowanych.
68
69 %package static
70 Summary:        Static uClibc libraries
71 Summary(pl.UTF-8):      Biblioteki statyczne uClibc
72 Group:          Development/Libraries
73 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
74 Provides:       libc-static
75
76 %description static
77 Static uClibc libraries.
78
79 %description static -l pl.UTF-8
80 Biblioteki statyczne uClibc.
81
82 %prep
83 %setup -q
84 %patch0 -p1
85 %patch1 -p1
86 %patch2 -p1
87 %patch3 -p1
88 %patch4 -p1
89 # check if it's needed now... ldso is broken on sparc anyway
90 #%patch5 -p1
91 %patch6 -p1
92
93 # ARCH is already determined by uname -m
94 %ifarch %{ix86}
95 defconfig=extra/Configs/defconfigs/i386
96 %ifarch i386
97 echo 'CONFIG_386=y' >> $defconfig
98 %endif
99 %ifarch i486
100 echo 'CONFIG_486=y' >> $defconfig
101 %endif
102 %ifarch i586
103 echo 'CONFIG_586=y' >> $defconfig
104 %endif
105 %ifarch i686
106 echo 'CONFIG_686=y' >> $defconfig
107 %endif
108 %ifarch pentium3
109 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
110 %endif
111 %ifarch pentium4
112 echo 'CONFIG_PENTIUM4=y' >> $defconfig
113 %endif
114 %ifarch athlon
115 echo 'CONFIG_K7=y' >> $defconfig
116 %endif
117 %endif
118 %ifarch %{x8664}
119 defconfig=extra/Configs/defconfigs/x86_64
120 %endif
121 %ifarch alpha
122 defconfig=extra/Configs/defconfigs/alpha
123 %endif
124 %ifarch sparc sparcv9
125 defconfig=extra/Configs/defconfigs/sparc
126 %endif
127 %ifarch ppc
128 defconfig=extra/Configs/defconfigs/powerpc
129 %endif
130 %ifarch ia64
131 defconfig=extra/Configs/defconfigs/ia64
132 %endif
133
134 cat <<'EOF' >> $defconfig
135 UCLIBC_HAS_IPV6=y
136 DO_C99_MATH=y
137 UCLIBC_HAS_RPC=y
138 # UCLIBC_HAS_FULL_RPC is not set
139 # UCLIBC_HAS_REENTRANT_RPC is not set
140 UCLIBC_HAS_SYS_SIGLIST=y
141 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
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         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
164         CC="%{__cc}" \
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         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
180         CC="%{__cc}" \
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.086806 seconds and 4 git commands to generate.