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