commit:     f457d5639ad562f52d697a2b33a7474a8c76d0a2
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 28 09:06:45 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Wed Oct 28 09:06:56 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=f457d563

sci-chemistry/ambertools: Fix for gcc-5 and format-security

Package-Manager: portage-2.2.23
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>

 sci-chemistry/ambertools/ambertools-12_p38.ebuild  |  16 ++--
 .../files/ambertools-12_p38-format-security.patch  | 100 +++++++++++++++++++++
 .../ambertools/files/ambertools-12_p38-gcc5.patch  |  28 ++++++
 3 files changed, 136 insertions(+), 8 deletions(-)

diff --git a/sci-chemistry/ambertools/ambertools-12_p38.ebuild 
b/sci-chemistry/ambertools/ambertools-12_p38.ebuild
index 812bbdb..1c907c4 100644
--- a/sci-chemistry/ambertools/ambertools-12_p38.ebuild
+++ b/sci-chemistry/ambertools/ambertools-12_p38.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
 EAPI=5
 
-inherit eutils fortran-2 multilib toolchain-funcs
+inherit eutils fortran-2 multilib multiprocessing toolchain-funcs
 
 DESCRIPTION="A suite for carrying out complete molecular mechanics 
investigations"
 HOMEPAGE="http://ambermd.org/#AmberTools";
@@ -54,6 +54,8 @@ pkg_setup() {
 
 src_prepare() {
        epatch \
+               "${FILESDIR}"/${P}-gcc5.patch \
+               "${FILESDIR}"/${P}-format-security.patch \
                "${FILESDIR}"/${PN}-12-gentoo.patch \
                "${WORKDIR}"/bugfixes/bugfix.{14..38}
        cd "${S}"/AmberTools/src || die
@@ -69,9 +71,7 @@ src_prepare() {
                reduce \
                ucpp-1.3 \
                || die
-}
 
-src_configure() {
        cd "${S}"/AmberTools/src || die
        sed \
                -e "s:\\\\\$(LIBDIR)/arpack.a:-larpack:g" \
@@ -94,6 +94,9 @@ src_configure() {
                -e "s:arsecond_:arscnd_:g" \
                -i sff/time.c sff/sff.h sff/sff.c || die
 
+}
+
+src_configure() {
        local myconf="--no-updates"
 
        use X || myconf="${myconf} -noX11"
@@ -114,10 +117,7 @@ src_configure() {
 }
 
 src_test() {
-       # Get the number of physical cores
-       local ncpus=$(grep "^core id" /proc/cpuinfo | sort -u | wc -l)
-       # Limit number of OpenMP threads
-       use openmp && export OMP_NUM_THREADS=$((1+${ncpus}/2))
+       use openmp && export OMP_NUM_THREADS=$(makeopts_jobs)
 
        emake test
 }

diff --git 
a/sci-chemistry/ambertools/files/ambertools-12_p38-format-security.patch 
b/sci-chemistry/ambertools/files/ambertools-12_p38-format-security.patch
new file mode 100644
index 0000000..bb22a62
--- /dev/null
+++ b/sci-chemistry/ambertools/files/ambertools-12_p38-format-security.patch
@@ -0,0 +1,100 @@
+ AmberTools/src/mdgx/ChargeFit.c  | 4 ++--
+ AmberTools/src/nab/cgen.c        | 2 +-
+ AmberTools/src/nab/traceback.c   | 2 +-
+ AmberTools/src/ptraj/cluster.c   | 2 +-
+ AmberTools/src/ptraj/interface.c | 6 +++---
+ AmberTools/src/semantics/parse.c | 2 +-
+ 6 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/AmberTools/src/mdgx/ChargeFit.c b/AmberTools/src/mdgx/ChargeFit.c
+index fccf5d0..fe4afac 100644
+--- a/AmberTools/src/mdgx/ChargeFit.c
++++ b/AmberTools/src/mdgx/ChargeFit.c
+@@ -77,9 +77,9 @@ static void AssignGridTopologies(fset *myfit, prmtop *tp)
+   }
+   for (i = 0; i < myfit->ngrd; i++) {
+     if (myfit->tpname.map[i][0] == '\0') {
+-      sprintf(myfit->tpname.map[i], tp->source);
++      sprintf(myfit->tpname.map[i], "%s", tp->source);
+       if (myfit->eprule.map[i][0] == '\0' && tp->eprulesource[0] != '\0') {
+-      sprintf(myfit->eprule.map[i], tp->eprulesource);
++      sprintf(myfit->eprule.map[i], "%s", tp->eprulesource);
+       }
+     }
+   }
+diff --git a/AmberTools/src/nab/cgen.c b/AmberTools/src/nab/cgen.c
+index 6254d44..e206879 100644
+--- a/AmberTools/src/nab/cgen.c
++++ b/AmberTools/src/nab/cgen.c
+@@ -1642,7 +1642,7 @@ static   char    *CG_gentype( char *csp, NODE_T *npt )
+               strcpy( csp, tname );
+               csp += strlen( csp );
+       }else
+-              fprintf( cg_cfp, tname );
++              fprintf( cg_cfp, "%s", tname );
+       needspace = TRUE;
+       return( csp );
+ }
+diff --git a/AmberTools/src/nab/traceback.c b/AmberTools/src/nab/traceback.c
+index f916474..e376552 100644
+--- a/AmberTools/src/nab/traceback.c
++++ b/AmberTools/src/nab/traceback.c
+@@ -6,7 +6,7 @@
+ int   rt_errormsg( int fatal, char msg[] )
+ {
+ 
+-      fprintf( stderr, msg );
++      fprintf( stderr, "%s", msg );
+       if( fatal )
+               exit( 1 );
+       return(0);
+diff --git a/AmberTools/src/ptraj/cluster.c b/AmberTools/src/ptraj/cluster.c
+index 2cb60f0..5e0f33d 100644
+--- a/AmberTools/src/ptraj/cluster.c
++++ b/AmberTools/src/ptraj/cluster.c
+@@ -1240,7 +1240,7 @@ void ClusteringMergeNames(PtrajClustering* This, 
ClusterNode* MergeNodeA, Cluste
+   {
+     return;
+   }
+-  sprintf(Temp, ClusterB->Name);
++  sprintf(Temp, "%s", ClusterB->Name);
+   sprintf(ClusterB->Name, "(%s,%s)", ClusterA->Name, Temp);
+ 
+ }
+diff --git a/AmberTools/src/ptraj/interface.c 
b/AmberTools/src/ptraj/interface.c
+index 4087fa7..1ee4273 100644
+--- a/AmberTools/src/ptraj/interface.c
++++ b/AmberTools/src/ptraj/interface.c
+@@ -97,8 +97,8 @@ interface(interfaceMode mode, char *filename)
+ 
+     tokenlist = (Token *) &rdparmTokenlist;
+ 
+-    fprintf(stdout, rdparm_header);
+-    fprintf(stdout, rdparm_prompt);
++    fprintf(stdout, "%s", rdparm_header);
++    fprintf(stdout, "%s", rdparm_prompt);
+     while (1) {
+ 
+       fflush(stdout);
+@@ -112,7 +112,7 @@ interface(interfaceMode mode, char *filename)
+ 
+       }
+     
+-      fprintf(stdout, rdparm_prompt);
++      fprintf(stdout, "%s", rdparm_prompt);
+     }
+   }
+ }
+diff --git a/AmberTools/src/semantics/parse.c 
b/AmberTools/src/semantics/parse.c
+index 55c724c..68f23da 100644
+--- a/AmberTools/src/semantics/parse.c
++++ b/AmberTools/src/semantics/parse.c
+@@ -2039,7 +2039,7 @@ int      n_tab;
+ DEF_T tab[];  
+ {
+ 
+-      fprintf( fp, oval );
++      fprintf( fp, "%s", oval );
+               
+ }
+ 

