pgplot: add intel compiler support and add more driver (#26761)
This commit is contained in:
parent
3f3048e157
commit
bf411c7c55
@ -1,7 +1,24 @@
|
|||||||
diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
|
--- a/sys_linux/g77_gcc.conf 2021-10-14 16:24:57.912819100 +0900
|
||||||
--- a/sys_linux/g77_gcc.conf 1969-12-31 19:00:00.000000000 -0500
|
+++ b/sys_linux/g77_gcc.conf 2021-10-14 16:25:00.840831262 +0900
|
||||||
+++ b/sys_linux/g77_gcc.conf 2021-04-22 16:48:45.000000000 -0400
|
@@ -5,7 +5,7 @@
|
||||||
@@ -34,13 +34,13 @@
|
# X2DRIV (/xdisp and /figdisp).
|
||||||
|
# The arguments needed by the C compiler to locate X-window include files.
|
||||||
|
|
||||||
|
- XINCL="-I/usr/X11R6/include"
|
||||||
|
+ XINCL=""
|
||||||
|
|
||||||
|
# Optional: Needed by XMDRIV (/xmotif).
|
||||||
|
# The arguments needed by the C compiler to locate Motif, Xt and
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
# The arguments needed by the C compiler to locate Tcl, Tk and
|
||||||
|
# X-window include files.
|
||||||
|
|
||||||
|
- TK_INCL="-I/usr/include $XINCL"
|
||||||
|
+ TK_INCL="@TK_INCL@"
|
||||||
|
|
||||||
|
# Optional: Needed by RVDRIV (/xrv).
|
||||||
|
# The arguments needed by the C compiler to locate Rivet, Tcl, Tk and
|
||||||
|
@@ -34,35 +34,35 @@
|
||||||
# Mandatory.
|
# Mandatory.
|
||||||
# The FORTRAN compiler to use.
|
# The FORTRAN compiler to use.
|
||||||
|
|
||||||
@ -17,7 +34,12 @@ diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
|
|||||||
|
|
||||||
# Mandatory.
|
# Mandatory.
|
||||||
# The FORTRAN compiler flags to use when compiling fortran demo programs.
|
# The FORTRAN compiler flags to use when compiling fortran demo programs.
|
||||||
@@ -52,12 +52,12 @@
|
# This may need to include a flag to tell the compiler not to treat
|
||||||
|
# backslash characters as C-style escape sequences
|
||||||
|
|
||||||
|
- FFLAGD="-fno-backslash"
|
||||||
|
+ FFLAGD="@FFLAGD@"
|
||||||
|
|
||||||
# Mandatory.
|
# Mandatory.
|
||||||
# The C compiler to use.
|
# The C compiler to use.
|
||||||
|
|
||||||
@ -32,8 +54,13 @@ diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
|
|||||||
|
|
||||||
# Mandatory.
|
# Mandatory.
|
||||||
# The C compiler flags to use when compiling C demo programs.
|
# The C compiler flags to use when compiling C demo programs.
|
||||||
@@ -73,9 +73,9 @@
|
|
||||||
# Mandatory.
|
- CFLAGD="-Wall -O"
|
||||||
|
+ CFLAGD="@CFLAGD@"
|
||||||
|
|
||||||
|
# Optional: Only needed if the cpgplot library is to be compiled.
|
||||||
|
# The flags to use when running pgbind to create the C pgplot wrapper
|
||||||
|
@@ -74,7 +74,7 @@
|
||||||
# The library-specification flags to use when linking normal pgplot
|
# The library-specification flags to use when linking normal pgplot
|
||||||
# demo programs.
|
# demo programs.
|
||||||
|
|
||||||
@ -42,8 +69,16 @@ diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
|
|||||||
|
|
||||||
# Optional: Needed by XMDRIV (/xmotif).
|
# Optional: Needed by XMDRIV (/xmotif).
|
||||||
# The library-specification flags to use when linking motif
|
# The library-specification flags to use when linking motif
|
||||||
# demo programs.
|
@@ -92,7 +92,7 @@
|
||||||
@@ -108,8 +108,8 @@
|
# The library-specification flags to use when linking Tk demo programs.
|
||||||
|
# Note that you may need to append version numbers to -ltk and -ltcl.
|
||||||
|
|
||||||
|
- TK_LIBS="-L/usr/lib -ltk -ltcl $LIBS -ldl"
|
||||||
|
+ TK_LIBS="@TK_LIBS@"
|
||||||
|
|
||||||
|
# Mandatory.
|
||||||
|
# On systems that have a ranlib utility, put "ranlib" here. On other
|
||||||
|
@@ -108,7 +108,7 @@
|
||||||
# Optional: Needed if SHARED_LIB is set.
|
# Optional: Needed if SHARED_LIB is set.
|
||||||
# How to create a shared library from a trailing list of object files.
|
# How to create a shared library from a trailing list of object files.
|
||||||
|
|
||||||
@ -52,4 +87,3 @@ diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
|
|||||||
|
|
||||||
# Optional:
|
# Optional:
|
||||||
# On systems such as Solaris 2.x, that allow specification of the
|
# On systems such as Solaris 2.x, that allow specification of the
|
||||||
# libraries that a shared library needs to be linked with when a
|
|
||||||
|
11
var/spack/repos/builtin/packages/pgplot/grsy00.f.patch
Normal file
11
var/spack/repos/builtin/packages/pgplot/grsy00.f.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- a/sys/grsy00.f 1995-06-14 11:01:04.000000000 +0900
|
||||||
|
+++ b/sys/grsy00.f 2021-10-15 13:39:33.715071295 +0900
|
||||||
|
@@ -58,7 +58,7 @@
|
||||||
|
INTEGER FNTFIL, IER, INDEX(3000), NC1, NC2, NC3
|
||||||
|
INTEGER L, GRTRIM
|
||||||
|
COMMON /GRSYMB/ NC1, NC2, INDEX, BUFFER
|
||||||
|
- CHARACTER*128 FF
|
||||||
|
+ CHARACTER*256 FF
|
||||||
|
C
|
||||||
|
C Read the font file. If an I/O error occurs, it is ignored; the
|
||||||
|
C effect will be that all symbols will be undefined (treated as
|
@ -30,25 +30,94 @@ class Pgplot(MakefilePackage):
|
|||||||
# edit the file more easily
|
# edit the file more easily
|
||||||
patch('g77_gcc.conf.patch')
|
patch('g77_gcc.conf.patch')
|
||||||
|
|
||||||
|
# https://research.iac.es/sieinvens/siepedia/pmwiki.php?n=HOWTOs.PGPLOTMacOSX
|
||||||
|
patch('pndriv.c.patch')
|
||||||
|
|
||||||
|
# Read font from spack generated directory
|
||||||
|
patch('grsy00.f.patch')
|
||||||
|
|
||||||
parallel = False
|
parallel = False
|
||||||
|
|
||||||
|
# enable drivers
|
||||||
|
variant('X', default=False,
|
||||||
|
description='Build with X11 support.')
|
||||||
|
variant('png', default=True,
|
||||||
|
description='Enable driver for Portable Network Graphics file.')
|
||||||
|
variant('ps', default=True,
|
||||||
|
description='Enable driver for PostScript files.')
|
||||||
|
|
||||||
|
depends_on('libx11', when='+X')
|
||||||
|
depends_on('libpng', when='+png')
|
||||||
|
|
||||||
def edit(self, spec, prefix):
|
def edit(self, spec, prefix):
|
||||||
substitutions = [
|
|
||||||
('@CCOMPL@', self.compiler.cc),
|
if spec.satisfies('%gcc'):
|
||||||
('@CFLAGC@', ("-Wall -fPIC -DPG_PPU -O -std=c89 " +
|
fib = " -fallow-invalid-boz" if spec.satisfies('%gcc@10:') else ""
|
||||||
"-Wno-error=implicit-function-declaration")),
|
|
||||||
('@FCOMPL@', self.compiler.f77),
|
sub = {
|
||||||
('@FFLAGC@', "-Wall -fPIC -O -ffixed-line-length-none" +
|
'@CCOMPL@': spack_cc,
|
||||||
(" -fallow-invalid-boz" if spec.satisfies('%gcc@10:') else "")),
|
'@CFLAGC@': "-Wall -fPIC -DPG_PPU -O -std=c89 " +
|
||||||
('@LIBS@', "-lgfortran"),
|
"-Wno-error=implicit-function-declaration",
|
||||||
('@SHARED_LD@', self.compiler.cc + " -shared -o $SHARED_LIB -lgfortran"),
|
'@CFLAGD@': "-O2",
|
||||||
]
|
'@FCOMPL@': spack_fc,
|
||||||
|
'@FFLAGC@': "-Wall -fPIC -O -ffixed-line-length-none" + fib,
|
||||||
|
'@FFLAGD@': "-fno-backslash",
|
||||||
|
'@LIBS@': "-lgfortran",
|
||||||
|
'@SHARED_LD@': spack_cc + " -shared -o $SHARED_LIB -lgfortran"
|
||||||
|
}
|
||||||
|
elif spec.satisfies('%intel'):
|
||||||
|
sub = {
|
||||||
|
'@CCOMPL@': spack_cc,
|
||||||
|
'@CFLAGC@': "-O2 -fPIC -DPG_PPU",
|
||||||
|
'@CFLAGD@': "-O2 -lifcore -lifport",
|
||||||
|
'@FCOMPL@': spack_fc,
|
||||||
|
'@FFLAGC@': "-fPIC",
|
||||||
|
'@FFLAGD@': "-nofor-main",
|
||||||
|
'@LIBS@': "-nofor-main -lifcore -lifport",
|
||||||
|
'@SHARED_LD@': spack_cc + " -shared -o $SHARED_LIB"
|
||||||
|
}
|
||||||
|
|
||||||
conf = join_path(
|
conf = join_path(
|
||||||
self.stage.source_path, 'sys_linux/g77_gcc.conf'
|
self.stage.source_path, 'sys_linux/g77_gcc.conf'
|
||||||
)
|
)
|
||||||
for key, value in substitutions:
|
|
||||||
|
drivers_list = join_path(self.stage.source_path, 'drivers.list')
|
||||||
|
|
||||||
|
# eg. change contents of drivers_list file like:
|
||||||
|
# '! XWDRIV 1 /XWINDOW' -> 'XWDRIV 1 /XWINDOW'
|
||||||
|
enable_driver = lambda s: filter_file(s, s[2:], drivers_list)
|
||||||
|
|
||||||
|
if '+X' in spec:
|
||||||
|
enable_driver('! XWDRIV 1 /XWINDOW')
|
||||||
|
enable_driver('! XWDRIV 2 /XSERVE')
|
||||||
|
|
||||||
|
sub['@FFLAGD@'] += ' -L{0} -lX11'.format(self.spec['libx11'].prefix.lib)
|
||||||
|
sub['@LIBS@'] += ' -L{0} -lX11'.format(self.spec['libx11'].prefix.lib)
|
||||||
|
|
||||||
|
if '+png' in spec:
|
||||||
|
enable_driver('! PNDRIV 1 /PNG')
|
||||||
|
|
||||||
|
filter_file('pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h',
|
||||||
|
'pndriv.o :', 'makemake')
|
||||||
|
|
||||||
|
# Alwasy enable PS and LATEX since they are not depending on other libraries.
|
||||||
|
enable_driver('! PSDRIV 1 /PS')
|
||||||
|
enable_driver('! PSDRIV 2 /VPS')
|
||||||
|
enable_driver('! PSDRIV 3 /CPS')
|
||||||
|
enable_driver('! PSDRIV 4 /VCPS')
|
||||||
|
enable_driver('! LXDRIV 0 /LATEX')
|
||||||
|
|
||||||
|
# GIF is not working. Maybe it is a bug in the gidriv.f.
|
||||||
|
# enable_driver('! GIDRIV 1 /GIF')
|
||||||
|
# enable_driver('! GIDRIV 2 /VGIF')
|
||||||
|
|
||||||
|
for key, value in sub.items():
|
||||||
filter_file(key, value, conf)
|
filter_file(key, value, conf)
|
||||||
|
|
||||||
|
def setup_build_environment(self, env):
|
||||||
|
if '+png' in self.spec:
|
||||||
|
env.set('LIBS', self.spec['libpng'].libs.ld_flags)
|
||||||
|
|
||||||
def build(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
makemake = which('./makemake')
|
makemake = which('./makemake')
|
||||||
makemake(self.build_directory, 'linux', 'g77_gcc')
|
makemake(self.build_directory, 'linux', 'g77_gcc')
|
||||||
@ -77,12 +146,15 @@ def install(self, spec, prefix):
|
|||||||
install('pgdemo15', prefix.bin)
|
install('pgdemo15', prefix.bin)
|
||||||
install('pgdemo16', prefix.bin)
|
install('pgdemo16', prefix.bin)
|
||||||
install('pgdemo17', prefix.bin)
|
install('pgdemo17', prefix.bin)
|
||||||
|
if '+X' in spec:
|
||||||
|
install('pgxwin_server', prefix.bin)
|
||||||
mkdirp(prefix.include)
|
mkdirp(prefix.include)
|
||||||
install('cpgplot.h', prefix.include)
|
install('cpgplot.h', prefix.include)
|
||||||
mkdirp(prefix.lib)
|
mkdirp(prefix.lib)
|
||||||
install('libcpgplot.a', prefix.lib)
|
install('libcpgplot.a', prefix.lib)
|
||||||
install('libpgplot.a', prefix.lib)
|
install('libpgplot.a', prefix.lib)
|
||||||
install('libpgplot.so', prefix.lib)
|
install('libpgplot.so', prefix.lib)
|
||||||
|
install('grfont.dat', prefix.include)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def libs(self):
|
def libs(self):
|
||||||
@ -90,3 +162,7 @@ def libs(self):
|
|||||||
return find_libraries(
|
return find_libraries(
|
||||||
"lib*pgplot", root=self.prefix, shared=shared, recursive=True
|
"lib*pgplot", root=self.prefix, shared=shared, recursive=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def setup_run_environment(self, env):
|
||||||
|
env.set('PGPLOT_FONT', self.prefix.include + '/grfont.dat')
|
||||||
|
env.set('PGPLOT_DIR', self.prefix)
|
||||||
|
11
var/spack/repos/builtin/packages/pgplot/pndriv.c.patch
Normal file
11
var/spack/repos/builtin/packages/pgplot/pndriv.c.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- a/drivers/pndriv.c 1999-03-27 11:06:23.000000000 +0900
|
||||||
|
+++ b/drivers/pndriv.c 2021-10-15 13:02:16.531645384 +0900
|
||||||
|
@@ -222,7 +222,7 @@
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (setjmp(png_ptr->jmpbuf)) { /* not really sure what I'm doing here... */
|
||||||
|
+ if (setjmp(png_jmpbuf(png_ptr))) {
|
||||||
|
fprintf(stderr,"%s: error in libpng while writing file %s, plotting disabled\n", png_ident, filename);
|
||||||
|
png_destroy_write_struct(&png_ptr,&info_ptr);
|
||||||
|
dev->error = true;
|
Loading…
Reference in New Issue
Block a user