summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/photos-f/package.py44
-rw-r--r--var/spack/repos/builtin/packages/photos-f/photos-215.5-update-configure.patch73
2 files changed, 117 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/photos-f/package.py b/var/spack/repos/builtin/packages/photos-f/package.py
new file mode 100644
index 0000000000..b5471c30a7
--- /dev/null
+++ b/var/spack/repos/builtin/packages/photos-f/package.py
@@ -0,0 +1,44 @@
+# 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)
+
+import os
+import shutil
+from glob import glob
+
+from spack import *
+
+
+class PhotosF(MakefilePackage):
+ """PHOTOS Monte-Carlo generator (Fortran version)"""
+
+ homepage = "https://wasm.web.cern.ch/wasm/f77.html"
+ url = "http://cern.ch/service-spi/external/MCGenerators/distribution/photos/photos-215.5-src.tgz"
+
+ maintainers = ['iarspider']
+
+ version('215.5', sha256='3e2b3f60ffe2d3a6a95cf2f156aa24b93e1fa3c439a85fa0ae780ca2f6e0dbb5')
+
+ patch('photos-215.5-update-configure.patch', level=2)
+
+ def do_stage(self, mirror_only=False):
+ # Fix directory structure - remove extra "<version>" subdirectory
+ super(PhotosF, self).do_stage(mirror_only)
+ root = join_path(self.stage.source_path, self.spec.version)
+ for fn in os.listdir(root):
+ shutil.move(join_path(root, fn), self.stage.source_path)
+ shutil.rmtree(root)
+
+ def edit(self, spec, prefix):
+ configure_ = Executable('./configure')
+ configure_('--enable-static', '--disable-shared')
+ if self.spec.satisfies('platform=darwin'):
+ filter_file('libphotos.so', 'libphotos.dylib', 'Makefile')
+
+ def install(self, spec, prefix):
+ install_tree('lib', prefix.lib)
+ install_tree('include', prefix.include)
+ for fn in glob(join_path(prefix.lib.archive, '*.a')):
+ install(fn, prefix.lib)
+ shutil.rmtree(prefix.lib.archive)
diff --git a/var/spack/repos/builtin/packages/photos-f/photos-215.5-update-configure.patch b/var/spack/repos/builtin/packages/photos-f/photos-215.5-update-configure.patch
new file mode 100644
index 0000000000..bc136cef44
--- /dev/null
+++ b/var/spack/repos/builtin/packages/photos-f/photos-215.5-update-configure.patch
@@ -0,0 +1,73 @@
+diff --git a/215.5/Makefile b/215.5/Makefile
+index 648424f..73b5dce 100644
+--- a/215.5/Makefile
++++ b/215.5/Makefile
+@@ -11,6 +11,8 @@ SHELL = /bin/sh
+ #
+ FFLAGSSHARED = -fPIC
+ CFLAGSSHARED = -fPIC
++FFLAGS = -fPIC
++CFLAGS = -fPIC
+ #
+ LDFLAGSSHARED = $(CXXFLAGS) -pthread -fPIC
+
+diff --git a/215.5/Makeshared.subdir b/215.5/Makeshared.subdir
+index f167145..0a8f232 100644
+--- a/215.5/Makeshared.subdir
++++ b/215.5/Makeshared.subdir
+@@ -42,7 +42,14 @@ objects += $(patsubst $(DIRNAME)/%.c,$(TMPDIR)/%.o,$(wildcard $(DIRNAME)/*.c))
+ $(LIBNAME): $(objects)
+ @mkdir -p $(LIBDIR)
+ @echo creating the shared library $@
+- $(CXX) $(LDFLAGSSHARED) $(objects) -o $@ -shared -Wl,-soname,$(notdir $@)
++ case ${ARCH} in \
++ Linux-*) \
++ $(CXX) $(LDFLAGSSHARED) $(objects) -o $@ -shared -Wl,-soname,$(notdir $@) \
++ ;;\
++ Darwin-*) \
++ $(CXX) $(LDFLAGSSHARED) $(objects) -Wl,-commons,use_dylibs -o $@ -shared -L$(dir $(shell gfortran --print-file-name=libgfortran.a)) $(FLIBS) -dynamic \
++ ;; \
++ esac
+
+ deps := $(patsubst $(DIRNAME)/%.F,$(TMPDIR)/%.d,$(wildcard $(DIRNAME)/*.F))
+
+diff --git a/215.5/configure b/215.5/configure
+index c8382cc..105950e 100755
+--- a/215.5/configure
++++ b/215.5/configure
+@@ -74,10 +74,6 @@ export CXXFLAGS_DBG="-g -ansi -pedantic -W -Wall"
+ # Find platform.
+ #
+ export ARCH="`uname`"
+-export theGcc=`g++ --version | head -n 1 | awk '{print$3}' | awk -F . '{print $1}'`
+-if [ ${theGcc} = 4 ]; then
+- export ARCH=${ARCH}-gcc4
+-fi
+ echo Platform is $ARCH
+
+ #default platform settings:
+@@ -98,24 +94,6 @@ if [ ${COMPMODE} = DBG ]; then
+ export CXXFLAGS="${CXXFLAGS_DBG}"
+ fi
+ if [ $ARCH = Linux ]; then
+- export FC=g77
+- export FFLAGS="${FFLAGS_OPT} -Wno-globals"
+- export CFLAGS="${CFLAGS_OPT}"
+- export CXXFLAGS="${CXXFLAGS_OPT}"
+- export FLIBS="-lfrtbegin -lg2c"
+- if [ ${COMPMODE} = OPT ]; then
+- export FFLAGS="${FFLAGS_OPT}"
+- export CFLAGS="${CFLAGS_OPT}"
+- export CXXFLAGS="${CXXFLAGS_OPT}"
+- fi
+- if [ ${COMPMODE} = DBG ]; then
+- export FFLAGS="${FFLAGS_DBG} -Wno-globals"
+- export CFLAGS="${CFLAGS_DBG}"
+- export CXXFLAGS="${CXXFLAGS_DBG}"
+- fi
+-fi
+-# Linux platform with gcc4: new Fortran90 compiler.
+-if [ $ARCH = Linux-gcc4 ]; then
+ export FC=gfortran
+ export FFLAGS="${FFLAGS_OPT}"
+ export CFLAGS="${CFLAGS_OPT}"