lorene, pgplot: new packages (#24549)

This commit is contained in:
Erik Schnetter 2021-07-12 07:35:43 -04:00 committed by GitHub
parent e957c58a1e
commit 4c7aed5d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 255 additions and 0 deletions

View File

@ -0,0 +1,20 @@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CXXFLAGS_G = @CXXFLAGS_G@
F77 = @F77@
F77FLAGS = @F77FLAGS@
F77FLAGS_G = @F77FLAGS_G@
INC = @INC@
RANLIB = @RANLIB@
MAKEDEPEND = @MAKEDEPEND@
DEPDIR = .deps
FFT_DIR = @FFT_DIR@
LIB_CXX = @LIB_CXX@
LIB_GSL = @LIB_GSL@
LIB_LAPACK = @LIB_LAPACK@
LIB_PGPLOT = @LIB_PGPLOT@

View File

@ -0,0 +1,96 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import inspect
import os
from spack import *
class Lorene(MakefilePackage):
"""LORENE: Langage Objet pour la RElativite NumeriquE
LORENE is a set of C++ classes to solve various problems
arising in numerical relativity, and more generally in
computational astrophysics. It provides tools to solve
partial differential equations by means of multi-domain
spectral methods."""
homepage = "https://lorene.obspm.fr/index.html"
cvs = ":pserver:anonymous:anonymous@octane.obspm.fr:/cvsroot%module=Lorene"
maintainers = ['eschnett']
version('2021.4.22', date='2021-04-22')
variant('fftw', default=True,
description='Use external FFTW for spectral transformations')
variant('bin_star', default=True,
description='Build Bin_star solver for binary neutron star systems')
depends_on('fftw @3:', when='+fftw')
depends_on('gsl')
depends_on('lapack')
depends_on('pgplot')
parallel = False
def edit(self, spec, prefix):
fftw_incdirs = "-I" + spec['fftw'].prefix.include if '+fftw' in spec else ""
fftw_libdirs = "-L" + spec['fftw'].prefix.lib if '+fftw' in spec else ""
gsl_incdirs = "-I" + spec['gsl'].prefix.include
gsl_libdirs = "-L" + spec['gsl'].prefix.lib
pgplot_incdirs = "-I" + spec['pgplot'].prefix.include
pgplot_libdirs = "-L" + spec['pgplot'].prefix.lib
substitutions = [
('@CXX@', self.compiler.cxx),
('@CXXFLAGS@', "-g -I$(HOME_LORENE)/C++/Include -O3 -DNDEBUG"),
('@CXXFLAGS_G@', "-g -I$(HOME_LORENE)/C++/Include"),
('@F77@', self.compiler.f77),
('@F77FLAGS@', "-ffixed-line-length-none -g -O3"),
('@F77FLAGS_G@', "-ffixed-line-length-none -g"),
('@INC@',
("-I$(HOME_LORENE)/C++/Include " +
"-I$(HOME_LORENE)/C++/Include_extra " +
fftw_incdirs + " " + gsl_incdirs + " " + pgplot_incdirs)),
('@RANLIB@', "ls"),
('@MAKEDEPEND@', "cpp $(INC) -M >> $(df).d $<"),
('@FFT_DIR@', "FFTW3"),
('@LIB_CXX@', fftw_libdirs + " -lfftw3 -lgfortran"),
('@LIB_GSL@', gsl_libdirs + " -lgsl -lgslcblas"),
('@LIB_LAPACK@', "-llapack -lblas"),
('@LIB_PGPLOT@', pgplot_libdirs + " -lcpgplot -lpgplot"),
]
local_settings_template = join_path(
os.path.dirname(inspect.getmodule(self).__file__),
'local_settings.template'
)
local_settings = join_path(
self.stage.source_path, 'local_settings'
)
copy(local_settings_template, local_settings)
for key, value in substitutions:
filter_file(key, value, local_settings)
def build(self, spec, prefix):
args = ['HOME_LORENE=' + self.build_directory]
# (We could build the documentation as well.)
# (We could circumvent the build system and simply compile all
# source files, and do so in parallel.)
make('cpp', 'fortran', 'export', *args)
if '+bin_star' in spec:
with working_dir(join_path('Codes', 'Bin_star')):
make('-f', 'Makefile_O2',
'coal', 'lit_bin', 'init_bin', 'coal_regu', 'init_bin_regu',
'analyse', 'prepare_seq',
*args)
def install(self, spec, prefix):
mkdirp(prefix.lib)
install_tree('Lib', prefix.lib)
mkdirp(prefix.bin)
if '+bin_star' in spec:
install_tree(join_path('Codes', 'Bin_star'), prefix.bin)

View File

@ -0,0 +1,55 @@
diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
--- a/sys_linux/g77_gcc.conf 1969-12-31 19:00:00.000000000 -0500
+++ b/sys_linux/g77_gcc.conf 2021-04-22 16:48:45.000000000 -0400
@@ -34,13 +34,13 @@
# Mandatory.
# The FORTRAN compiler to use.
- FCOMPL="g77"
+ FCOMPL="@FCOMPL@"
# Mandatory.
# The FORTRAN compiler flags to use when compiling the pgplot library.
# (NB. makemake prepends -c to $FFLAGC where needed)
- FFLAGC="-u -Wall -fPIC -O"
+ FFLAGC="@FFLAGC@"
# Mandatory.
# The FORTRAN compiler flags to use when compiling fortran demo programs.
@@ -52,12 +52,12 @@
# Mandatory.
# The C compiler to use.
- CCOMPL="gcc"
+ CCOMPL="@CCOMPL@"
# Mandatory.
# The C compiler flags to use when compiling the pgplot library.
- CFLAGC="-Wall -fPIC -DPG_PPU -O"
+ CFLAGC="@CFLAGC@"
# Mandatory.
# The C compiler flags to use when compiling C demo programs.
@@ -73,9 +73,9 @@
# Mandatory.
# The library-specification flags to use when linking normal pgplot
# demo programs.
- LIBS="-L/usr/X11R6/lib -lX11"
+ LIBS="@LIBS@"
# Optional: Needed by XMDRIV (/xmotif).
# The library-specification flags to use when linking motif
# demo programs.
@@ -108,8 +108,8 @@
# Optional: Needed if SHARED_LIB is set.
# How to create a shared library from a trailing list of object files.
- SHARED_LD="gcc -shared -o $SHARED_LIB"
+ SHARED_LD="@SHARED_LD@"
# Optional:
# On systems such as Solaris 2.x, that allow specification of the
# libraries that a shared library needs to be linked with when a

View File

@ -0,0 +1,84 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pgplot(MakefilePackage):
"""PGPLOT Graphics Subroutine Library
The PGPLOT Graphics Subroutine Library is a Fortran- or
C-callable, device-independent graphics package for making
simple scientific graphs. It is intended for making
graphical images of publication quality with minimum effort
on the part of the user. For most applications, the program
can be device-independent, and the output can be directed to
the appropriate device at run time."""
homepage = "https://sites.astro.caltech.edu/~tjp/pgplot/"
url = "ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz"
maintainers = ['eschnett']
version('5.2.2',
url="ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz",
sha256='a5799ff719a510d84d26df4ae7409ae61fe66477e3f1e8820422a9a4727a5be4')
# Replace hard-coded compilers and options by tokens, so that Spack can
# edit the file more easily
patch('g77_gcc.conf.patch')
parallel = False
def edit(self, spec, prefix):
substitutions = [
('@CCOMPL@', self.compiler.cc),
('@CFLAGC@', ("-Wall -fPIC -DPG_PPU -O -std=c89 " +
"-Wno-error=implicit-function-declaration")),
('@FCOMPL@', self.compiler.f77),
('@FFLAGC@', "-Wall -fPIC -O -ffixed-line-length-none -fallow-invalid-boz"),
('@LIBS@', "-lgfortran"),
('@SHARED_LD@', self.compiler.cc + " -shared -o $SHARED_LIB -lgfortran"),
]
conf = join_path(
self.stage.source_path, 'sys_linux/g77_gcc.conf'
)
for key, value in substitutions:
filter_file(key, value, conf)
def build(self, spec, prefix):
makemake = which('./makemake')
makemake(self.build_directory, 'linux', 'g77_gcc')
make()
make('clean')
make('cpg')
def install(self, spec, prefix):
mkdirp(prefix.bin)
install('cpgdemo', prefix.bin)
install('pgbind', prefix.bin)
install('pgdemo1', prefix.bin)
install('pgdemo2', prefix.bin)
install('pgdemo3', prefix.bin)
install('pgdemo4', prefix.bin)
install('pgdemo5', prefix.bin)
install('pgdemo6', prefix.bin)
install('pgdemo7', prefix.bin)
install('pgdemo8', prefix.bin)
install('pgdemo9', prefix.bin)
install('pgdemo10', prefix.bin)
install('pgdemo11', prefix.bin)
install('pgdemo12', prefix.bin)
install('pgdemo13', prefix.bin)
install('pgdemo14', prefix.bin)
install('pgdemo15', prefix.bin)
install('pgdemo16', prefix.bin)
install('pgdemo17', prefix.bin)
mkdirp(prefix.include)
install('cpgplot.h', prefix.include)
mkdirp(prefix.lib)
install('libcpgplot.a', prefix.lib)
install('libpgplot.a', prefix.lib)
install('libpgplot.so', prefix.lib)