2 Summary: C library intended for use on embedded systems
5 Release: 5.git%{gitver}
6 License: BSD and MIT and LGPL v2+
8 Source0: nacl-newlib-%{version}-git%{gitver}.tar.xz
9 # Source0-md5: 18a0d0c7058903c35f2ef5f140fd53dc
10 Source1: nacl-headers-27.0.1453.93.tar.xz
11 # Source1-md5: 1718b8b1fb5f5354002469413352c679
12 Source2: newlib-libc-script
14 Source4: get-source.sh
15 URL: http://sourceware.org/newlib/
16 BuildRequires: crossnacl-binutils
17 BuildRequires: crossnacl-gcc
19 BuildRequires: tar >= 1:1.22
21 ExclusiveArch: %{ix86} %{x8664}
22 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24 %define target x86_64-nacl
27 Newlib is a C library intended for use on embedded systems. It is a
28 conglomeration of several library parts, all under free software
29 licenses that make them easily usable on embedded products.
31 This is the NaCl fork.
34 %setup -q -n nacl-newlib-%{version}-git%{?gitver}
35 tar -xvf %{SOURCE1} -C newlib/libc/sys/nacl --strip-components=1
41 export NEWLIB_CFLAGS="-O2 -D_I386MACH_ALLOW_HW_INTERRUPTS -DSIGNAL_PROVIDED -mtls-use-call"
44 --enable-newlib-iconv \
45 --enable-newlib-io-long-long \
46 --enable-newlib-io-long-double \
47 --enable-newlib-io-c99-formats \
49 libc_cv_initfinit_array=yes \
51 CFLAGS_FOR_TARGET="$NEWLIB_CFLAGS" \
52 CXXFLAGS_FOR_TARGET="$NEWLIB_CFLAGS" \
59 rm -rf $RPM_BUILD_ROOT
61 DESTDIR=$RPM_BUILD_ROOT
63 # Conflicts with binutils
64 %{__rm} -r $RPM_BUILD_ROOT%{_infodir}
66 # The default pthread.h doesn't work right?
67 %{__rm} $RPM_BUILD_ROOT%{_prefix}/%{target}/include/pthread.h
68 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_prefix}/%{target}/include
70 # We have to hack up libc.a to get things working.
72 mv $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libc.a $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libcrt_common.a
73 sed "s/@OBJFORMAT@/elf32-nacl/" newlib-libc-script > $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libc.a
76 mv $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libc.a $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libcrt_common.a
77 sed "s/@OBJFORMAT@/elf64-nacl/" newlib-libc-script > $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libc.a
79 # move to match -m32 -lm search path gcc uses: /usr/x86_64-nacl/lib32/libm.a
80 install -d $RPM_BUILD_ROOT%{_prefix}/%{target}/lib32
81 mv $RPM_BUILD_ROOT%{_prefix}/%{target}/{lib/32/*,lib32}
82 rmdir $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32
84 # fix copies to be hardlinks (maybe should symlink in the future)
85 findup -m $RPM_BUILD_ROOT
88 rm -rf $RPM_BUILD_ROOT
91 %defattr(644,root,root,755)
92 %{_datadir}/iconv_data
93 %{_prefix}/%{target}/include
94 %{_prefix}/%{target}/lib
95 %dir %{_prefix}/%{target}/lib32
96 %{_prefix}/%{target}/lib32/lib*.a
97 %{_prefix}/%{target}/lib32/crt*.o