From 38fabce2aabbf5a131b4ca056187bc5afe092983 Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Sat, 6 Jan 2018 19:03:54 +0100 Subject: Siesta: only apply patch to <4.1 and fix Intel compiler (#6466) * Siesta: add 3.2 and don't apply patch to 4.1 * siesta: fix bad optimization with Intel compiler * siesta: Fix download URL * siesta: build utilities too * siesta: fix binary name collision * siesta: Cleanup --- .../repos/builtin/packages/siesta/configure.patch | 34 +++++++++++++++++++++- var/spack/repos/builtin/packages/siesta/package.py | 30 +++++++++++++------ 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/var/spack/repos/builtin/packages/siesta/configure.patch b/var/spack/repos/builtin/packages/siesta/configure.patch index 8371c9e9bb..577c77f529 100644 --- a/var/spack/repos/builtin/packages/siesta/configure.patch +++ b/var/spack/repos/builtin/packages/siesta/configure.patch @@ -18,4 +18,36 @@ else NETCDF_LIBS="";tw_netcdf_ok=no;if test ! -z "$with_netcdf"; then { { echo "$as_me:$LINENO: error: Could not find NetCDF library." >&5 echo "$as_me: error: Could not find NetCDF library." >&2;} - +--- a/Util/TBTrans_rep/Makefile 2017-12-08 09:49:02.307877000 +0100 ++++ b/Util/TBTrans_rep/Makefile 2017-12-08 09:49:44.385288000 +0100 +@@ -14,7 +14,7 @@ + # Please see note about Linear-Algebra libraries below + # + +-default: what tbtrans ++default: what tbtrans_rep + + VPATH:=$(shell pwd)/../../Src + OBJDIR=Obj +@@ -91,16 +91,16 @@ + "ARCH_MAKE=../$(ARCH_MAKE)" \ + "INCFLAGS=$(LINALG_INCFLAGS)" "FFLAGS=$(FFLAGS:$(IPO_FLAG)=)" $(LINALG)) + +-tbtrans: FPPFLAGS+=$(DEFS_PREFIX) -DTBTRANS +-tbtrans: DEFS+=$(DEFS_PREFIX) -DTBTRANS +-tbtrans: $(MPI_INTERFACE) $(FDF) $(TBTOBJS) $(SYSOBJ) $(LINALG) +- $(FC) $(FFLAGS) $(LDFLAGS) -o tbtrans \ ++tbtrans_rep: FPPFLAGS+=$(DEFS_PREFIX) -DTBTRANS ++tbtrans_rep: DEFS+=$(DEFS_PREFIX) -DTBTRANS ++tbtrans_rep: $(MPI_INTERFACE) $(FDF) $(TBTOBJS) $(SYSOBJ) $(LINALG) ++ $(FC) $(FFLAGS) $(LDFLAGS) -o tbtrans_rep \ + $(TBTOBJS) $(MPI_INTERFACE) \ + $(FDF) $(LIBS) $(LINALG) || echo "***Please see top of Makefile" + + clean: + @echo "==> Cleaning object, library, and executable files" +- rm -f tbtrans *.o *.a *.mod ++ rm -f tbtrans_rep *.o *.a *.mod + rm -rf ./fdf + rm -rf ./MPI + rm -rf ./Libs diff --git a/var/spack/repos/builtin/packages/siesta/package.py b/var/spack/repos/builtin/packages/siesta/package.py index 536aac44b0..ffb8c12de1 100644 --- a/var/spack/repos/builtin/packages/siesta/package.py +++ b/var/spack/repos/builtin/packages/siesta/package.py @@ -24,6 +24,7 @@ ############################################################################## from spack import * +import os class Siesta(Package): @@ -31,11 +32,11 @@ class Siesta(Package): dynamics simulations of molecules and solids.""" homepage = "https://departments.icmab.es/leem/siesta/" - url = "https://launchpad.net/siesta/4.0/4.0.1/+download/siesta-4.0.1.tar.gz" - version('4.0.1', '5cb60ce068f2f6e84fa9184ffca94c08') + version('4.0.1', '5cb60ce068f2f6e84fa9184ffca94c08', url='https://launchpad.net/siesta/4.0/4.0.1/+download/siesta-4.0.1.tar.gz') + version('3.2-pl-5', '27a300c65eb2a25d107d910d26aaf81a', url='http://departments.icmab.es/leem/siesta/CodeAccess/Code/siesta-3.2-pl-5.tgz') - patch('configure.patch') + patch('configure.patch', when='@:4.0') depends_on('mpi') depends_on('blas') @@ -63,18 +64,24 @@ class Siesta(Package): # Intel's mpiifort is not found 'MPIFC=%s' % spec['mpi'].mpifc ] - with working_dir('Obj'): - sh('../Src/configure', *configure_args) - sh('../Src/obj_setup.sh') - with working_dir('Obj_trans', create=True): - sh('../Src/configure', *configure_args) - sh('../Src/obj_setup.sh') + for d in ['Obj', 'Obj_trans']: + with working_dir(d, create=True): + sh('../Src/configure', *configure_args) + if spec.satisfies('@:4.0%intel'): + with open('arch.make', 'a') as f: + f.write('\natom.o: atom.F\n') + f.write('\t$(FC) -c $(FFLAGS) -O1') + f.write('$(INCFLAGS) $(FPPFLAGS) $<') + sh('../Src/obj_setup.sh') def build(self, spec, prefix): with working_dir('Obj'): make(parallel=False) with working_dir('Obj_trans'): make('transiesta', parallel=False) + with working_dir('Util'): + sh = which('sh') + sh('build_all.sh') def install(self, spec, prefix): mkdir(prefix.bin) @@ -82,3 +89,8 @@ class Siesta(Package): install('siesta', prefix.bin) with working_dir('Obj_trans'): install('transiesta', prefix.bin) + for root, _, files in os.walk('Util'): + for fname in files: + fname = join_path(root, fname) + if os.access(fname, os.X_OK): + install(fname, prefix.bin) -- cgit v1.2.3-60-g2f50