]>
Commit | Line | Data |
---|---|---|
c9753b19 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without shared # don't build shared lib support | |
3e880be8 | 4 | %bcond_with nptl # libpthread: NPTL instead of LinuxThreads (experimental; no i386) |
f8e403fa | 5 | %bcond_without verbose # verbose mode |
3bde88e0 ER |
6 | # |
7 | %ifarch alpha | |
8 | %undefine with_shared | |
9 | %endif | |
c9753b19 | 10 | # |
70879d06 | 11 | Summary: C library optimized for size |
2a309db2 | 12 | Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar |
70879d06 | 13 | Name: uClibc |
77a890ae | 14 | Version: 0.9.33.2 |
753091f9 | 15 | Release: 11 |
8a1bb06c | 16 | Epoch: 4 |
1e0be70f | 17 | License: LGPL v2.1 |
3698d221 | 18 | Group: Libraries |
3e880be8 | 19 | Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.xz |
77a890ae | 20 | # Source0-md5: 73e6fe215648d02246f4d195b25fb17e |
eacf49ba | 21 | Patch0: %{name}-newsoname.patch |
835882e7 JB |
22 | Patch1: %{name}-toolchain-wrapper.patch |
23 | Patch2: %{name}-targetcpu.patch | |
21f5f0fd | 24 | Patch3: %{name}-debug.patch |
4ae50705 | 25 | Patch4: %{name}-stdio-unhide.patch |
3698d221 | 26 | URL: http://uclibc.org/ |
3e880be8 | 27 | BuildRequires: binutils >= 2.16 |
c9753b19 | 28 | BuildRequires: cpp |
3e880be8 JB |
29 | %if %{with nptl} |
30 | BuildRequires: gcc >= 5:4.1 | |
31 | %else | |
cd27c03b | 32 | BuildRequires: gcc >= 5:3.0 |
3e880be8 JB |
33 | %endif |
34 | BuildRequires: linux-libc-headers >= 7:2.6.27 | |
35 | BuildRequires: make >= 3.80 | |
b38aa92f | 36 | BuildRequires: ncurses-devel |
bcb19e2a | 37 | BuildRequires: rpmbuild(macros) >= 1.453 |
91b0210c | 38 | BuildRequires: sed >= 4.0 |
3e880be8 | 39 | BuildRequires: tar >= 1:1.22 |
d49d5dcf | 40 | BuildRequires: which |
3e880be8 JB |
41 | BuildRequires: xz |
42 | %{?with_nptl:Requires: uname(version) >= 2.6} | |
43 | # only these supported by this .spec; uClibc code supports some more | |
f230b68a | 44 | ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664} |
3e880be8 | 45 | %{?with_nptl:ExcludeArch: i386} |
70879d06 | 46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
70879d06 | 47 | |
023ee7a1 | 48 | %if "%{cc_version}" >= "4.2" |
8e0ba786 | 49 | %define specflags -fgnu89-inline |
023ee7a1 | 50 | %endif |
8e0ba786 | 51 | |
f8e403fa AM |
52 | %define filterout -fstack-protector --param=ssp-buffer-size=4 |
53 | ||
835882e7 | 54 | %define uclibc_root /usr/%{_target_cpu}-linux-uclibc |
1f16f3bd | 55 | |
70879d06 | 56 | %description |
57 | Small libc for building embedded applications. | |
58 | ||
adb3d9c8 JR |
59 | %description -l pl.UTF-8 |
60 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 61 | |
3698d221 | 62 | %package devel |
70879d06 | 63 | Summary: Development files for uClibc |
2a309db2 | 64 | Summary(pl.UTF-8): Pliki dla programistów uClibc |
70879d06 | 65 | Group: Development/Libraries |
2af21321 | 66 | Requires: %{name} = %{epoch}:%{version}-%{release} |
3e880be8 | 67 | Requires: linux-libc-headers >= 7:2.6.27 |
33f7e18e | 68 | %requires_eq gcc |
70879d06 | 69 | |
3698d221 | 70 | %description devel |
70879d06 | 71 | Small libc for building embedded applications. |
72 | ||
adb3d9c8 JR |
73 | %description devel -l pl.UTF-8 |
74 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 75 | |
3698d221 | 76 | %package static |
8ff09ad0 | 77 | Summary: Static uClibc libraries |
2a309db2 | 78 | Summary(pl.UTF-8): Biblioteki statyczne uClibc |
70879d06 | 79 | Group: Development/Libraries |
2af21321 | 80 | Requires: %{name}-devel = %{epoch}:%{version}-%{release} |
15ba795d | 81 | Provides: libc-static |
70879d06 | 82 | |
3698d221 | 83 | %description static |
8ff09ad0 | 84 | Static uClibc libraries. |
70879d06 | 85 | |
adb3d9c8 | 86 | %description static -l pl.UTF-8 |
3698d221 | 87 | Biblioteki statyczne uClibc. |
056323ce | 88 | |
70879d06 | 89 | %prep |
8733b462 | 90 | %setup -q |
30b1dd68 JB |
91 | %patch0 -p1 |
92 | %patch1 -p1 | |
fdce39e0 | 93 | %patch2 -p1 |
21f5f0fd | 94 | %patch3 -p1 |
4ae50705 | 95 | %patch4 -p1 |
70879d06 | 96 | |
df6ea0eb ER |
97 | # ARCH is already determined by uname -m |
98 | %ifarch %{ix86} | |
d5a28f10 | 99 | defconfig=extra/Configs/defconfigs/i386/defconfig |
df6ea0eb ER |
100 | %ifarch i386 |
101 | echo 'CONFIG_386=y' >> $defconfig | |
3698d221 | 102 | %endif |
df6ea0eb ER |
103 | %ifarch i486 |
104 | echo 'CONFIG_486=y' >> $defconfig | |
105 | %endif | |
106 | %ifarch i586 | |
107 | echo 'CONFIG_586=y' >> $defconfig | |
108 | %endif | |
109 | %ifarch i686 | |
110 | echo 'CONFIG_686=y' >> $defconfig | |
111 | %endif | |
112 | %ifarch pentium3 | |
113 | echo 'CONFIG_PENTIUMIII=y' >> $defconfig | |
114 | %endif | |
115 | %ifarch pentium4 | |
116 | echo 'CONFIG_PENTIUM4=y' >> $defconfig | |
117 | %endif | |
118 | %ifarch athlon | |
119 | echo 'CONFIG_K7=y' >> $defconfig | |
3698d221 | 120 | %endif |
9dfdc366 JB |
121 | %endif |
122 | %ifarch %{x8664} | |
d5a28f10 | 123 | defconfig=extra/Configs/defconfigs/x86_64/defconfig |
df6ea0eb ER |
124 | %endif |
125 | %ifarch alpha | |
d5a28f10 | 126 | defconfig=extra/Configs/defconfigs/alpha/defconfig |
df6ea0eb ER |
127 | %endif |
128 | %ifarch sparc sparcv9 | |
d5a28f10 | 129 | defconfig=extra/Configs/defconfigs/sparc/defconfig |
df6ea0eb ER |
130 | %endif |
131 | %ifarch ppc | |
d5a28f10 | 132 | defconfig=extra/Configs/defconfigs/powerpc/defconfig |
df6ea0eb ER |
133 | %endif |
134 | %ifarch ia64 | |
d5a28f10 | 135 | defconfig=extra/Configs/defconfigs/ia64/defconfig |
3698d221 | 136 | %endif |
df6ea0eb ER |
137 | |
138 | cat <<'EOF' >> $defconfig | |
3e880be8 JB |
139 | # HAS_NO_THREADS is not set |
140 | %{!?with_nptl:LINUXTHREADS_OLD=y} | |
141 | %{?with_nptl:UCLIBC_HAS_THREADS_NATIVE=y} | |
9cd349bc | 142 | UCLIBC_HAS_IPV4=y |
df6ea0eb ER |
143 | UCLIBC_HAS_IPV6=y |
144 | DO_C99_MATH=y | |
145 | UCLIBC_HAS_RPC=y | |
146 | # UCLIBC_HAS_FULL_RPC is not set | |
147 | # UCLIBC_HAS_REENTRANT_RPC is not set | |
148 | UCLIBC_HAS_SYS_SIGLIST=y | |
149 | SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib" | |
aa3c9447 | 150 | LDSO_GNU_HASH_SUPPORT=y |
df6ea0eb ER |
151 | %if %{without shared} |
152 | HAVE_NO_SHARED=y | |
153 | # HAVE_SHARED is not set | |
154 | %endif | |
155 | UCLIBC_HAS_PRINTF_M_SPEC=y | |
156 | UCLIBC_SUSV3_LEGACY=y | |
157 | UCLIBC_SUSV3_LEGACY_MACROS=y | |
9cd349bc AM |
158 | UCLIBC_SUSV4_LEGACY=y |
159 | UCLIBC_USE_NETLINK=y | |
160 | UCLIBC_SUPPORT_AI_ADDRCONFIG=y | |
161 | UCLIBC_HAS_RESOLVER_SUPPORT=y | |
162 | UCLIBC_HAS_LIBRESOLV_STUB=y | |
163 | UCLIBC_HAS_COMPAT_RES_STATE=y | |
164 | UCLIBC_HAS_EXTRA_COMPAT_RES_STATE=y | |
df6ea0eb ER |
165 | # DOSTRIP is not set |
166 | %{?debug:DODEBUG=y} | |
167 | %{?debug:SUPPORT_LD_DEBUG=y} | |
168 | %{?debug:SUPPORT_LD_DEBUG_EARLY=y} | |
169 | EOF | |
30b1dd68 | 170 | |
70879d06 | 171 | %build |
5e958ed9 AM |
172 | # use ld.bfd; gold doesn't work well for now |
173 | install -d our-ld | |
174 | ln -s %{_bindir}/ld.bfd our-ld/ld | |
175 | PATH=$(pwd)/our-ld:$PATH; export PATH | |
8a1bb06c | 176 | |
df6ea0eb | 177 | # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros |
cdd3fa1d | 178 | %{__make} -j1 defconfig \ |
3bde88e0 | 179 | %{?with_verbose:VERBOSE=1} \ |
30b1dd68 | 180 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 | 181 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ |
5d1a434a | 182 | HOSTCC="%{__cc}" \ |
df6ea0eb | 183 | CC="%{__cc}" \ |
aa3c9447 | 184 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb ER |
185 | OPTIMIZATION="%{rpmcflags} -Os" |
186 | ||
3bde88e0 ER |
187 | # The Makefile includes .config and later tries to assign same variable, |
188 | # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value | |
189 | # for UCLIBC_LDSO in extra/gcc-uClibc. | |
190 | # So we pass it as make arg to be sure it's proper! | |
191 | target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g') | |
192 | ||
cdd3fa1d | 193 | %{__make} -j1 \ |
3bde88e0 | 194 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 195 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 ER |
196 | TARGET_ARCH=$target_arch \ |
197 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ | |
cd27c03b | 198 | HOSTCC="%{__cc}" \ |
df6ea0eb | 199 | CC="%{__cc}" \ |
aa3c9447 | 200 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb | 201 | OPTIMIZATION="%{rpmcflags} -Os" |
70879d06 | 202 | |
203 | %install | |
204 | rm -rf $RPM_BUILD_ROOT | |
3698d221 | 205 | install -d $RPM_BUILD_ROOT%{_bindir} |
70879d06 | 206 | |
415dc192 | 207 | %{__make} -j1 install \ |
3bde88e0 | 208 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 209 | TARGET_CPU="%{_target_cpu}" \ |
df6ea0eb ER |
210 | HOSTCC="%{__cc}" \ |
211 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ | |
c95f6ae8 | 212 | CC="%{__cc}" \ |
df6ea0eb ER |
213 | OPTIMIZATION="%{rpmcflags} -Os" \ |
214 | DESTDIR=$RPM_BUILD_ROOT | |
70879d06 | 215 | |
c9753b19 | 216 | %if %{with shared} |
3e880be8 | 217 | %if %{without nptl} |
835882e7 | 218 | mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so |
3bde88e0 | 219 | ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0 |
3e880be8 | 220 | %endif |
3bde88e0 | 221 | chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so |
c9753b19 | 222 | %endif |
835882e7 | 223 | |
b19cfcd2 | 224 | # these links are *needed* (by stuff in bin/) |
835882e7 | 225 | for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do |
c9753b19 ER |
226 | if [ -L $f ]; then |
227 | l=$(readlink $f) | |
228 | a=${l##*/} | |
229 | d=${l%/*} | |
230 | case "$d" in | |
231 | %{_bindir}) | |
232 | ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/} | |
233 | rm -f $f | |
234 | ;; | |
235 | $a) | |
236 | mv -f $f $RPM_BUILD_ROOT%{_bindir} | |
237 | ;; | |
238 | *) | |
239 | exit 1 | |
240 | ;; | |
241 | esac | |
242 | else | |
243 | a=${f#*/%{_target_cpu}-uclibc-} | |
244 | ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a | |
245 | mv -f $f $RPM_BUILD_ROOT%{_bindir} | |
246 | fi | |
30b1dd68 | 247 | done |
70879d06 | 248 | |
c9753b19 ER |
249 | for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do |
250 | if [ -L $f ]; then | |
251 | l=$(readlink $f) | |
252 | case "${l%/*}" in | |
253 | %{uclibc_root}/bin) | |
254 | a=${l#*/%{_target_cpu}-uclibc-} | |
255 | ln -sf %{_bindir}/$a $f | |
256 | ;; | |
257 | %{_bindir}) | |
258 | : | |
259 | ;; | |
260 | *) | |
261 | exit 2 | |
262 | ;; | |
263 | esac | |
264 | fi | |
f7ae07ef PS |
265 | done |
266 | ||
21a16074 AM |
267 | # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u |
268 | for dir in asm asm-generic linux mtd rdma sound video xen; do | |
269 | ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir} | |
270 | done | |
3c259173 | 271 | |
70879d06 | 272 | %clean |
273 | rm -rf $RPM_BUILD_ROOT | |
274 | ||
70879d06 | 275 | %files |
276 | %defattr(644,root,root,755) | |
835882e7 JB |
277 | %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO |
278 | %dir %{uclibc_root} | |
f230b68a | 279 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
c9753b19 | 280 | %if %{with shared} |
835882e7 JB |
281 | %dir %{uclibc_root}/lib |
282 | %attr(755,root,root) %{uclibc_root}/lib/*.so* | |
9a46e67b | 283 | %endif |
c9753b19 | 284 | %endif |
70879d06 | 285 | |
3698d221 | 286 | %files devel |
70879d06 | 287 | %defattr(644,root,root,755) |
835882e7 | 288 | %doc docs/*.txt |
3bde88e0 ER |
289 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line |
290 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar | |
291 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as | |
292 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++ | |
293 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc | |
294 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp | |
295 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++ | |
3bde88e0 ER |
296 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc |
297 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld | |
298 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm | |
299 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy | |
300 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump | |
301 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib | |
302 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size | |
303 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings | |
304 | %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip | |
835882e7 JB |
305 | %{uclibc_root}/usr/lib/*.o |
306 | %dir %{uclibc_root}/usr | |
307 | %dir %{uclibc_root}/usr/bin | |
3bde88e0 ER |
308 | %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line |
309 | %attr(755,root,root) %{uclibc_root}/usr/bin/ar | |
310 | %attr(755,root,root) %{uclibc_root}/usr/bin/as | |
311 | %attr(755,root,root) %{uclibc_root}/usr/bin/c++ | |
312 | %attr(755,root,root) %{uclibc_root}/usr/bin/cc | |
313 | %attr(755,root,root) %{uclibc_root}/usr/bin/cpp | |
314 | %attr(755,root,root) %{uclibc_root}/usr/bin/g++ | |
3bde88e0 ER |
315 | %attr(755,root,root) %{uclibc_root}/usr/bin/gcc |
316 | %attr(755,root,root) %{uclibc_root}/usr/bin/ld | |
317 | %attr(755,root,root) %{uclibc_root}/usr/bin/nm | |
318 | %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy | |
319 | %attr(755,root,root) %{uclibc_root}/usr/bin/objdump | |
320 | %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib | |
321 | %attr(755,root,root) %{uclibc_root}/usr/bin/size | |
322 | %attr(755,root,root) %{uclibc_root}/usr/bin/strings | |
323 | %attr(755,root,root) %{uclibc_root}/usr/bin/strip | |
835882e7 | 324 | %dir %{uclibc_root}/usr/lib |
c9753b19 | 325 | %if %{with shared} |
835882e7 | 326 | %{uclibc_root}/usr/lib/uclibc_nonshared.a |
f230b68a | 327 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
835882e7 | 328 | %attr(755,root,root) %{uclibc_root}/usr/lib/*.so |
1a8228b3 | 329 | %endif |
c9753b19 | 330 | %endif |
835882e7 | 331 | %{uclibc_root}/usr/include |
3698d221 | 332 | |
333 | %files static | |
98274bf4 | 334 | %defattr(644,root,root,755) |
835882e7 | 335 | %{uclibc_root}/usr/lib/lib*.a |