diff --git a/sci-chemistry/ambertools/files/ambertools-12_p38-gcc5.patch 
b/sci-chemistry/ambertools/files/ambertools-12_p38-gcc5.patch
new file mode 100644
index 0000000..92e6495
--- /dev/null
+++ b/sci-chemistry/ambertools/files/ambertools-12_p38-gcc5.patch
@@ -0,0 +1,28 @@
+ AmberTools/src/configure2 | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/AmberTools/src/configure2 b/AmberTools/src/configure2
+index 913c50d..1232f6a 100755
+--- a/AmberTools/src/configure2
++++ b/AmberTools/src/configure2
+@@ -703,12 +703,14 @@ gnu)
+     # if gcc <= 4.2, fftw3 is not compiled and pbsa fft solver and rism
+     #   are disabled
+     if [ "$rism" != 'no' -o -n "$pbsaflag" ]; then
+-        if ( [ $gnu_majorversion -ge 4 ] && [ $gnu_minorversion -le 2 ] ) \
+-            || [ $gnu_majorversion -le 3 ]; then
+-            echo "ERROR: RISM and PBSA FFT solver require version 4.3 or 
higher of the GNU compiler."
+-            echo "       Please re-run configure with the '-nofftw3' flag to 
use this compiler:"
+-            echo "            `mod_command_args '-rism' '-nofftw3'`"
+-            exit 1
++        if  [ $gnu_majorversion -lt 5 ]; then
++            if ( [ $gnu_majorversion -ge 4 ] && [ $gnu_minorversion -le 2 ] ) 
\
++                || [ $gnu_majorversion -le 3 ]; then
++                echo "ERROR: RISM and PBSA FFT solver require version 4.3 or 
higher of the GNU compiler."
++                echo "       Please re-run configure with the '-nofftw3' flag 
to use this compiler:"
++                echo "            `mod_command_args '-rism' '-nofftw3'`"
++                exit 1
++            fi
+         fi
+     fi
+ 

Reply via email to