From 513b5aecf1e34e775d98f12c41c9bd526a8504a5 Mon Sep 17 00:00:00 2001 From: David Boehme Date: Fri, 1 Aug 2014 10:16:08 -0700 Subject: Improve compiler configuration in otf2 package --- var/spack/packages/otf2/package.py | 46 +++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/var/spack/packages/otf2/package.py b/var/spack/packages/otf2/package.py index 7e28414623..6f4ab997af 100644 --- a/var/spack/packages/otf2/package.py +++ b/var/spack/packages/otf2/package.py @@ -1,6 +1,7 @@ # FIXME: Add copyright from spack import * +from contextlib import closing import os class Otf2(Package): @@ -17,28 +18,57 @@ class Otf2(Package): version('1.2.1', '8fb3e11fb7489896596ae2c7c83d7fc8', url="http://www.vi-hps.org/upload/packages/otf2/otf2-1.2.1.tar.gz") + backend_user_provided = """\ +CC=cc +CXX=c++ +F77=f77 +FC=f90 +CFLAGS=-fPIC +CXXFLAGS=-fPIC +""" + frontend_user_provided = """\ +CC_FOR_BUILD=cc +CXX_FOR_BUILD=c++ +F77_FOR_BUILD=f70 +FC_FOR_BUILD=f90 +CFLAGS_FOR_BUILD=-fPIC +CXXFLAGS_FOR_BUILD=-fPIC +""" + mpi_user_provided = """\ +MPICC=cc +MPICXX=c++ +MPIF77=f77 +MPIFC=f90 +MPI_CFLAGS=-fPIC +MPI_CXXFLAGS=-fPIC +""" @when('@:1.2') - def version_specific_args(self, args): + def version_specific_args(self): return ["--with-platform=disabled"] @when('@1.3:') - def version_specific_args(self, args): + def version_specific_args(self): # TODO: figure out what scorep's build does as of otf2 1.3 - return [] - + return ["--with-custom-compilers"] def install(self, spec, prefix): - # FIXME: Modify the configure line to suit your build system here. - cc = os.environ["SPACK_CC"] + # Use a custom compiler configuration, otherwise the score-p + # build system messes with spack's compiler settings. + # Create these three files in the build directory + with closing(open("platform-backend-user-provided", "w")) as backend_file: + backend_file.write(self.backend_user_provided) + with closing(open("platform-frontend-user-provided", "w")) as frontend_file: + frontend_file.write(self.frontend_user_provided) + with closing(open("platform-mpi-user-provided", "w")) as mpi_file: + mpi_file.write(self.mpi_user_provided) configure_args=["--prefix=%s" % prefix, - "--enable-shared"]) + "--enable-shared"] configure_args.extend(self.version_specific_args()) configure(*configure_args) - # FIXME: Add logic to build and install here make() make("install") -- cgit v1.2.3-70-g09d2