Skip to content

Commit

Permalink
Add fortranxml package from COSIMA/spack_packages (#93)
Browse files Browse the repository at this point in the history
* Required by ACCESS-OM3
* Add url_for_version and removed url specification
* Update maintainer info
  • Loading branch information
CodeGat authored and harshula committed Apr 17, 2024
1 parent 611318e commit 0c2201b
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions packages/fortranxml/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2013-2022 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.package import *


class Fortranxml(AutotoolsPackage):
"""Fortran XML (FoX) s a library, written entirely in Fortran, designed to allow
the easy use of XML from Fortran programs. FoX caters for both XML output
and input.
"""

homepage = "https://github.com/andreww/fox"
git = "https://github.com/andreww/fox.git"

maintainers = ["harshula"]

version("4.1.2", sha256="dea0adc9cc035238fa9cdba42f2bf56481e3a64ac8aa0aece9119f127f71d4e7")

flag_handler = AutotoolsPackage.build_system_flags

def url_for_version(self, version):
return "https://github.com/andreww/fox/tarball/{0}".format(version)

def install(self, spec, prefix):
super(AutotoolsPackage, self).install(spec, prefix)

pkgconfig_dir = join_path(prefix.lib, "pkgconfig")
pkgconfig_file = join_path(pkgconfig_dir, "fox.pc")
mkdir(pkgconfig_dir)

with open(pkgconfig_file, "w", encoding="utf-8") as pc:
pc.write(f"""\
prefix={prefix}
exec_prefix=${{prefix}}
libdir=${{exec_prefix}}/lib
includedir=${{prefix}}/finclude
Name: Fortran XML (FoX)
Description: A Fortran XML library
Version: {spec.version}
Libs: -L${{libdir}} -lFoX_dom -lFoX_sax -lFoX_wcml -lFoX_wkml -lFoX_wxml -lFoX_common -lFoX_utils -lFoX_fsys
Cflags: -I${{includedir}}
""")

0 comments on commit 0c2201b

Please sign in to comment.