diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/pgplot/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/pgplot/package.py | 98 |
1 files changed, 87 insertions, 11 deletions
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) |