]>
Commit | Line | Data |
---|---|---|
c9753b19 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without shared # don't build shared lib support | |
3bde88e0 ER |
4 | %bcond_with verbose # verbose mode |
5 | # | |
6 | %ifarch alpha | |
7 | %undefine with_shared | |
8 | %endif | |
c9753b19 | 9 | # |
70879d06 | 10 | Summary: C library optimized for size |
2a309db2 | 11 | Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar |
70879d06 | 12 | Name: uClibc |
8a1bb06c | 13 | Version: 0.9.30.3 |
21a16074 | 14 | Release: 7 |
8a1bb06c | 15 | Epoch: 4 |
1e0be70f | 16 | License: LGPL v2.1 |
3698d221 | 17 | Group: Libraries |
18 | Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.bz2 | |
8a1bb06c | 19 | # Source0-md5: 73a4bf4a0fa508b01a7a3143574e3d21 |
eacf49ba | 20 | Patch0: %{name}-newsoname.patch |
835882e7 JB |
21 | Patch1: %{name}-toolchain-wrapper.patch |
22 | Patch2: %{name}-targetcpu.patch | |
21f5f0fd | 23 | Patch3: %{name}-debug.patch |
4ae50705 | 24 | Patch4: %{name}-stdio-unhide.patch |
6c27501a JR |
25 | Patch5: %{name}-inotify_init1.patch |
26 | Patch6: %{name}-sockflags.patch | |
cefdec78 AM |
27 | Patch7: %{name}-nosize.patch |
28 | Patch8: %{name}-warn-once.patch | |
3698d221 | 29 | URL: http://uclibc.org/ |
cd27c03b | 30 | BuildRequires: binutils-gasp |
c9753b19 | 31 | BuildRequires: cpp |
cd27c03b | 32 | BuildRequires: gcc >= 5:3.0 |
0e912c1e | 33 | BuildRequires: linux-libc-headers >= 7:2.6.24 |
b38aa92f | 34 | BuildRequires: ncurses-devel |
bcb19e2a | 35 | BuildRequires: rpmbuild(macros) >= 1.453 |
91b0210c | 36 | BuildRequires: sed >= 4.0 |
d49d5dcf | 37 | BuildRequires: which |
f230b68a | 38 | ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664} |
70879d06 | 39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
70879d06 | 40 | |
023ee7a1 | 41 | %if "%{cc_version}" >= "4.2" |
8e0ba786 | 42 | %define specflags -fgnu89-inline |
023ee7a1 | 43 | %endif |
8e0ba786 | 44 | |
835882e7 | 45 | %define uclibc_root /usr/%{_target_cpu}-linux-uclibc |
1f16f3bd | 46 | |
70879d06 | 47 | %description |
48 | Small libc for building embedded applications. | |
49 | ||
adb3d9c8 JR |
50 | %description -l pl.UTF-8 |
51 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 52 | |
3698d221 | 53 | %package devel |
70879d06 | 54 | Summary: Development files for uClibc |
2a309db2 | 55 | Summary(pl.UTF-8): Pliki dla programistów uClibc |
70879d06 | 56 | Group: Development/Libraries |
2af21321 | 57 | Requires: %{name} = %{epoch}:%{version}-%{release} |
66ea2345 | 58 | Requires: binutils-gasp |
0e912c1e | 59 | Requires: linux-libc-headers >= 7:2.6.24 |
33f7e18e | 60 | %requires_eq gcc |
70879d06 | 61 | |
3698d221 | 62 | %description devel |
70879d06 | 63 | Small libc for building embedded applications. |
64 | ||
adb3d9c8 JR |
65 | %description devel -l pl.UTF-8 |
66 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 67 | |
3698d221 | 68 | %package static |
8ff09ad0 | 69 | Summary: Static uClibc libraries |
2a309db2 | 70 | Summary(pl.UTF-8): Biblioteki statyczne uClibc |
70879d06 | 71 | Group: Development/Libraries |
2af21321 | 72 | Requires: %{name}-devel = %{epoch}:%{version}-%{release} |
15ba795d | 73 | Provides: libc-static |
70879d06 | 74 | |
3698d221 | 75 | %description static |
8ff09ad0 | 76 | Static uClibc libraries. |
70879d06 | 77 | |
adb3d9c8 | 78 | %description static -l pl.UTF-8 |
3698d221 | 79 | Biblioteki statyczne uClibc. |
056323ce | 80 | |
70879d06 | 81 | %prep |
8733b462 | 82 | %setup -q |
30b1dd68 JB |
83 | %patch0 -p1 |
84 | %patch1 -p1 | |
fdce39e0 | 85 | %patch2 -p1 |
21f5f0fd | 86 | %patch3 -p1 |
4ae50705 | 87 | %patch4 -p1 |
6c27501a JR |
88 | %patch5 -p1 |
89 | %patch6 -p1 | |
cefdec78 AM |
90 | %patch7 -p1 |
91 | %patch8 -p1 | |
70879d06 | 92 | |
df6ea0eb ER |
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 | |
3698d221 | 98 | %endif |
df6ea0eb ER |
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 | |
3698d221 | 116 | %endif |
9dfdc366 JB |
117 | %endif |
118 | %ifarch %{x8664} | |
df6ea0eb ER |
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 | |
3698d221 | 132 | %endif |
df6ea0eb ER |
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" | |
aa3c9447 | 142 | LDSO_GNU_HASH_SUPPORT=y |
df6ea0eb ER |
143 | %if %{without shared} |
144 | HAVE_NO_SHARED=y | |
145 | # HAVE_SHARED is not set | |
146 | %endif | |
147 | UCLIBC_HAS_PRINTF_M_SPEC=y | |
148 | UCLIBC_SUSV3_LEGACY=y | |
149 | UCLIBC_SUSV3_LEGACY_MACROS=y | |
150 | # DOSTRIP is not set | |
151 | %{?debug:DODEBUG=y} | |
152 | %{?debug:SUPPORT_LD_DEBUG=y} | |
153 | %{?debug:SUPPORT_LD_DEBUG_EARLY=y} | |
154 | EOF | |
30b1dd68 | 155 | |
70879d06 | 156 | %build |
8a1bb06c | 157 | |
df6ea0eb | 158 | # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros |
cdd3fa1d | 159 | %{__make} -j1 defconfig \ |
3bde88e0 | 160 | %{?with_verbose:VERBOSE=1} \ |
30b1dd68 | 161 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 | 162 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ |
5d1a434a | 163 | HOSTCC="%{__cc}" \ |
df6ea0eb | 164 | CC="%{__cc}" \ |
aa3c9447 | 165 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb ER |
166 | OPTIMIZATION="%{rpmcflags} -Os" |
167 | ||
3bde88e0 ER |
168 | # The Makefile includes .config and later tries to assign same variable, |
169 | # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value | |
170 | # for UCLIBC_LDSO in extra/gcc-uClibc. | |
171 | # So we pass it as make arg to be sure it's proper! | |
172 | target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g') | |
173 | ||
cdd3fa1d | 174 | %{__make} -j1 \ |
3bde88e0 | 175 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 176 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 ER |
177 | TARGET_ARCH=$target_arch \ |
178 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ | |
cd27c03b | 179 | HOSTCC="%{__cc}" \ |
df6ea0eb | 180 | CC="%{__cc}" \ |
aa3c9447 | 181 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb | 182 | OPTIMIZATION="%{rpmcflags} -Os" |
70879d06 | 183 | |
184 | %install | |
185 | rm -rf $RPM_BUILD_ROOT | |
3698d221 | 186 | install -d $RPM_BUILD_ROOT%{_bindir} |
70879d06 | 187 | |
415dc192 | 188 | %{__make} -j1 install \ |
3bde88e0 | 189 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 190 | TARGET_CPU="%{_target_cpu}" \ |
df6ea0eb ER |
191 | HOSTCC="%{__cc}" \ |
192 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ | |
c95f6ae8 | 193 | CC="%{__cc}" \ |
df6ea0eb ER |
194 | OPTIMIZATION="%{rpmcflags} -Os" \ |
195 | DESTDIR=$RPM_BUILD_ROOT | |
70879d06 | 196 | |
c9753b19 | 197 | %if %{with shared} |
835882e7 | 198 | mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so |
3bde88e0 ER |
199 | ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0 |
200 | chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so | |
c9753b19 | 201 | %endif |
835882e7 | 202 | |
b19cfcd2 | 203 | # these links are *needed* (by stuff in bin/) |
835882e7 | 204 | for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do |
c9753b19 ER |
205 | if [ -L $f ]; then |
206 | l=$(readlink $f) | |
207 | a=${l##*/} | |
208 | d=${l%/*} | |
209 | case "$d" in | |
210 | %{_bindir}) | |
211 | ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/} | |
212 | rm -f $f | |
213 | ;; | |
214 | $a) | |
215 | mv -f $f $RPM_BUILD_ROOT%{_bindir} | |
216 | ;; | |
217 | *) | |
218 | exit 1 | |
219 | ;; | |
220 | esac | |
221 | else | |
222 | a=${f#*/%{_target_cpu}-uclibc-} | |
223 | ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a | |
224 | mv -f $f $RPM_BUILD_ROOT%{_bindir} | |
225 | fi | |
30b1dd68 | 226 | done |
70879d06 | 227 | |
c9753b19 ER |
228 | for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do |
229 | if [ -L $f ]; then | |
230 | l=$(readlink $f) | |
231 | case "${l%/*}" in | |
232 | %{uclibc_root}/bin) | |
233 | a=${l#*/%{_target_cpu}-uclibc-} | |
234 | ln -sf %{_bindir}/$a $f | |
235 | ;; | |
236 | %{_bindir}) | |
237 | : | |
238 | ;; | |
239 | *) | |
240 | exit 2 | |
241 | ;; | |
242 | esac | |
243 | fi | |
f7ae07ef PS |
244 | done |
245 | ||
835882e7 | 246 | rm -rf $RPM_BUILD_ROOT%{uclibc_root}/usr/include/{linux,asm*} |
21a16074 AM |
247 | # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u |
248 | for dir in asm asm-generic linux mtd rdma sound video xen; do | |
249 | ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir} | |
250 | done | |
f230b68a | 251 | # for future use |
e74b8a86 | 252 | %ifarch sparc64 |
835882e7 JB |
253 | ln -sf /usr/include/asm-sparc $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc |
254 | ln -sf /usr/include/asm-sparc64 $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc64 | |
485e7d55 | 255 | %endif |
3c259173 | 256 | |
70879d06 | 257 | %clean |
258 | rm -rf $RPM_BUILD_ROOT | |
259 | ||
70879d06 | 260 | %files |
261 | %defattr(644,root,root,755) | |
835882e7 JB |
262 | %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO |
263 | %dir %{uclibc_root} | |
f230b68a | 264 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
c9753b19 | 265 | %if %{with shared} |
835882e7 JB |
266 | %dir %{uclibc_root}/lib |
267 | %attr(755,root,root) %{uclibc_root}/lib/*.so* | |
9a46e67b | 268 | %endif |
c9753b19 | 269 | %endif |
70879d06 | 270 | |
3698d221 | 271 | %files devel |
70879d06 | 272 | %defattr(644,root,root,755) |
835882e7 | 273 | %doc docs/*.txt |
3bde88e0 ER |
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 | |
835882e7 JB |
291 | %{uclibc_root}/usr/lib/*.o |
292 | %dir %{uclibc_root}/usr | |
293 | %dir %{uclibc_root}/usr/bin | |
3bde88e0 ER |
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 | |
835882e7 | 311 | %dir %{uclibc_root}/usr/lib |
c9753b19 | 312 | %if %{with shared} |
835882e7 | 313 | %{uclibc_root}/usr/lib/uclibc_nonshared.a |
f230b68a | 314 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
835882e7 | 315 | %attr(755,root,root) %{uclibc_root}/usr/lib/*.so |
1a8228b3 | 316 | %endif |
c9753b19 | 317 | %endif |
835882e7 | 318 | %{uclibc_root}/usr/include |
3698d221 | 319 | |
320 | %files static | |
98274bf4 | 321 | %defattr(644,root,root,755) |
835882e7 | 322 | %{uclibc_root}/usr/lib/lib*.a |