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