summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/docs/build_systems.rst1
-rw-r--r--lib/spack/docs/build_systems/racketpackage.rst46
-rw-r--r--lib/spack/spack/build_systems/racket.py70
-rw-r--r--lib/spack/spack/cmd/create.py37
-rw-r--r--lib/spack/spack/pkgkit.py1
-rw-r--r--var/spack/repos/builtin/packages/rkt-base/package.py22
-rw-r--r--var/spack/repos/builtin/packages/rkt-cext-lib/package.py25
-rw-r--r--var/spack/repos/builtin/packages/rkt-compiler-lib/package.py25
-rw-r--r--var/spack/repos/builtin/packages/rkt-dynext-lib/package.py21
-rw-r--r--var/spack/repos/builtin/packages/rkt-rackunit-lib/package.py22
-rw-r--r--var/spack/repos/builtin/packages/rkt-scheme-lib/package.py20
-rw-r--r--var/spack/repos/builtin/packages/rkt-testing-util-lib/package.py21
-rw-r--r--var/spack/repos/builtin/packages/rkt-zo-lib/package.py21
13 files changed, 332 insertions, 0 deletions
diff --git a/lib/spack/docs/build_systems.rst b/lib/spack/docs/build_systems.rst
index 0ee80276b8..77fb5c7838 100644
--- a/lib/spack/docs/build_systems.rst
+++ b/lib/spack/docs/build_systems.rst
@@ -51,6 +51,7 @@ on these ideas for each distinct build system that Spack supports:
build_systems/perlpackage
build_systems/pythonpackage
build_systems/rpackage
+ build_systems/racketpackage
build_systems/rubypackage
.. toctree::
diff --git a/lib/spack/docs/build_systems/racketpackage.rst b/lib/spack/docs/build_systems/racketpackage.rst
new file mode 100644
index 0000000000..8ba37ceeba
--- /dev/null
+++ b/lib/spack/docs/build_systems/racketpackage.rst
@@ -0,0 +1,46 @@
+.. 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)
+
+.. _racketpackage:
+
+-------------
+RacketPackage
+-------------
+
+Much like Python, Racket packages and modules have their own special build system.
+To learn more about the specifics of Racket package system, please refer to the
+`Racket Docs <https://docs.racket-lang.org/pkg/cmdline.html>`_.
+
+^^^^^^
+Phases
+^^^^^^
+
+The ``RacketPackage`` base class provides an ``install`` phase that
+can be overridden, corresponding to the use of:
+
+.. code-block:: console
+
+ $ raco pkg install
+
+^^^^^^^
+Caveats
+^^^^^^^
+
+In principle, ``raco`` supports a second, ``setup`` phase; however, we have not
+implemented this separately, as in normal circumstances, ``install`` also handles
+running ``setup`` automatically.
+
+Unlike Python, Racket currently on supports two installation scopes for packages, user
+or system, and keeps a registry of installed packages at each scope in its configuration files.
+This means we can't simply compose a "``RACKET_PATH``" environment variable listing all of the
+places packages are installed, and update this at will.
+
+Unfortunately this means that all currently installed packages which extend Racket via ``raco pkg install``
+are accessible whenever Racket is accessible.
+
+Additionally, because Spack does not implement uninstall hooks, uninstalling a Spack ``rkt-`` package
+will have no effect on the ``raco`` installed packages visible to your Racket installation.
+Instead, you must manually run ``raco pkg remove`` to keep the two package managers in a mutually
+consistent state.
diff --git a/lib/spack/spack/build_systems/racket.py b/lib/spack/spack/build_systems/racket.py
new file mode 100644
index 0000000000..5bb4026cf4
--- /dev/null
+++ b/lib/spack/spack/build_systems/racket.py
@@ -0,0 +1,70 @@
+# 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 llnl.util.tty as tty
+from llnl.util.filesystem import working_dir
+
+from spack.build_environment import SPACK_NO_PARALLEL_MAKE, determine_number_of_jobs
+from spack.directives import extends
+from spack.package import PackageBase
+from spack.util.environment import env_flag
+from spack.util.executable import Executable, ProcessError
+
+
+class RacketPackage(PackageBase):
+ """Specialized class for packages that are built using Racket's
+ `raco pkg install` and `raco setup` commands.
+
+ This class provides the following phases that can be overridden:
+
+ * install
+ * setup
+ """
+ #: Package name, version, and extension on PyPI
+ maintainers = ['elfprince13']
+
+ # Default phases
+ phases = ['install']
+
+ # To be used in UI queries that require to know which
+ # build-system class we are using
+ build_system_class = 'RacketPackage'
+
+ extends('racket')
+
+ pkgs = False
+ subdirectory = None
+ name = None
+ parallel = True
+
+ @property
+ def homepage(self):
+ if self.pkgs:
+ return 'https://pkgs.racket-lang.org/package/{0}'.format(self.name)
+
+ @property
+ def build_directory(self):
+ ret = os.getcwd()
+ if self.subdirectory:
+ ret = os.path.join(ret, self.subdirectory)
+ return ret
+
+ def install(self, spec, prefix):
+ """Install everything from build directory."""
+ raco = Executable("raco")
+ with working_dir(self.build_directory):
+ allow_parallel = self.parallel and (not env_flag(SPACK_NO_PARALLEL_MAKE))
+ args = ['pkg', 'install', '-t', 'dir', '-n', self.name, '--deps', 'fail',
+ '--ignore-implies', '--copy', '-i', '-j',
+ str(determine_number_of_jobs(allow_parallel)),
+ '--', os.getcwd()]
+ try:
+ raco(*args)
+ except ProcessError:
+ args.insert(-2, "--skip-installed")
+ raco(*args)
+ tty.warn(("Racket package {0} was already installed, uninstalling via "
+ "Spack may make someone unhappy!").format(self.name))
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index 1281c6d9ef..14463127d3 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -258,6 +258,42 @@ class BazelPackageTemplate(PackageTemplate):
bazel()"""
+class RacketPackageTemplate(PackageTemplate):
+ """Provides approriate overrides for Racket extensions"""
+ base_class_name = 'RacketPackage'
+
+ url_line = """\
+ # FIXME: set the proper location from which to fetch your package
+ git = "git@github.com:example/example.git"
+ """
+
+ dependencies = """\
+ # FIXME: Add dependencies if required. Only add the racket dependency
+ # if you need specific versions. A generic racket dependency is
+ # added implicity by the RacketPackage class.
+ # depends_on('racket@8.3:', type=('build', 'run'))"""
+
+ body_def = """\
+ # FIXME: specify the name of the package,
+ # as it should appear to ``raco pkg install``
+ name = '{0}'
+ # FIXME: set to true if published on pkgs.racket-lang.org
+ # pkgs = False
+ # FIXME: specify path to the root directory of the
+ # package, if not the base directory
+ # subdirectory = None
+ """
+
+ def __init__(self, name, url, *args, **kwargs):
+ # If the user provided `--name rkt-scribble`, don't rename it rkt-rkt-scribble
+ if not name.startswith('rkt-'):
+ # Make it more obvious that we are renaming the package
+ tty.msg("Changing package name from {0} to rkt-{0}".format(name))
+ name = 'rkt-{0}'.format(name)
+ self.body_def = self.body_def.format(name[4:])
+ super(RacketPackageTemplate, self).__init__(name, url, *args, **kwargs)
+
+
class PythonPackageTemplate(PackageTemplate):
"""Provides appropriate overrides for python extensions"""
base_class_name = 'PythonPackage'
@@ -536,6 +572,7 @@ templates = {
'bazel': BazelPackageTemplate,
'python': PythonPackageTemplate,
'r': RPackageTemplate,
+ 'racket': RacketPackageTemplate,
'perlmake': PerlmakePackageTemplate,
'perlbuild': PerlbuildPackageTemplate,
'octave': OctavePackageTemplate,
diff --git a/lib/spack/spack/pkgkit.py b/lib/spack/spack/pkgkit.py
index ba1f5f377b..f4dd3dbe61 100644
--- a/lib/spack/spack/pkgkit.py
+++ b/lib/spack/spack/pkgkit.py
@@ -38,6 +38,7 @@ from spack.build_systems.perl import PerlPackage
from spack.build_systems.python import PythonPackage
from spack.build_systems.qmake import QMakePackage
from spack.build_systems.r import RPackage
+from spack.build_systems.racket import RacketPackage
from spack.build_systems.rocm import ROCmPackage
from spack.build_systems.ruby import RubyPackage
from spack.build_systems.scons import SConsPackage
diff --git a/var/spack/repos/builtin/packages/rkt-base/package.py b/var/spack/repos/builtin/packages/rkt-base/package.py
new file mode 100644
index 0000000000..36d7987a97
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-base/package.py
@@ -0,0 +1,22 @@
+# 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 RktBase(RacketPackage):
+ """Stub package for packages which are currently part of core
+ racket installation (but which may change in the future)."""
+
+ git = "ssh://git@github.com/racket/racket.git"
+
+ maintainers = ['elfprince13']
+
+ version('8.3', commit='cab83438422bfea0e4bd74bc3e8305e6517cf25f') # tag='v8.3'
+ depends_on('racket@8.3', type=('build', 'run'), when='@8.3')
+
+ name = 'base'
+ pkgs = True
+ subdirectory = "pkgs/{0}".format(name)
diff --git a/var/spack/repos/builtin/packages/rkt-cext-lib/package.py b/var/spack/repos/builtin/packages/rkt-cext-lib/package.py
new file mode 100644
index 0000000000..ed49ab3406
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-cext-lib/package.py
@@ -0,0 +1,25 @@
+# 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 RktCextLib(RacketPackage):
+ """Racket library for running a C compiler/linker."""
+
+ git = "ssh://git@github.com/racket/cext-lib.git"
+
+ maintainers = ['elfprince13']
+
+ version('8.3', commit='cc22e2456df881a9008240d70dd9012ef37395f5') # tag = 'v8.3'
+
+ depends_on('rkt-base@8.3', type=('build', 'run'), when='@8.3')
+ depends_on('rkt-compiler-lib@8.3', type=('build', 'run'), when='@8.3')
+ depends_on('rkt-dynext-lib@8.3', type=('build', 'run'), when='@8.3')
+ depends_on('rkt-scheme-lib@8.3', type=('build', 'run'), when='@8.3')
+
+ name = 'cext-lib'
+ pkgs = True
+ subdirectory = name
diff --git a/var/spack/repos/builtin/packages/rkt-compiler-lib/package.py b/var/spack/repos/builtin/packages/rkt-compiler-lib/package.py
new file mode 100644
index 0000000000..c7c333e4cd
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-compiler-lib/package.py
@@ -0,0 +1,25 @@
+# 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 RktCompilerLib(RacketPackage):
+ """Stub package for packages which are currently part of core
+ Racket installation (but which may change in the future)."""
+
+ git = "ssh://git@github.com/racket/racket.git"
+
+ maintainers = ['elfprince13']
+
+ version('8.3', commit='cab83438422bfea0e4bd74bc3e8305e6517cf25f') # tag='v8.3'
+ depends_on('rkt-base@8.3', type=('build', 'run'), when='@8.3')
+ depends_on('rkt-scheme-lib@8.3', type=('build', 'run'), when='@8.3')
+ depends_on('rkt-rackunit-lib@8.3', type=('build', 'run'), when='@8.3')
+ depends_on('rkt-zo-lib@1.3', type=('build', 'run'), when='@8.3')
+
+ name = 'compiler-lib'
+ pkgs = True
+ subdirectory = "pkgs/{0}".format(name)
diff --git a/var/spack/repos/builtin/packages/rkt-dynext-lib/package.py b/var/spack/repos/builtin/packages/rkt-dynext-lib/package.py
new file mode 100644
index 0000000000..cc57851776
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-dynext-lib/package.py
@@ -0,0 +1,21 @@
+# 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 RktDynextLib(RacketPackage):
+ """Racket library for running a C compiler/linker."""
+
+ git = "ssh://git@github.com/racket/cext-lib.git"
+
+ maintainers = ['elfprince13']
+
+ version('8.3', commit='cc22e2456df881a9008240d70dd9012ef37395f5') # tag = 'v8.3'
+ depends_on('rkt-base@8.3', type=('build', 'run'), when='@8.3')
+
+ name = 'dynext-lib'
+ pkgs = True
+ subdirectory = name
diff --git a/var/spack/repos/builtin/packages/rkt-rackunit-lib/package.py b/var/spack/repos/builtin/packages/rkt-rackunit-lib/package.py
new file mode 100644
index 0000000000..c1d7aa7444
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-rackunit-lib/package.py
@@ -0,0 +1,22 @@
+# 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 RktRackunitLib(RacketPackage):
+ """RackUnit testing framework."""
+
+ git = "ssh://git@github.com/racket/rackunit.git"
+
+ maintainers = ['elfprince13']
+
+ version('8.3', commit='683237bee2a979c7b1541092922fb51a75ea8ca9') # tag='v8.3'
+ depends_on('rkt-base@8.3:', type=('build', 'run'), when='@8.3')
+ depends_on('rkt-testing-util-lib@8.3', type=('build', 'run'), when='@8.3')
+
+ name = 'rackunit-lib'
+ pkgs = True
+ subdirectory = name
diff --git a/var/spack/repos/builtin/packages/rkt-scheme-lib/package.py b/var/spack/repos/builtin/packages/rkt-scheme-lib/package.py
new file mode 100644
index 0000000000..e98c6d33f7
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-scheme-lib/package.py
@@ -0,0 +1,20 @@
+# 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 RktSchemeLib(RacketPackage):
+ """Legacy Scheme Library."""
+
+ git = "ssh://git@github.com/racket/scheme-lib.git"
+
+ maintainers = ['elfprince13']
+
+ version('8.3', commit='a36e729680818712820ee5269f5208c3c0715a6a') # tag='v8.3'
+ depends_on('rkt-base@8.3', type=('build', 'run'), when='@8.3')
+
+ name = 'scheme-lib'
+ pkgs = True
diff --git a/var/spack/repos/builtin/packages/rkt-testing-util-lib/package.py b/var/spack/repos/builtin/packages/rkt-testing-util-lib/package.py
new file mode 100644
index 0000000000..a9d6e973ff
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-testing-util-lib/package.py
@@ -0,0 +1,21 @@
+# 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 RktTestingUtilLib(RacketPackage):
+ """Utilities for interoperating between different testing libraries."""
+
+ git = "ssh://git@github.com/racket/rackunit.git"
+
+ maintainers = ['elfprince13']
+
+ version('8.3', commit='683237bee2a979c7b1541092922fb51a75ea8ca9') # tag='v8.3'
+ depends_on('rkt-base@8.3:', type=('build', 'run'), when='@8.3')
+
+ name = 'testing-util-lib'
+ pkgs = True
+ subdirectory = name
diff --git a/var/spack/repos/builtin/packages/rkt-zo-lib/package.py b/var/spack/repos/builtin/packages/rkt-zo-lib/package.py
new file mode 100644
index 0000000000..10042fc6bd
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rkt-zo-lib/package.py
@@ -0,0 +1,21 @@
+# 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 RktZoLib(RacketPackage):
+ """Libraries for handling zo files."""
+
+ git = "ssh://git@github.com/racket/racket.git"
+
+ maintainers = ['elfprince13']
+
+ version('1.3', commit='cab83438422bfea0e4bd74bc3e8305e6517cf25f') # tag='v1.3'
+ depends_on('rkt-base@8.3:', type=('build', 'run'), when='@1.3')
+
+ name = 'zo-lib'
+ pkgs = True
+ subdirectory = "pkgs/{0}".format(name)