diff --git a/gnulib.spec b/gnulib.spec index ba5e7fc5a0ea04f6e478bd9548597809b75808f4..79c90674df8d2063b6e6e672787b0424283284b3 100644 --- a/gnulib.spec +++ b/gnulib.spec @@ -1,6 +1,6 @@ Name: gnulib Version: 0 -Release: 28.20180720git +Release: 29.20180720git Summary: The GNU Portability Library License: Public Domain and BSD and GPLv2+ and GPLv3 and GPLv3+ and LGPLv2 and LGPLv2+ and LGPLv3+ URL: https://www.gnu.org/software/gnulib @@ -50,6 +50,13 @@ rm lib/javaversion.class ./gnulib-tool --create-testdir --dir=build-gnulib-root git-merge-changelog %build +#获取当前max cpu个数,合理使用资源先,由于此次比赛时间紧迫,且没有时间进行验证,暂且只保证编译通过。 +ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN) +max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 )) +if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then + ncpus="$max_cpus" +fi + cd build-gnulib-root %configure --prefix=%_prefix %make_build @@ -69,9 +76,11 @@ sed -i "/^[ ]*gnulib_dir=/s#\`[^\`]*\`#%{_datadir}/gnulib#" gnulib-tool rm -rf */.cvsignore */.gitignore */.gitattributes lib/.cppi-disable lib/uniname/gen-uninames.lisp %check -make -C build-tests check VERBOSE=1 +make -j"$ncpus" -C build-tests check VERBOSE=1 %install +#开启OpenMP线程核绑定,由于此次比赛时间紧迫,且没有时间进行验证,暂且只保证编译通过。 +export OMP_PROC_BIND=true install -d %{buildroot}%{_datadir}/gnulib install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_datadir}/info @@ -87,7 +96,7 @@ cp -arv doc/relocatable.texi %{buildroot}%{_datadir}/gnulib/doc cp -p doc/gnulib.info %{buildroot}%{_datadir}/info/ cp -p doc/gnulib.html MODULES.html NEWS COPYING ChangeLog users.txt doc/COPYING* %{buildroot}%{_docdir}/gnulib/ -%make_install -C build-gnulib-root +%make_install -j16 -C build-gnulib-root help2man -N --no-discard-stderr %{buildroot}%{_bindir}/git-merge-changelog | gzip -9c > %{buildroot}%{_mandir}/man1/git-merge-changelog.1.gz %post help