]>
Commit | Line | Data |
---|---|---|
c9753b19 | 1 | # |
66f4e461 AM |
2 | # TODO: |
3 | # - add filtering out -Wl,-z,-combreloc in gcc wrapper | |
4 | # (causes linking to be done against glibc instead of uclibc) | |
6a930af4 AM |
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 ... | |
66f4e461 | 8 | # |
c9753b19 ER |
9 | # Conditional build: |
10 | %bcond_without shared # don't build shared lib support | |
3bde88e0 ER |
11 | %bcond_with verbose # verbose mode |
12 | # | |
13 | %ifarch alpha | |
14 | %undefine with_shared | |
15 | %endif | |
c9753b19 | 16 | # |
70879d06 | 17 | Summary: C library optimized for size |
2a309db2 | 18 | Summary(pl.UTF-8): Biblioteka C zoptymalizowana na rozmiar |
70879d06 | 19 | Name: uClibc |
970f30eb | 20 | Version: 0.9.30 |
6a930af4 | 21 | Release: 3.1 |
95116193 | 22 | Epoch: 2 |
1e0be70f | 23 | License: LGPL v2.1 |
3698d221 | 24 | Group: Libraries |
25 | Source0: http://uclibc.org/downloads/%{name}-%{version}.tar.bz2 | |
970f30eb | 26 | # Source0-md5: e5766e2566e0297adebebbcc0aba1f2d |
eacf49ba | 27 | Patch0: %{name}-newsoname.patch |
835882e7 JB |
28 | Patch1: %{name}-toolchain-wrapper.patch |
29 | Patch2: %{name}-targetcpu.patch | |
21f5f0fd | 30 | Patch3: %{name}-debug.patch |
4ae50705 JB |
31 | Patch4: %{name}-stdio-unhide.patch |
32 | Patch5: %{name}-sparc.patch | |
970f30eb | 33 | Patch6: %{name}-headers.patch |
3698d221 | 34 | URL: http://uclibc.org/ |
cd27c03b | 35 | BuildRequires: binutils-gasp |
c9753b19 | 36 | BuildRequires: cpp |
cd27c03b | 37 | BuildRequires: gcc >= 5:3.0 |
0e912c1e | 38 | BuildRequires: linux-libc-headers >= 7:2.6.24 |
91b0210c | 39 | BuildRequires: sed >= 4.0 |
d49d5dcf | 40 | BuildRequires: which |
f230b68a | 41 | ExclusiveArch: alpha %{ix86} ppc sparc sparcv9 %{x8664} |
70879d06 | 42 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
70879d06 | 43 | |
8e0ba786 ER |
44 | %define specflags -fgnu89-inline |
45 | ||
835882e7 | 46 | %define uclibc_root /usr/%{_target_cpu}-linux-uclibc |
1f16f3bd | 47 | |
70879d06 | 48 | %description |
49 | Small libc for building embedded applications. | |
50 | ||
adb3d9c8 JR |
51 | %description -l pl.UTF-8 |
52 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 53 | |
3698d221 | 54 | %package devel |
70879d06 | 55 | Summary: Development files for uClibc |
2a309db2 | 56 | Summary(pl.UTF-8): Pliki dla programistów uClibc |
70879d06 | 57 | Group: Development/Libraries |
2af21321 | 58 | Requires: %{name} = %{epoch}:%{version}-%{release} |
66ea2345 | 59 | Requires: binutils-gasp |
0e912c1e | 60 | Requires: linux-libc-headers >= 7:2.6.24 |
33f7e18e | 61 | %requires_eq gcc |
70879d06 | 62 | |
3698d221 | 63 | %description devel |
70879d06 | 64 | Small libc for building embedded applications. |
65 | ||
adb3d9c8 JR |
66 | %description devel -l pl.UTF-8 |
67 | Mała libc do budowania aplikacji wbudowanych. | |
056323ce | 68 | |
3698d221 | 69 | %package static |
8ff09ad0 | 70 | Summary: Static uClibc libraries |
2a309db2 | 71 | Summary(pl.UTF-8): Biblioteki statyczne uClibc |
70879d06 | 72 | Group: Development/Libraries |
2af21321 | 73 | Requires: %{name}-devel = %{epoch}:%{version}-%{release} |
15ba795d | 74 | Provides: libc-static |
70879d06 | 75 | |
3698d221 | 76 | %description static |
8ff09ad0 | 77 | Static uClibc libraries. |
70879d06 | 78 | |
adb3d9c8 | 79 | %description static -l pl.UTF-8 |
3698d221 | 80 | Biblioteki statyczne uClibc. |
056323ce | 81 | |
70879d06 | 82 | %prep |
8733b462 | 83 | %setup -q |
30b1dd68 JB |
84 | %patch0 -p1 |
85 | %patch1 -p1 | |
fdce39e0 | 86 | %patch2 -p1 |
21f5f0fd | 87 | %patch3 -p1 |
4ae50705 | 88 | %patch4 -p1 |
b7bca0b9 | 89 | # check if it's needed now... ldso is broken on sparc anyway |
4ae50705 | 90 | #%patch5 -p1 |
970f30eb | 91 | %patch6 -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" | |
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 | |
30b1dd68 | 154 | |
70879d06 | 155 | %build |
3bde88e0 | 156 | |
df6ea0eb | 157 | # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros |
cdd3fa1d | 158 | %{__make} -j1 defconfig \ |
3bde88e0 | 159 | %{?with_verbose:VERBOSE=1} \ |
30b1dd68 | 160 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 | 161 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ |
5d1a434a | 162 | HOSTCC="%{__cc}" \ |
30b1dd68 | 163 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb ER |
164 | CC="%{__cc}" \ |
165 | OPTIMIZATION="%{rpmcflags} -Os" | |
166 | ||
3bde88e0 ER |
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 | ||
cdd3fa1d | 173 | %{__make} -j1 \ |
3bde88e0 | 174 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 175 | TARGET_CPU="%{_target_cpu}" \ |
3bde88e0 ER |
176 | TARGET_ARCH=$target_arch \ |
177 | GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \ | |
cd27c03b | 178 | HOSTCC="%{__cc}" \ |
15afd9ab | 179 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ |
df6ea0eb ER |
180 | CC="%{__cc}" \ |
181 | OPTIMIZATION="%{rpmcflags} -Os" | |
70879d06 | 182 | |
183 | %install | |
184 | rm -rf $RPM_BUILD_ROOT | |
3698d221 | 185 | install -d $RPM_BUILD_ROOT%{_bindir} |
70879d06 | 186 | |
415dc192 | 187 | %{__make} -j1 install \ |
3bde88e0 | 188 | %{?with_verbose:VERBOSE=1} \ |
1ecf6a0b | 189 | TARGET_CPU="%{_target_cpu}" \ |
df6ea0eb ER |
190 | HOSTCC="%{__cc}" \ |
191 | HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \ | |
c95f6ae8 | 192 | CC="%{__cc}" \ |
df6ea0eb ER |
193 | OPTIMIZATION="%{rpmcflags} -Os" \ |
194 | DESTDIR=$RPM_BUILD_ROOT | |
70879d06 | 195 | |
c9753b19 | 196 | %if %{with shared} |
835882e7 | 197 | mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so |
3bde88e0 ER |
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 | |
c9753b19 | 200 | %endif |
835882e7 | 201 | |
b19cfcd2 | 202 | # these links are *needed* (by stuff in bin/) |
835882e7 | 203 | for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do |
c9753b19 ER |
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 | |
30b1dd68 | 225 | done |
70879d06 | 226 | |
c9753b19 ER |
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 | |
f7ae07ef PS |
243 | done |
244 | ||
835882e7 JB |
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 | |
f230b68a | 248 | # for future use |
e74b8a86 | 249 | %ifarch sparc64 |
835882e7 JB |
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 | |
485e7d55 | 252 | %endif |
835882e7 | 253 | ln -sf /usr/include/linux $RPM_BUILD_ROOT%{uclibc_root}/usr/include/linux |
3c259173 | 254 | |
70879d06 | 255 | %clean |
256 | rm -rf $RPM_BUILD_ROOT | |
257 | ||
70879d06 | 258 | %files |
259 | %defattr(644,root,root,755) | |
835882e7 JB |
260 | %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO |
261 | %dir %{uclibc_root} | |
f230b68a | 262 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
c9753b19 | 263 | %if %{with shared} |
835882e7 JB |
264 | %dir %{uclibc_root}/lib |
265 | %attr(755,root,root) %{uclibc_root}/lib/*.so* | |
9a46e67b | 266 | %endif |
c9753b19 | 267 | %endif |
70879d06 | 268 | |
3698d221 | 269 | %files devel |
70879d06 | 270 | %defattr(644,root,root,755) |
835882e7 | 271 | %doc docs/*.txt |
3bde88e0 ER |
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 | |
835882e7 JB |
289 | %{uclibc_root}/usr/lib/*.o |
290 | %dir %{uclibc_root}/usr | |
291 | %dir %{uclibc_root}/usr/bin | |
3bde88e0 ER |
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 | |
835882e7 | 309 | %dir %{uclibc_root}/usr/lib |
c9753b19 | 310 | %if %{with shared} |
835882e7 | 311 | %{uclibc_root}/usr/lib/uclibc_nonshared.a |
f230b68a | 312 | %ifarch %{ix86} %{x8664} ppc sparc sparcv9 |
835882e7 | 313 | %attr(755,root,root) %{uclibc_root}/usr/lib/*.so |
1a8228b3 | 314 | %endif |
c9753b19 | 315 | %endif |
835882e7 | 316 | %{uclibc_root}/usr/include |
3698d221 | 317 | |
318 | %files static | |
98274bf4 | 319 | %defattr(644,root,root,755) |
835882e7 | 320 | %{uclibc_root}/usr/lib/lib*.a |