summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/pgplot/g77_gcc.conf.patch54
-rw-r--r--var/spack/repos/builtin/packages/pgplot/grsy00.f.patch11
-rw-r--r--var/spack/repos/builtin/packages/pgplot/package.py98
-rw-r--r--var/spack/repos/builtin/packages/pgplot/pndriv.c.patch11
4 files changed, 153 insertions, 21 deletions
diff --git a/var/spack/repos/builtin/packages/pgplot/g77_gcc.conf.patch b/var/spack/repos/builtin/packages/pgplot/g77_gcc.conf.patch
index e41e387cad..f97ed8ab49 100644
--- a/var/spack/repos/builtin/packages/pgplot/g77_gcc.conf.patch
+++ b/var/spack/repos/builtin/packages/pgplot/g77_gcc.conf.patch
@@ -1,7 +1,24 @@
-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 @@
+--- a/sys_linux/g77_gcc.conf 2021-10-14 16:24:57.912819100 +0900
++++ b/sys_linux/g77_gcc.conf 2021-10-14 16:25:00.840831262 +0900
+@@ -5,7 +5,7 @@
+ # 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.
# The FORTRAN compiler to use.
@@ -17,7 +34,12 @@ diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
# Mandatory.
# 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.
# The C compiler to use.
@@ -32,8 +54,13 @@ diff -ruN a/sys_linux/g77_gcc.conf b/sys_linux/g77_gcc.conf
# Mandatory.
# 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
# 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).
# The library-specification flags to use when linking motif
- # demo programs.
-@@ -108,8 +108,8 @@
+@@ -92,7 +92,7 @@
+ # 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.
# 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:
# On systems such as Solaris 2.x, that allow specification of the
- # libraries that a shared library needs to be linked with when a
diff --git a/var/spack/repos/builtin/packages/pgplot/grsy00.f.patch b/var/spack/repos/builtin/packages/pgplot/grsy00.f.patch
new file mode 100644
index 0000000000..40dc91199c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/pgplot/grsy00.f.patch
@@ -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
diff --git a/var/spack/repos/builtin/packages/pgplot/package.py b/var/spack/repos/builtin/packages/pgplot/package.py
index ac5011cdb7..a042fe2159 100644
--- a/var/spack/repos/builtin/packages/pgplot/package.py
+++ b/var/spack/repos/builtin/packages/pgplot/package.py
@@ -30,25 +30,94 @@ class Pgplot(MakefilePackage):
# edit the file more easily
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
+ # 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):
- 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" if spec.satisfies('%gcc@10:') else "")),
- ('@LIBS@', "-lgfortran"),
- ('@SHARED_LD@', self.compiler.cc + " -shared -o $SHARED_LIB -lgfortran"),
- ]
+
+ if spec.satisfies('%gcc'):
+ fib = " -fallow-invalid-boz" if spec.satisfies('%gcc@10:') else ""
+
+ sub = {
+ '@CCOMPL@': spack_cc,
+ '@CFLAGC@': "-Wall -fPIC -DPG_PPU -O -std=c89 " +
+ "-Wno-error=implicit-function-declaration",
+ '@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(
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)
+ 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):
makemake = which('./makemake')
makemake(self.build_directory, 'linux', 'g77_gcc')
@@ -77,12 +146,15 @@ class Pgplot(MakefilePackage):
install('pgdemo15', prefix.bin)
install('pgdemo16', prefix.bin)
install('pgdemo17', prefix.bin)
+ if '+X' in spec:
+ install('pgxwin_server', 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)
+ install('grfont.dat', prefix.include)
@property
def libs(self):
@@ -90,3 +162,7 @@ class Pgplot(MakefilePackage):
return find_libraries(
"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)
diff --git a/var/spack/repos/builtin/packages/pgplot/pndriv.c.patch b/var/spack/repos/builtin/packages/pgplot/pndriv.c.patch
new file mode 100644
index 0000000000..aa18750763
--- /dev/null
+++ b/var/spack/repos/builtin/packages/pgplot/pndriv.c.patch
@@ -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;