]> git.pld-linux.org Git - packages/crossnacl-gcc.git/blob - crossnacl-gcc.spec
2dd13fb7c4febe16b6b544d0997c5419a8139aab
[packages/crossnacl-gcc.git] / crossnacl-gcc.spec
1 #
2 # Conditional build:
3 %bcond_with     bootstrap               # build without NaCL newlib package dependency (without c++ package)
4
5 %define         gitver  3960379
6 Summary:        Various compilers (C, C++) for NaCl
7 Name:           crossnacl-gcc
8 Version:        4.4.3
9 Release:        13.git%{gitver}
10 License:        GPL v3+ and GPL v3+ with exceptions and GPL v2+ with exceptions
11 Group:          Development/Languages
12 Source0:        nacl-gcc-%{version}-git%{gitver}.tar.xz
13 # Source0-md5:  e72fed38d5b93e4505c1a05c69ab0796
14 Source1:        get-source.sh
15 Patch0:         gnu_inline-mismatch.patch
16 URL:            http://sourceware.org/gcc/
17 BuildRequires:  cloog-ppl-devel
18 BuildRequires:  crossnacl-binutils
19 BuildRequires:  elfutils-devel
20 BuildRequires:  gmp-c++-devel
21 BuildRequires:  gmp-devel
22 BuildRequires:  mpfr-devel
23 BuildRequires:  perl-tools-pod
24 BuildRequires:  tar >= 1:1.22
25 BuildRequires:  xz
26 BuildConflicts: cloog-isl-devel
27 %if %{without bootstrap}
28 BuildRequires:  crossnacl-newlib
29 %endif
30 ExclusiveArch:  %{ix86} %{x8664}
31 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32
33 %define         target          x86_64-nacl
34 %define         arch            %{_prefix}/%{target}
35 %define         gcc_ver         %{version}
36 %define         gcclib          %{_libdir}/gcc/%{target}/%{gcc_ver}
37 %define         gccnlib         %{_prefix}/lib/gcc/%{target}/%{gcc_ver}
38
39 %define         filterout_cpp   -D_FORTIFY_SOURCE=[0-9]+
40 %define         filterout_c             -Werror=format-security
41
42 %description
43 The gcc package contains the GNU Compiler Collection version 4.4.3.
44 You'll need this package in order to compile C code.
45
46 This provides support for NaCl targets.
47
48 %package c++
49 Summary:        C++ support for crossnacl-gcc
50 Summary(pl.UTF-8):      Obsługa C++ dla crossnacl-gcc
51 Group:          Development/Languages
52 Requires:       %{name} = %{version}-%{release}
53
54 %description c++
55 This package adds C++ support to the GNU Compiler Collection for NaCl
56 targets.
57
58 %description c++ -l pl.UTF-8
59 Ten pakiet dodaje obsługę C++ do kompilatora gcc dla NaCL.
60
61 %package objc
62 Summary:        NaCL binary utility development utilities - objc
63 Summary(pl.UTF-8):      Zestaw narzędzi NaCL - objc
64 Group:          Development/Languages
65 Requires:       %{name} = %{version}-%{release}
66
67 %description objc
68 This package contains cross targeted objc compiler.
69
70 %description objc -l pl.UTF-8
71 Ten pakiet zawiera kompilator objc generujący kod pod Win32.
72
73 %prep
74 %setup -q -n nacl-gcc-%{version}-git%{?gitver}
75 %patch0 -p1
76
77 %build
78 rm -rf obj-%{target}
79 install -d obj-%{target}
80 cd obj-%{target}
81
82 OPT_FLAGS="%{rpmcflags} -D_FILE_OFFSET_BITS=64 -fgnu89-inline"
83 OPT_FLAGS=$(echo "$OPT_FLAGS" | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
84 %ifarch %{ix86}
85 OPT_FLAGS=$(echo "$OPT_FLAGS" | sed -e 's/-march=i.86//g')
86 %endif
87 OPT_FLAGS=$(echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g')
88
89 case "$OPT_FLAGS" in
90 *-fasynchronous-unwind-tables*)
91         %{__sed} -i -e 's/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/' \
92         ../gcc/Makefile.in
93 ;;
94 esac
95
96 GCC_DEFINES="-Dinhibit_libc -D__gthr_posix_h"
97 ../configure \
98         --prefix=%{_prefix} \
99         --mandir=%{_mandir} \
100         --infodir=%{_infodir} \
101         --libexecdir=%{_libdir} \
102         --enable-checking=release \
103         --with-system-zlib \
104         --enable-__cxa_atexit \
105         --disable-libunwind-exceptions \
106         --enable-gnu-unique-object \
107         --disable-decimal-float \
108         --disable-libgomp \
109         --disable-libmudflap \
110         --disable-libssp \
111         --disable-libstdcxx-pch \
112         --disable-shared \
113         --with-ppl --with-cloog \
114         MAKEINFO=/bin/true \
115         CC="%{__cc}" \
116         CFLAGS="$OPT_FLAGS $GCC_DEFINES" \
117         CXXFLAGS="$(echo $OPT_FLAGS | sed 's/ -Wall / /g')" \
118         XCFLAGS="$OPT_FLAGS" \
119 %if %{with bootstrap}
120         --disable-threads \
121         --enable-languages="c" \
122         --without-headers \
123         CFLAGS_FOR_TARGET="-O2 -g" \
124         CXXFLAGS_FOR_TARGET="-O2 -g" \
125 %else
126         CFLAGS_FOR_TARGET="-O2 -g -mtls-use-call -I/usr/x86_64-nacl/include/" \
127         CXXFLAGS_FOR_TARGET="-O2 -g -mtls-use-call -I/usr/x86_64-nacl/include/" \
128         --enable-threads=nacl \
129         --enable-languages="c,c++,objc" \
130         --enable-tls \
131         --with-newlib \
132 %endif
133         --target=%{target} \
134         --with-host-libstdcxx="-lstdc++ -lm" \
135         --disable-ppl-version-check \
136         --disable-libgcj
137
138 %{__make} \
139         BOOT_CFLAGS="$OPT_FLAGS" \
140 %if %{with bootstrap}
141         all-gcc all-target-libgcc
142 %else
143         all
144 %endif
145
146 %install
147 rm -rf $RPM_BUILD_ROOT
148 cd obj-%{target}
149 %{__make} \
150 %if %{with bootstrap}
151         install-gcc install-target-libgcc \
152 %else
153         install \
154 %endif
155         DESTDIR=$RPM_BUILD_ROOT
156
157 # move fixed includes to proper place
158 mv $RPM_BUILD_ROOT%{gccnlib}/include-fixed/*.h $RPM_BUILD_ROOT%{gccnlib}/include
159
160 %{__rm} -r $RPM_BUILD_ROOT%{gccnlib}/include-fixed
161 %{__rm} -r $RPM_BUILD_ROOT%{gccnlib}/install-tools
162
163 # Delete supplemental files that would conflict with the core toolchain
164 %{__rm} -r $RPM_BUILD_ROOT%{_infodir}
165 %{__rm} -r $RPM_BUILD_ROOT%{_mandir}/man7
166 # I suspect that the core toolchain locale files will work with this reasonably well.
167 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}
168
169 # Don't dupe the system libiberty.a
170 %if %{without bootstrap}
171 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libiberty.a
172 %{__rm} $RPM_BUILD_ROOT%{_prefix}/%{target}/lib*/libiberty.a
173 %endif
174
175 %clean
176 rm -rf $RPM_BUILD_ROOT
177
178 %files
179 %defattr(644,root,root,755)
180 %doc gcc/README*
181 %attr(755,root,root) %{_bindir}/%{target}-cpp
182 %attr(755,root,root) %{_bindir}/%{target}-gcc
183 %attr(755,root,root) %{_bindir}/%{target}-gcc-%{gcc_ver}
184 %attr(755,root,root) %{_bindir}/%{target}-gccbug
185 %attr(755,root,root) %{_bindir}/%{target}-gcov
186
187 %if "%{_lib}" != "lib"
188 %dir %{_prefix}/lib/gcc
189 %dir %{_prefix}/lib/gcc/%{target}
190 %dir %{gccnlib}
191 %endif
192
193 %{gccnlib}/*.[ao]
194 %dir %{gccnlib}/include
195 %{gccnlib}/include/*.h
196
197 %dir %{gccnlib}/32
198 %{gccnlib}/32/*.[oa]
199
200 %dir %{_libexecdir}/gcc/%{target}
201 %dir %{gcclib}
202 %attr(755,root,root) %{gcclib}/cc1
203 %attr(755,root,root) %{gcclib}/collect2
204
205 %if "%{_lib}" != "lib"
206 # not present on ix86, not needed?
207 %dir %{gcclib}/install-tools
208 %attr(755,root,root) %{gcclib}/install-tools/*
209 %endif
210
211 %{_mandir}/man1/%{target}-cpp.*
212 %{_mandir}/man1/%{target}-gcc.*
213 %{_mandir}/man1/%{target}-gcov.*
214
215 %if %{without bootstrap}
216 %files c++
217 %defattr(644,root,root,755)
218 %attr(755,root,root) %{_bindir}/%{target}-c++
219 %attr(755,root,root) %{_bindir}/%{target}-g++
220 %attr(755,root,root) %{gcclib}/cc1plus
221 %{_prefix}/%{target}/include/c++
222 %dir %{_prefix}/%{target}/lib32
223 %dir %{_prefix}/%{target}/lib64
224 %{_prefix}/%{target}/lib*/libstdc++.*a
225 %{_prefix}/%{target}/lib*/libsupc++.*a
226 %{_mandir}/man1/%{target}-g++.*
227
228 %files objc
229 %defattr(644,root,root,755)
230 %attr(755,root,root) %{gcclib}/cc1obj
231 %{_prefix}/%{target}/lib*/libobjc.*a
232 %{gccnlib}/include/objc
233 %endif
This page took 0.056933 seconds and 2 git commands to generate.