summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorketsubouchi <kenta.tsubouchi@allin-one.jp>2021-02-18 18:05:32 +0900
committerGitHub <noreply@github.com>2021-02-18 10:05:32 +0100
commitb3e5df10493165061e4a62238d1393a31f24ba0d (patch)
tree6c1a7e7b8b3ba2433468dd62610fe3791b465025 /var
parentde68646c6e73d43f102f76548b1fe36fbf835741 (diff)
downloadspack-b3e5df10493165061e4a62238d1393a31f24ba0d.tar.gz
spack-b3e5df10493165061e4a62238d1393a31f24ba0d.tar.bz2
spack-b3e5df10493165061e4a62238d1393a31f24ba0d.tar.xz
spack-b3e5df10493165061e4a62238d1393a31f24ba0d.zip
cbflib: new package (#21531)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/cbflib/cbf_f16.patch17
-rw-r--r--var/spack/repos/builtin/packages/cbflib/cbf_int.patch11
-rw-r--r--var/spack/repos/builtin/packages/cbflib/checkint.c4
-rw-r--r--var/spack/repos/builtin/packages/cbflib/package.py43
4 files changed, 75 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/cbflib/cbf_f16.patch b/var/spack/repos/builtin/packages/cbflib/cbf_f16.patch
new file mode 100644
index 0000000000..5f81d4e7e7
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cbflib/cbf_f16.patch
@@ -0,0 +1,17 @@
+--- a/src/fcb_skip_whitespace.f90 2021-01-26 15:14:30.565029427 +0900
++++ b/src/fcb_skip_whitespace.f90 2021-01-26 15:15:01.016918388 +0900
+@@ -65,11 +65,11 @@
+ END IF
+ ELSE
+ SELECT CASE (LINE(IC))
+- CASE (Z'5C') ! backslash
++ CASE (INT(Z'5C')) ! backslash
+ IC = IC+1 ! force skip of next character
+- CASE (Z'28') ! open paren
++ CASE (INT(Z'28')) ! open paren
+ COMMENT_LEVEL = COMMENT_LEVEL+1;
+- CASE (Z'29') ! close paren
++ CASE (INT(Z'29')) ! close paren
+ COMMENT_LEVEL = COMMENT_LEVEL-1;
+ END SELECT
+ IC = IC+1;
diff --git a/var/spack/repos/builtin/packages/cbflib/cbf_int.patch b/var/spack/repos/builtin/packages/cbflib/cbf_int.patch
new file mode 100644
index 0000000000..a234859d5e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cbflib/cbf_int.patch
@@ -0,0 +1,11 @@
+--- a/src/cbf_ws.c 2021-01-26 15:31:04.793960741 +0900
++++ b/src/cbf_ws.c 2021-01-26 15:32:08.092795581 +0900
+@@ -1034,7 +1034,7 @@
+
+ const char * line;
+
+- char c, cprev, cprevprev, cprevprevprev;
++ int c, cprev, cprevprev, cprevprevprev;
+
+ size_t length;
+
diff --git a/var/spack/repos/builtin/packages/cbflib/checkint.c b/var/spack/repos/builtin/packages/cbflib/checkint.c
new file mode 100644
index 0000000000..7187d6a5f9
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cbflib/checkint.c
@@ -0,0 +1,4 @@
+#include <limits.h>
+#if LONG_MAX == LLONG_MAX
+#error LONG=LLONG
+#endif
diff --git a/var/spack/repos/builtin/packages/cbflib/package.py b/var/spack/repos/builtin/packages/cbflib/package.py
new file mode 100644
index 0000000000..ed244db339
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cbflib/package.py
@@ -0,0 +1,43 @@
+# 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 *
+import os
+
+
+class Cbflib(MakefilePackage):
+ """CBFLIB is a library of ANSI-C functions providing a simple mechanism
+ for accessing Crystallographic Binary Files (CBF files) and
+ Image-supporting CIF (imgCIF) files."""
+
+ homepage = "http://www.bernstein-plus-sons.com/software/CBF/"
+ url = "https://downloads.sourceforge.net/project/cbflib/cbflib/CBFlib_0.9.2/CBFlib-0.9.2.tar.gz"
+
+ version('0.9.2', sha256='367e37e1908a65d5472e921150291332823a751206804866e752b793bca17afc')
+
+ depends_on('m4', type='build')
+
+ patch('cbf_f16.patch')
+ patch('cbf_int.patch')
+
+ def setup_build_environment(self, env):
+ ce = Executable(self.compiler.cc)
+ ce('-E', join_path(os.path.dirname(__file__), "checkint.c"),
+ output=str, error=str, fail_on_error=False)
+ if ce.returncode != 0:
+ env.set('CBF_DONT_USE_LONG_LONG', '1')
+
+ def edit(self, spec, prefix):
+ mf = FileFilter('Makefile')
+ mf.filter(r'^CC.+', "CC = {0}".format(spack_cc))
+ mf.filter(r'^C\+\+.+', "C++ = {0}".format(spack_cxx))
+ mf.filter('gfortran', spack_fc)
+ mf.filter(r'^INSTALLDIR .+', "INSTALLDIR = {0}".format(prefix))
+
+ def build(self, spec, prefix):
+ pass
+
+ def install(self, spec, prefix):
+ make('install', parallel=False)