diff --git a/var/spack/repos/builtin/packages/openrasmol/package.py b/var/spack/repos/builtin/packages/openrasmol/package.py new file mode 100644 index 0000000000..76ff5de93e --- /dev/null +++ b/var/spack/repos/builtin/packages/openrasmol/package.py @@ -0,0 +1,68 @@ +# 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 Openrasmol(MakefilePackage): + """RasMol is a molecular graphics program intended for the + visualisation of proteins, nucleic acids and small molecules.""" + + homepage = "http://www.openrasmol.org/" + url = "https://sourceforge.net/projects/openrasmol/files/RasMol/RasMol_2.7.5/RasMol-2.7.5.2.tar.gz" + + version('2.7.5.2', sha256='b975e6e69d5c6b161a81f04840945d2f220ac626245c61bcc6c56181b73a5718') + + depends_on('imake', type='build') + depends_on('libxext', type='link') + depends_on('libxi', type='link') + + depends_on('cbflib@0.9.2', type='link') + depends_on('cqrlib@1.1.2', type='link') + depends_on('cvector@1.0.3', type='link') + depends_on('neartree@3.1', type='link') + depends_on('xforms@1.0.91', type='link') + + patch('rasmol_noqa.patch') + patch('rasmol_help.patch') + + def edit(self, spec, prefix): + with working_dir('src'): + # Imakefile + bash = which('bash') + bash('./rasmol_build_options.sh') + # host.def + with open('host.def', 'w') as f: + f.write('#ifdef AfterVendorCF\n') + f.write('#define CcCmd {0}\n'.format(spack_cc)) + f.write('#endif\n') + + def setup_build_environment(self, env): + env.set('XFORMSLIB_DIR', self.spec['xforms'].prefix) + env.set('CBFLIB_DIR', self.spec['cbflib'].prefix) + env.set('CQRLIB_DIR', self.spec['cqrlib'].prefix) + env.set('CVECTOR_DIR', self.spec['cvector'].prefix) + env.set('NEARTREE_DIR', self.spec['neartree'].prefix) + + def build(self, spec, prefix): + with working_dir('src'): + bash = which('bash') + bash('./build_all.sh') + + def install(self, spec, prefix): + install_tree('./data', prefix.sample) + install_tree('./doc', prefix.doc) + with working_dir('src'): + bash = which('bash') + bash('./rasmol_install.sh', '--prefix={0}'.format(prefix)) + + def test(self): + testdir = self.test_suite.current_test_data_dir + opts = [] + opts.append('-insecure') + opts.append('-script') + opts.append(join_path(testdir, 'test.rsc')) + opts.append(join_path(self.prefix.sample, '1crn.pdb')) + self.run_test('rasmol', options=opts) diff --git a/var/spack/repos/builtin/packages/openrasmol/rasmol_help.patch b/var/spack/repos/builtin/packages/openrasmol/rasmol_help.patch new file mode 100644 index 0000000000..5ced3123be --- /dev/null +++ b/var/spack/repos/builtin/packages/openrasmol/rasmol_help.patch @@ -0,0 +1,22 @@ +--- a/src/command.c 2021-02-04 01:59:48.968985028 +0900 ++++ b/src/command.c 2021-02-04 02:02:15.548984240 +0900 +@@ -118,6 +118,10 @@ + #include + #include + ++#include ++#ifndef PATH_MAX ++#define PATH_MAX 1024 ++#endif + + #if !defined(IBMPC) && !defined(VMS) && !defined(APPLEMAC) + #include +@@ -229,7 +233,7 @@ + + #define HelpPool 16 + static char *HelpFileName; +-static char HelpFileBuf[80]; ++static char HelpFileBuf[PATH_MAX]; + static HlpEntry __far *FreeInfo; + static HlpEntry __far *HelpInfo; + diff --git a/var/spack/repos/builtin/packages/openrasmol/rasmol_noqa.patch b/var/spack/repos/builtin/packages/openrasmol/rasmol_noqa.patch new file mode 100644 index 0000000000..04c559b5cf --- /dev/null +++ b/var/spack/repos/builtin/packages/openrasmol/rasmol_noqa.patch @@ -0,0 +1,26 @@ +--- a/src/rasmol_install.sh 2021-01-23 02:35:53.420843463 +0900 ++++ b/src/rasmol_install.sh 2021-01-23 02:46:42.576839974 +0900 +@@ -226,11 +226,6 @@ + fi + fi + +-echo -n "Install rasmol into \"$RASMOLPATH\"? [y/N] "; +-read ok +-if [ "$ok" != "y" ] && [ "$ok" != "Y" ] ; then exit 1 ; +-fi +- + savecurdir=`pwd` ; + cd $RASMOLPATH ; + rasmolpath=`pwd` ; +@@ -245,11 +240,6 @@ + + fi + +-echo -n "Install rasmol program wrapper in \"$bindest/rasmol\"? [y/N] "; +-read ok +-if [ "$ok" != "y" ] && [ "$ok" != "Y" ]; then unset bindest ; +-fi +- + + if ! [ -d $bindest ] ; then + mkdir -p $bindest ; diff --git a/var/spack/repos/builtin/packages/openrasmol/test/test.rsc b/var/spack/repos/builtin/packages/openrasmol/test/test.rsc new file mode 100644 index 0000000000..654f542115 --- /dev/null +++ b/var/spack/repos/builtin/packages/openrasmol/test/test.rsc @@ -0,0 +1,3 @@ +wireframe true +write ps test.ps +quit