/[packages]/cauldron/compat-cuda-gcc9/current/SPECS/compat-cuda-gcc9.spec
ViewVC logotype

Contents of /cauldron/compat-cuda-gcc9/current/SPECS/compat-cuda-gcc9.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1629460 - (show annotations) (download)
Tue Sep 22 17:04:04 2020 UTC (4 years, 9 months ago) by ghibo
File size: 8049 byte(s)
Update to snapshot 9-20200918
1 %define gcc_target_platform %{_target_platform}
2 %define gcc_major_version 9
3
4 %define branch 9
5 %define ver 9.3.0
6 %define rel 15
7
8 %define build_check 1
9
10 %{expand: %{?_without_check: %%global build_check 0}}
11
12 # versioned libstdcxx_includedir
13 %define libstdcxx_includedir %{target_cpu}-%{_real_vendor}-linux%{gnuext}/include/c++/%{branch}
14
15 # There are currently 3 alternative ways of getting the sources:
16 #
17 # 1) use the snapshot version from https://gcc.gnu.org/pub/gcc/snapshots/ (and set bcond_without use_snapshot below)
18 # 2) use the git version (obtained from the script %%SOURCE1)
19 # 3) use standard release plus patches
20
21 # with=do not use snapshot, without=use snapshot
22 %bcond_without use_snapshot
23
24 # with=do not use git version, without=use git version
25 %bcond_with use_git
26
27 # with=do not use git patch against standard release, without=use git patch against standard release
28 %bcond_with use_git_patch
29
30 #
31 # define the snapshot version to use from from https://gcc.gnu.org/pub/gcc/snapshots/
32 %define snapshot 20200918
33
34 #
35 # define the git date and hash to use current patch from release to git with %%{SOURCE1} script
36 %define gitpatch_date 20200806
37 %define gitpatch_hash 5226c9f5b0f
38
39 %if %{with use_snapshot}
40 %define source_package gcc-%{branch}-%{snapshot}
41 %define source_dir gcc-%{branch}-%{snapshot}
42 %else
43 %define source_package gcc-%{version}
44 %define source_dir gcc-%{version}
45 %endif
46
47 Summary: Compatible GNU Compiler Collection v9.x
48 Name: compat-cuda-gcc9
49 Version: %{ver}
50 %if %{with use_snapshot}
51 Release: %mkrel %rel.%{snapshot}
52 %else
53 %if %{with use_git}
54 Release: %mkrel %rel.%{gitdate}.git
55 %else
56 %if %{with use_patch}
57 Release: %mkrel %rel.%{gitpatch_date}.gitpatch
58 %else
59 Release: %mkrel %rel
60 %endif
61 %endif
62 %endif
63 License: GPLv3+
64 Group: Development/C
65 URL: https://gcc.gnu.org/
66 %if %{with use_snapshot}
67 Source0: https://gcc.gnu.org/pub/gcc/snapshots/%{branch}-%{snapshot}/gcc-%{branch}-%{snapshot}.tar.xz
68 %else
69 %if %{with use_git}
70 # current git version (get with %%SOURCE1 script)
71 Source: gcc-%{version}-%{gitdate}.git.%{githash}.tar.xz
72 %else
73 # standard release source
74 Source0: https://ftpmirror.gnu.org/gcc/gcc-%{version}/gcc-%{version}.tar.xz
75 %endif
76 %endif
77 # script for getting the current git version or diff from a tagged release
78 Source1: gcc-%{branch}-get-from-git.sh
79
80 # Patches
81 #
82 # From git://gcc.gnu.org/git/gcc.git
83 #
84 # upstream gcc-9 branch, numbered from 1
85 %if %{with use_gitpatch}
86 Patch1: gcc-%{version}-%{gitpatch_date}.git.%{gitpatch_hash}.patch
87 %endif
88
89 # upstream master branch, numbered from 101
90
91 # Mageia patches, numbered from 201
92 #
93 # build 32 bits code when running through linux32
94 Patch201: gcc-9.2-linux32.patch
95 # slibdir is either /lib or /lib64
96 Patch202: gcc-9.2-pass-slibdir.patch
97 # pass libdir around
98 Patch203: gcc-9.2-multi-do-libdir.patch
99 #
100 # Fedora patches, numbered from 501
101
102 %define binutils_version 1:2.33.1-1
103
104 BuildRequires: python3
105 Requires: binutils >= %{binutils_version}
106 BuildRequires: binutils >= %{binutils_version}
107
108 BuildRequires: gcc >= 8.3.0-1
109 # c++ is mandatory to build gcc
110 BuildRequires: gcc-c++ >= 8.3.0-1
111 # make sure gdb will understand DW_FORM_strp
112 Conflicts: gdb < 5.1.1
113 BuildRequires: chrpath
114 BuildRequires: zlib-devel
115
116 # isl is used for Graphite support (optimizations)
117 # see http://gcc.gnu.org/wiki/Graphite
118 BuildRequires: isl-devel >= 0.14
119 # needed for lto support
120 BuildRequires: elfutils-devel
121
122 BuildRequires: gettext
123 BuildRequires: flex
124 BuildRequires: bison
125 BuildRequires: texinfo >= 4.1
126 BuildRequires: texinfo-tex
127 # needs a GNU awk recent enough to correctly generate options.h
128 BuildRequires: gawk >= 3.1.4
129 Requires: glibc-devel >= 2.4-1
130 BuildRequires: glibc-devel >= 2.4-1
131 # for make check
132 %if %{build_check}
133 BuildRequires: glibc-static-devel
134 BuildRequires: autogen
135 BuildRequires: dejagnu
136 BuildRequires: pkgconfig(libzstd)
137 BuildRequires: sharutils
138 BuildRequires: systemtap
139 %endif
140 #
141 BuildRequires: gmp-devel
142 BuildRequires: pkgconfig(mpfr)
143 BuildRequires: libmpc-devel
144
145 AutoReq: false
146 AutoProv: false
147
148 ExclusiveArch: %{ix86} x86_64
149
150 %description
151 A compiler aimed at integrating all the optimizations and features
152 necessary for a high-performance and stable development environment.
153 This package is required for all other GCC compilers, namely C++,
154 Fortran 95.
155
156 This is a special gcc version for compatibility with cuda 10 and 11.
157
158 %prep
159 %setup -q -n %{source_dir}
160 %autopatch -p1
161
162 %build
163 %define python_dir %(echo "%{python3_sitelib}" | sed 's!^%{_prefix}!!g')
164
165 # Prepare OPT_FLAGS
166 OPT_FLAGS=$(echo %{optflags} | sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-mcpu=pentiumpro//g')
167 # "-Wformat -Werror=format-security" from the above flags causes some fail
168 # in "libcpp/macro.c:164:23: error: format not a string literal". Drop for now. To be reviewed.
169 OPT_FLAGS=$(echo $OPT_FLAGS | sed -e 's/-Wformat//g' -e 's/-Werror=format-security//g')
170
171 # Simpler flags: "-O2 -g -pipe" for now.
172 #OPT_FLAGS="-O2 -g -pipe"
173
174 # don't build crt files with -fasynchronous-unwind-tables
175 case " $OPT_FLAGS " in
176 *" -fasynchronous-unwind-tables "*)
177 perl -pi -e 's/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables /' gcc/Makefile.in
178 ;;
179 esac
180
181 # Force a seperate object dir
182 rm -rf obj-%{gcc_target_platform}
183 mkdir obj-%{gcc_target_platform}
184 cd obj-%{gcc_target_platform}
185
186 LANGUAGES="c,c++,fortran,lto"
187 LANGUAGES="c,c++,lto"
188 LIBSTDCXX_FLAGS="--enable-long-long --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu"
189 #LIBSTDCXX_FLAGS="$LIBSTDCXX_FLAGS --with-gxx-include-dir=%{libstdcxx_includedir}"
190 SSP_FLAGS="--enable-ssp --disable-libssp"
191 ISL_FLAGS="--with-isl"
192 LIBFFI_FLAGS="--disable-libffi"
193 LIBC_FLAGS="--enable-threads=posix --with-linker-hash-style=gnu --enable-shared"
194 # target specific flags
195 #CROSS_FLAGS="--target=%{gcc_target_platform}"
196 TARGET_FLAGS="--with-cpu=generic"
197 #PROGRAM_SUFFIX="--program-suffix=-%{gcc_major_version}"
198
199 CC="%{__cc}" \
200 CFLAGS="$OPT_FLAGS" \
201 CXXFLAGS="$OPT_FLAGS" \
202 XCFLAGS="$OPT_FLAGS" \
203 TCFLAGS="$OPT_FLAGS" \
204 ../configure \
205 --prefix=%{_prefix}/lib/%{name} \
206 --libexecdir=%{_prefix}/lib/%{name}/lib \
207 --with-slibdir=/%{_lib} \
208 --with-pkgversion="Mageia %{version}-%{release}" \
209 --with-bugurl=https://bugs.mageia.org/ \
210 --enable-checking=release \
211 --enable-languages="$LANGUAGES" \
212 --enable-linker-build-id \
213 --build=%{_target_platform} \
214 --host=%{_target_platform} \
215 $CROSS_FLAGS \
216 $TARGET_FLAGS \
217 $PROGRAM_SUFFIX \
218 $LIBC_FLAGS \
219 $LIBOBJC_FLAGS \
220 $LIBSTDCXX_FLAGS \
221 $SSP_FLAGS \
222 $ISL_FLAGS \
223 $LIBFFI_FLAGS \
224 $LIBGOMP_FLAGS \
225 $QUADMATH_FLAGS \
226 --with-system-zlib \
227 --disable-werror \
228 --with-python-dir=%{python_dir} \
229 --enable-lto \
230 --with-gcc-major-version-only
231 touch ../gcc/c-gperf.h
232 tick=$SECONDS
233 %make_build
234 tock=$SECONDS
235 elapsed=$(( $tock - $tick ))
236 echo "Compilation time duration: $elapsed seconds"
237 cd ..
238
239 %check
240 %if %{build_check}
241 echo =================== BEGIN TESTING ==================
242 pushd obj-%{gcc_target_platform}
243 tick=$SECONDS
244 export LC_ALL=C
245 # hack to let gcc-ar finding the liblto_plugin.so (to be reviewed)
246 install -m 755 -d ./gcc/../lib/gcc/%{gcc_target_platform}/%{gcc_major_version}
247 cp -p ./gcc/liblto_plugin.* ./gcc/../lib/gcc/%{gcc_target_platform}/%{gcc_major_version}/
248 %make_build -k check ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ || true
249 tock=$SECONDS
250 elapsed=$(( $tock - $tick ))
251 echo "Testing time duration: $elapsed seconds"
252 ../contrib/test_summary > ../test_summary.log
253 popd
254 echo =================== END TESTING ====================
255 %endif
256
257 %install
258 pushd obj-%{gcc_target_platform}
259 %make_install
260 popd
261
262 # expose versioned links to bindir
263 install -m 755 -d %{buildroot}%{_bindir}
264
265 for i in \
266 cpp \
267 g++ \
268 gcc \
269 gcc-ar \
270 gcc-nm \
271 gcc-ranlib \
272 gfortran \
273 x86_64-mageia-linux-gnu-ar \
274 x86_64-mageia-linux-gnu-gcc \
275 x86_64-mageia-linux-gnu-nm \
276 x86_64-mageia-linux-gnu-ranlib \
277 x86_64-mageia-linux-gnu-fortran \
278 ; do
279 ln -sf %{_prefix}/lib/%{name}/bin/$i %{buildroot}%{_bindir}/$i-%{branch}
280 done
281
282 %files
283 %license gcc/COPYING
284 %doc gcc/*ChangeLog*
285 %if %{build_check}
286 %doc test_summary.log
287 %endif
288 %{_bindir}/*
289 %{_prefix}/lib/%{name}
290

  ViewVC Help
Powered by ViewVC 1.1.30