From 1c2424ac29fa9b2984070613e9630792614bae81 Mon Sep 17 00:00:00 2001 From: Tom Payerle Date: Mon, 30 Nov 2020 02:54:05 -0500 Subject: New package: povray (#20071) --- .../builtin/packages/povray/fix_prebuild.sh.patch | 15 +++ var/spack/repos/builtin/packages/povray/package.py | 140 +++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 var/spack/repos/builtin/packages/povray/fix_prebuild.sh.patch create mode 100644 var/spack/repos/builtin/packages/povray/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/povray/fix_prebuild.sh.patch b/var/spack/repos/builtin/packages/povray/fix_prebuild.sh.patch new file mode 100644 index 0000000000..785dc433b3 --- /dev/null +++ b/var/spack/repos/builtin/packages/povray/fix_prebuild.sh.patch @@ -0,0 +1,15 @@ +diff -Naur spack-src/unix/prebuild.sh spack-src.patched/unix/prebuild.sh +--- spack-src/unix/prebuild.sh 2020-11-19 16:49:04.573263288 -0500 ++++ spack-src.patched/unix/prebuild.sh 2020-11-19 16:51:35.599850471 -0500 +@@ -62,8 +62,9 @@ + + # Prevents running from another directory. + if test x"`dirname $0`" != x"."; then +- echo "$0: must ran from POV-Ray's unix/ directory" +- exit 1 ++ wdir=`dirname $0` ++ echo >&2 "Changing directory to '$wdir' ..." ++ cd $wdir + fi + + # Check optional argument. diff --git a/var/spack/repos/builtin/packages/povray/package.py b/var/spack/repos/builtin/packages/povray/package.py new file mode 100644 index 0000000000..2c80552a74 --- /dev/null +++ b/var/spack/repos/builtin/packages/povray/package.py @@ -0,0 +1,140 @@ +# Copyright 2013-2020 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 * +# For getting fqdn for defaulting COMPILED_BY +import socket +# For getting username for defaulting COMPILED_BY +import getpass + + +class Povray(AutotoolsPackage): + """The Persistence of Vision Raytracer creates three-dimensional, + photo-realistic images using a rendering technique called ray-tracing. It + reads in a text file containing information describing the objects and + lighting in a scene and generates an image of that scene from the view + point of a camera also described in the text file. Ray-tracing is not a + fast process by any means, but it produces very high quality images with + realistic reflections, shading, perspective and other effects. + """ + + # Add a proper url for your package's homepage here. + homepage = "http://povray.org/download/" + url = "https://github.com/POV-Ray/povray/archive/v3.7.0.8.tar.gz" + git = "https://github.com/POV-Ray/povray.git" + + # maintainers = ['payerle' ] + + version('3.7.0.8', sha256='53d11ebd2972fc452af168a00eb83aefb61387662c10784e81b63e44aa575de4') + + variant('boost', default=True, description='Build with boost support') + variant('debug', default=False, + description='Enable compiler debugging mode') + variant('io-restrictions', default=True, + description='Enable POV-Rays mechanism for control of I/O ' + 'operations') + variant('jpeg', default=True, description='Build with jpeg support') + variant('libpng', default=True, description='Build with libpng support') + variant('libtiff', default=True, description='Build with libtiff support') + variant('mkl', default=True, description='Build with Intel MKL support') + variant('openexr', default=True, description='Build with OpenEXR support') + variant('profile', default=False, + description='Enable program execution profiling') + variant('static', default=False, + description='Build static instead shared binaries') + variant('zlib', default=True, description='Build with zlib support') + # SDL support is limited to sdl version 1, not sdl2, and spack currently + # only supports sdl2 + # variant('sdl', default=True, + # description='Build with SDL support (for display preview)') + # X11 support requires SDL, and I believe therefore lacks support for + # remote displays. As we do not have SDL support, no X11 support + # variant('x11', default=True, description='Build with X11 support') + + # Build dependencies + depends_on('autoconf@2.59:', type='build') + depends_on('automake@1.9:', type='build') + depends_on('perl', type='build') + depends_on('m4', type='build') + depends_on('boost@1.37:', when='+boost') + depends_on('zlib@1.2.1:', when='+zlib') + depends_on('libpng@1.2.5:', when='+libpng') + depends_on('jpeg', when='+jpeg') + depends_on('libtiff@3.6.1:', when='+libtiff') + depends_on('openexr@1.2:', when='+openexr') + + # This patch enables prebuild.sh to be invoked from any directory + # (it immediately cds to the directory containing prebuild.sh) + # This is better than a broken check that it was called from the + # containing directory + patch('fix_prebuild.sh.patch') + + @run_before('autoreconf') + def run_prebuild_script(self): + # We need to run /unix/prebuild.sh + # and it must be run from within the directory containing it + unix_dir = join_path(self.build_directory, 'unix') + prebuild_path = join_path(unix_dir, 'prebuild.sh') + prebuild_script = which(prebuild_path) + prebuild_script() + + def configure_args(self): + extra_args = [] + + # POVRay insists upon a COMPILED_BY value being passed to configure + # We generate a generic using process owner and fqdn of build host. + fqdn = socket.getfqdn() + uname = getpass.getuser() + compiled_by = 'Installed by spack <{0}@{1}>'.format(uname, fqdn) + extra_args.append('COMPILED_BY={0}'.format(compiled_by)) + + extra_args.append('--disable-silent-rules') # Verbose make output + extra_args += self.enable_or_disable('debug') + extra_args += self.enable_or_disable('io-restrictions') + extra_args += self.enable_or_disable('profile') + extra_args += self.enable_or_disable('static') + + if '+boost' in self.spec: + extra_args.append('--with-boost={0}'.format( + self.spec['boost'].prefix)) + else: + extra_args.append('--without-boost') + + if '+jpeg' in self.spec: + extra_args.append('--with-libjpeg={0}'.format( + self.spec['jpeg'].prefix)) + else: + extra_args.append('--without-libjpeg') + + if '+libpng' in self.spec: + extra_args.append('--with-libpng={0}'.format( + self.spec['libpng'].prefix)) + else: + extra_args.append('--without-libpng') + + if '+libtiff' in self.spec: + extra_args.append('--with-libtiff={0}'.format( + self.spec['libtiff'].prefix)) + else: + extra_args.append('--without-libtiff') + + if '+mkl' in self.spec: + extra_args.append('--with-libmkl={0}'.format( + self.spec['mkl'].prefix)) + else: + extra_args.append('--without-libmkl') + + if '+openexr' in self.spec: + extra_args.append('--with-openexr={0}'.format( + self.spec['openexr'].prefix)) + else: + extra_args.append('--without-openexr') + + # POV-Ray only supports sdl v1, spack only supports sdl2 at this time + # and X11 support requires sdl + extra_args.append('--without-libsdl') + extra_args.append('--without-x') + + return extra_args -- cgit v1.2.3-60-g2f50