Improve compiler configuration in otf2 package

This commit is contained in:
David Boehme 2014-08-01 10:16:08 -07:00
parent 61e2cb56a4
commit 513b5aecf1

View File

@ -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")