3 Summary: C library intended for use on embedded systems
6 Release: 0.git%{gitver}.%{rel}
7 License: BSD and MIT and LGPL v2+
9 Source0: nacl-newlib-%{version}-git%{gitver}.tar.xz
10 # Source0-md5: 2e8b05e7ebe9eefa3e0d3f6d0ab23a1e
11 Source1: nacl-headers-33.0.1750.117.tar.xz
12 # Source1-md5: 26f4e73044f01cbe0b89bec7fa4deea1
13 Source2: newlib-libc-script
15 Source4: get-source.sh
16 URL: http://sourceware.org/newlib/
17 BuildRequires: crossnacl-binutils
18 BuildRequires: crossnacl-gcc
20 BuildRequires: python-modules
21 BuildRequires: tar >= 1:1.22
23 ExclusiveArch: %{ix86} %{x8664}
24 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
26 %define target x86_64-nacl
29 Newlib is a C library intended for use on embedded systems. It is a
30 conglomeration of several library parts, all under free software
31 licenses that make them easily usable on embedded products.
33 This is the NaCl fork.
36 %setup -q -n nacl-newlib-%{version}-git%{?gitver}
37 tar -xvf %{SOURCE1} -C newlib/libc/sys/nacl --strip-components=1
43 export NEWLIB_CFLAGS="-O2 -D_I386MACH_ALLOW_HW_INTERRUPTS -DSIGNAL_PROVIDED -mtls-use-call"
46 --enable-newlib-iconv \
47 --enable-newlib-io-long-long \
48 --enable-newlib-io-long-double \
49 --enable-newlib-io-c99-formats \
51 libc_cv_initfinit_array=yes \
53 CFLAGS_FOR_TARGET="$NEWLIB_CFLAGS" \
54 CXXFLAGS_FOR_TARGET="$NEWLIB_CFLAGS" \
61 rm -rf $RPM_BUILD_ROOT
63 DESTDIR=$RPM_BUILD_ROOT
65 # Conflicts with binutils
66 %{__rm} -r $RPM_BUILD_ROOT%{_infodir}
68 # The default pthread.h doesn't work right?
69 %{__rm} $RPM_BUILD_ROOT%{_prefix}/%{target}/include/pthread.h
70 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_prefix}/%{target}/include
72 # We have to hack up libc.a to get things working.
74 mv $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libc.a $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libcrt_common.a
75 sed "s/@OBJFORMAT@/elf32-nacl/" newlib-libc-script > $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libc.a
78 mv $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libc.a $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libcrt_common.a
79 sed "s/@OBJFORMAT@/elf64-nacl/" newlib-libc-script > $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libc.a
81 # move to match -m32 -lm search path gcc uses: /usr/x86_64-nacl/lib32/libm.a
82 install -d $RPM_BUILD_ROOT%{_prefix}/%{target}/lib32
83 mv $RPM_BUILD_ROOT%{_prefix}/%{target}/{lib/32/*,lib32}
84 rmdir $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32
86 # fix copies to be hardlinks (maybe should symlink in the future)
87 findup -m $RPM_BUILD_ROOT
90 rm -rf $RPM_BUILD_ROOT
93 %defattr(644,root,root,755)
94 %{_datadir}/iconv_data
95 %{_prefix}/%{target}/include
96 %{_prefix}/%{target}/lib
97 %dir %{_prefix}/%{target}/lib32
98 %{_prefix}/%{target}/lib32/lib*.a
99 %{_prefix}/%{target}/lib32/crt*.o