From db74f4c3a154e8ce3ac289aca0f17f08c526de2b Mon Sep 17 00:00:00 2001
From: snehring <snehring@users.noreply.github.com>
Date: Sat, 5 Aug 2017 14:53:09 -0500
Subject: [PATCH] Add a new package for IcedTea (#4804)

* alsa-lib: new package

* cups: new package

* icedtea: new package

* icedtea: adding JAVA_HOME variable

* alsa: removing placeholder

* icedtea: typo fix

* alsa: fixing formattting

* icedtea: formatting fixes and cleanup

* icedtea: additional cleanup

* jdk: adding provides('java') to jdk, setting jdk to default java.

* icedtea: adding jdk as a dependency

* java: changing depends_on('jdk') and similar entries to depends_on('java')

* icedtea: removing unused imports, trying to placate flake8.

* fastqc: fixing flake8 error

* bazel: fixing typo in java dependency

* jdk: changing provides java to a range

* icedtea: cleaning up. Splitting up checksums.

* icedtea: jdk dependency is build only
---
 etc/spack/defaults/packages.yaml              |   1 +
 .../builtin/packages/alsa-lib/package.py      |  36 ++++
 .../repos/builtin/packages/ant/package.py     |   2 +-
 .../repos/builtin/packages/antlr/package.py   |   2 +-
 .../repos/builtin/packages/bazel/package.py   |   2 +-
 .../repos/builtin/packages/beast2/package.py  |   2 +-
 .../repos/builtin/packages/cups/package.py    |  44 +++++
 .../repos/builtin/packages/fastqc/package.py  |   5 +-
 .../repos/builtin/packages/fseq/package.py    |   2 +-
 .../repos/builtin/packages/gradle/package.py  |   2 +-
 .../builtin/packages/graphviz/package.py      |   2 +-
 .../repos/builtin/packages/hadoop/package.py  |   2 +-
 .../repos/builtin/packages/icedtea/package.py | 181 ++++++++++++++++++
 .../repos/builtin/packages/jdk/package.py     |   3 +
 .../repos/builtin/packages/jmol/package.py    |   2 +-
 .../repos/builtin/packages/maven/package.py   |   2 +-
 .../builtin/packages/nextflow/package.py      |   2 +-
 .../repos/builtin/packages/octave/package.py  |   8 +-
 .../repos/builtin/packages/opencv/package.py  |   2 +-
 .../repos/builtin/packages/openmpi/package.py |   4 +-
 .../repos/builtin/packages/picard/package.py  |   4 +-
 .../builtin/packages/py-jpype/package.py      |   2 +-
 .../repos/builtin/packages/r-rjava/package.py |   2 +-
 var/spack/repos/builtin/packages/r/package.py |   2 +-
 .../repos/builtin/packages/rose/package.py    |   2 +-
 .../repos/builtin/packages/sbt/package.py     |   2 +-
 .../repos/builtin/packages/scala/package.py   |   2 +-
 .../repos/builtin/packages/spark/package.py   |   4 +-
 .../repos/builtin/packages/stc/package.py     |   2 +-
 .../repos/builtin/packages/thrift/package.py  |   4 +-
 .../builtin/packages/trimmomatic/package.py   |   4 +-
 31 files changed, 301 insertions(+), 35 deletions(-)
 create mode 100644 var/spack/repos/builtin/packages/alsa-lib/package.py
 create mode 100644 var/spack/repos/builtin/packages/cups/package.py
 create mode 100644 var/spack/repos/builtin/packages/icedtea/package.py

diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml
index 36c304d6bf..df785c5aa5 100644
--- a/etc/spack/defaults/packages.yaml
+++ b/etc/spack/defaults/packages.yaml
@@ -23,6 +23,7 @@ packages:
       elf: [elfutils]
       golang: [gcc]
       ipp: [intel-parallel-studio+ipp]
+      java: [jdk]
       lapack: [openblas]
       mkl: [intel-parallel-studio+mkl]
       mpe: [mpe2]
diff --git a/var/spack/repos/builtin/packages/alsa-lib/package.py b/var/spack/repos/builtin/packages/alsa-lib/package.py
new file mode 100644
index 0000000000..8d92b398e8
--- /dev/null
+++ b/var/spack/repos/builtin/packages/alsa-lib/package.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+from spack import *
+
+
+class AlsaLib(AutotoolsPackage):
+    """The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
+    functionality to the Linux operating system. alsa-lib contains the user
+    space library that developers compile ALSA applications against."""
+
+    homepage = "https://www.alsa-project.org"
+    url      = "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.4.1.tar.bz2"
+
+    version('1.1.4.1', '29fa3e69122d3cf3e8f0e01a0cb1d183')
diff --git a/var/spack/repos/builtin/packages/ant/package.py b/var/spack/repos/builtin/packages/ant/package.py
index b2fb647694..a2ba25f3ac 100644
--- a/var/spack/repos/builtin/packages/ant/package.py
+++ b/var/spack/repos/builtin/packages/ant/package.py
@@ -41,7 +41,7 @@ class Ant(Package):
     version('1.9.7',  'a2fd9458c76700b7be51ef12f07d4bb1')
     version('1.9.6',  '29b7507c9053e301d2b85091f2aec6f0')
 
-    depends_on('jdk')
+    depends_on('java')
 
     def install(self, spec, prefix):
         env['ANT_HOME'] = self.prefix
diff --git a/var/spack/repos/builtin/packages/antlr/package.py b/var/spack/repos/builtin/packages/antlr/package.py
index 4de61e6b10..b2e2b0a6a5 100644
--- a/var/spack/repos/builtin/packages/antlr/package.py
+++ b/var/spack/repos/builtin/packages/antlr/package.py
@@ -45,7 +45,7 @@ class Antlr(AutotoolsPackage):
     variant('python', default=False, description='Enable ANTLR for Python')
 
     extends('python', when='+python')
-    depends_on('jdk', type=('build', 'run'), when='+java')
+    depends_on('java', type=('build', 'run'), when='+java')
 
     def configure_args(self):
         spec = self.spec
diff --git a/var/spack/repos/builtin/packages/bazel/package.py b/var/spack/repos/builtin/packages/bazel/package.py
index 17b7992a1b..a9573dbe2b 100644
--- a/var/spack/repos/builtin/packages/bazel/package.py
+++ b/var/spack/repos/builtin/packages/bazel/package.py
@@ -42,7 +42,7 @@ class Bazel(Package):
     version('0.2.2b', '75081804f073cbd194da1a07b16cba5f')
     version('0.2.2', '644bc4ea7f429d835e74f255dc1054e6')
 
-    depends_on('jdk@8:')
+    depends_on('java@8:')
     depends_on('zip')
 
     patch('fix_env_handling.patch')
diff --git a/var/spack/repos/builtin/packages/beast2/package.py b/var/spack/repos/builtin/packages/beast2/package.py
index ceeb94ab7f..77acaa01f3 100644
--- a/var/spack/repos/builtin/packages/beast2/package.py
+++ b/var/spack/repos/builtin/packages/beast2/package.py
@@ -38,7 +38,7 @@ class Beast2(Package):
 
     version('2.4.6', 'b446f4ab121df9b991f7bb7ec94c8217')
 
-    depends_on('jdk')
+    depends_on('java')
 
     def setup_environment(self, spack_env, run_env):
         run_env.set('BEAST', self.prefix)
diff --git a/var/spack/repos/builtin/packages/cups/package.py b/var/spack/repos/builtin/packages/cups/package.py
new file mode 100644
index 0000000000..311e779b8c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cups/package.py
@@ -0,0 +1,44 @@
+##############################################################################
+# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+from spack import *
+
+
+class Cups(AutotoolsPackage):
+    """CUPS is the standards-based, open source printing system developed by
+    Apple Inc. for macOS and other UNIX-like operating systems. CUPS uses the
+    Internet Printing Protocol (IPP) to support printing to local and network
+    printers. This provides the core CUPS libraries, not a complete CUPS
+    install."""
+
+    homepage = "https://www.cups.org/"
+    url = "https://github.com/apple/cups/releases/download/v2.2.3/cups-2.2.3-source.tar.gz"
+
+    version('2.2.3', '006a8156680a516e43c59034e31df8bf')
+
+    depends_on('gnutls')
+
+    def configure_args(self):
+        args = ['--enable-gnutls', '--with-components=core']
+        return args
diff --git a/var/spack/repos/builtin/packages/fastqc/package.py b/var/spack/repos/builtin/packages/fastqc/package.py
index ae06252fc1..d4abd8aceb 100644
--- a/var/spack/repos/builtin/packages/fastqc/package.py
+++ b/var/spack/repos/builtin/packages/fastqc/package.py
@@ -36,7 +36,7 @@ class Fastqc(Package):
     version('0.11.5', '3524f101c0ab0bae77c7595983170a76')
     version('0.11.4', '104ff2e0e9aebf5bee1f6b068a059b0d')
 
-    depends_on('jdk', type='run')
+    depends_on('java', type='run')
     depends_on('perl')          # for fastqc "script", any perl will do
 
     patch('fastqc.patch', level=0)
@@ -58,4 +58,5 @@ def setup_environment(self, spack_env, run_env):
         """Add <prefix> to the path; the package has a script at the
            top level.
         """
-        run_env.prepend_path('PATH', join_path(self.spec['jdk'].prefix, 'bin'))
+        run_env.prepend_path('PATH', join_path(self.spec['java'].prefix,
+                             'bin'))
diff --git a/var/spack/repos/builtin/packages/fseq/package.py b/var/spack/repos/builtin/packages/fseq/package.py
index b0d17eb69e..71f450ec42 100644
--- a/var/spack/repos/builtin/packages/fseq/package.py
+++ b/var/spack/repos/builtin/packages/fseq/package.py
@@ -33,7 +33,7 @@ class Fseq(Package):
 
     version('1.84', 'f9124ad0f45c60f3a7eb74dde8c945b9')
 
-    depends_on('jdk', type=('build', 'run'))
+    depends_on('java', type=('build', 'run'))
 
     def install(self, spec, prefix):
         install_tree('bin', prefix.bin)
diff --git a/var/spack/repos/builtin/packages/gradle/package.py b/var/spack/repos/builtin/packages/gradle/package.py
index d39ba5e685..1eef10463e 100644
--- a/var/spack/repos/builtin/packages/gradle/package.py
+++ b/var/spack/repos/builtin/packages/gradle/package.py
@@ -77,7 +77,7 @@ class Gradle(Package):
     version('0.8',    '73a0ed51b6ec00a7d3a9d242d51aae60')
     version('0.7',    'a8417dbbd62f7013002cb55a44f12cc3')
 
-    depends_on('jdk')
+    depends_on('java')
 
     def install(self, spec, prefix):
         copy_tree('.', prefix)
diff --git a/var/spack/repos/builtin/packages/graphviz/package.py b/var/spack/repos/builtin/packages/graphviz/package.py
index 9efbc85789..2f39c8ce1f 100644
--- a/var/spack/repos/builtin/packages/graphviz/package.py
+++ b/var/spack/repos/builtin/packages/graphviz/package.py
@@ -104,7 +104,7 @@ class Graphviz(AutotoolsPackage):
     depends_on('libtool')
     depends_on('pkg-config', type='build')
 
-    depends_on('jdk', when='+java')
+    depends_on('java', when='+java')
     depends_on('python@2:2.8', when='+python')
 
     def patch(self):
diff --git a/var/spack/repos/builtin/packages/hadoop/package.py b/var/spack/repos/builtin/packages/hadoop/package.py
index 4981a0bb58..3aa632b9df 100644
--- a/var/spack/repos/builtin/packages/hadoop/package.py
+++ b/var/spack/repos/builtin/packages/hadoop/package.py
@@ -36,7 +36,7 @@ class Hadoop(Package):
 
     version('2.6.4', '37019f13d7dcd819727be158440b9442')
 
-    depends_on('jdk', type='run')
+    depends_on('java', type='run')
 
     def install(self, spec, prefix):
 
diff --git a/var/spack/repos/builtin/packages/icedtea/package.py b/var/spack/repos/builtin/packages/icedtea/package.py
new file mode 100644
index 0000000000..7fd096cc77
--- /dev/null
+++ b/var/spack/repos/builtin/packages/icedtea/package.py
@@ -0,0 +1,181 @@
+##############################################################################
+# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the LICENSE file for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+from spack import *
+import os
+
+
+class Icedtea(AutotoolsPackage):
+    """The IcedTea project provides a harness to build the source code from
+    http://openjdk.java.net using Free Software build tools and adds a number
+    of key features to the upstream OpenJDK codebase. IcedTea requires an
+    existing IcedTea or OpenJDK install to build."""
+
+    homepage = "http://icedtea.classpath.org/wiki/Main_Page"
+    url      = "http://icedtea.wildebeest.org/download/source/icedtea-3.4.0.tar.gz"
+
+    version('3.4.0',  'eba66765b92794495e16b83f23640872')
+
+    provides('java@8', when='@3.4.0:3.99.99')
+    variant('X', default=False, description="Build with GUI support.")
+    variant('shenandoah', default=False,
+            description="Build with the shenandoah gc. Only for version 3+")
+
+    depends_on('pkg-config@0.9.0:', type='build')
+    depends_on('gmake', type='build')
+    depends_on('cups')
+    depends_on('jdk', type='build')
+    # X11 deps required for building even when headless
+    depends_on('libx11', when='~X', type='build')
+    depends_on('xproto', when='~X', type='build')
+    depends_on('libxext', when='~X', type='build')
+    depends_on('libxtst', when='~X', type='build')
+    depends_on('libxi', when='~X', type='build')
+    depends_on('libxt', when='~X', type='build')
+    depends_on('libxinerama', when='~X', type='build')
+    depends_on('libxrender', when='~X', type='build')
+    depends_on('libxcomposite', when='~X', type='build')
+    depends_on('libxau', when='~X', type='build')
+    depends_on('libxdmcp', when='~X', type='build')
+    depends_on('gtkplus+X', when='~X', type='build')
+
+    depends_on('libx11', when='+X')
+    depends_on('xproto', when='+X')
+    depends_on('libxext', when='+X')
+    depends_on('libxtst', when='+X')
+    depends_on('libxi', when='+X')
+    depends_on('libxt', when='+X')
+    depends_on('libxinerama', when='+X')
+    depends_on('libxrender', when='+X')
+    depends_on('libxcomposite', when='+X')
+    depends_on('libxau', when='+X')
+    depends_on('libxdmcp', when='+X')
+    depends_on('gtkplus+X', when='+X')
+
+    depends_on('freetype@2:')
+    depends_on('wget', type='build')
+    depends_on('giflib')
+    depends_on('libpng')
+    depends_on('jpeg')
+    depends_on('lcms')
+    depends_on('zlib')
+    depends_on('alsa-lib')
+
+    force_autoreconf = True
+
+    resource(name='corba', placement='corba_src',
+             sha512=('f0579608ab1342df231c4542dab1c40e648cda8e9780ea584fd476'
+                     '79b07c93508cbfa85f0406d8aa8b9d528fc5bd99c9d41469568fbec'
+                     '41a6456a13d914ac71c'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/corba.tar.xz',
+             when='@3.4.0')
+    resource(name='hotspot', placement='hotspot_src',
+             sha512=('29bc953d283f0a0a464fa150e2c4d71b0adaa29da67246843d230f3'
+                     '70b5a20227fb40ef6a7e3b93f10b0cdec18b0cd2bbbceeaea3c9db4'
+                     'd64c158cc23babbad2'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/hotspot.tar.xz',
+             when='@3.4.0')
+    resource(name='jaxp', placement='jaxp_src',
+             sha512=('ef3ed47815e6d15f40c5947fee1058c252ac673f70b6bf7c30505fa'
+                     'a12fa5cbab8168d816abe7791dc88acec457744883db4c0af23fb21'
+                     '66bbb709e870685bcd'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/jaxp.tar.xz',
+             when='@3.4.0')
+    resource(name='jaxws', placement='jaxws_src',
+             sha512=('867cac2919e715190596ae4f73fa42c6cba839ba48ae940adcef20a'
+                     'bfb23ffeeaa2501c4aedc214b3595bc4e2a4eea9fa7e7cac62a3420'
+                     'a11fb30a1f7edc9254'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/jaxws.tar.xz',
+             when='@3.4.0')
+    resource(name='jdk', placement='jdk_src',
+             sha512=('180d7b4435e465d68ed0b420b42dddc598c872075e225b8885ae183'
+                     '3fa4ab5034ce5083c4dfba516a21b2d472321b37a01ba92793e17c7'
+                     '8e9fddb1e254f12065'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/jdk.tar.xz',
+             when='@3.4.0')
+    resource(name='langtools', placement='langtools_src',
+             sha512=('0663f40b07de88cd7939557bf7fdb92077d7ca2132e369caefa82db'
+                     '887261ea02102864d33ec0fef3b2c80dd366d25dbc1a95144139498'
+                     'be581dfabe913e4312'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/langtools.tar.xz',
+             when='@3.4.0')
+    resource(name='openjdk', placement='openjdk_src',
+             sha512=('f3cca223bd39c0202dd1a65a38ca17024b6cb5c82d833946ec1b7d2'
+                     '8d205833b4dd2dadde505a1c2384e3b28ff0d21a4f175e064b8ac82'
+                     'aa8a07508e53cdc722'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/openjdk.tar.xz',
+             when='@3.4.0')
+    resource(name='nashorn', placement='nashorn_src',
+             sha512=('79b5095bab447d1911696bc1e328fb72c08764c0139cab14a28c0f6'
+                     'c2e49a2d96bb06fbbb85523b2586672cb0f13709c3158823d5ac3f3'
+                     'fe3f0f88402d3cb246'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/nashorn.tar.xz',
+             when='@3.4.0')
+    resource(name='shenandoah', placement='shenandoah_src',
+             sha512=('0f085e87c63679314ef322b3f4b854792d46539d5530dd75a7fd45b'
+                     '8b6d663f58469be2808ea5fb4bf31f6c5369cb78f28e1599f748e19'
+                     '31ba7040136306eb20'),
+             url='http://icedtea.wildebeest.org/download/drops/icedtea8/3.4.0/shenandoah.tar.xz',
+             when='@3.4.0')
+
+    def configure_args(self):
+        os.environ['POTENTIAL_CXX'] = os.environ['CXX']
+        os.environ['POTENTIAL_CC'] = os.environ['CC']
+        os.environ['WGET'] = self.spec['wget'].command.path
+        args = []
+        if '~X' in self.spec:
+            args.append('--enable-headless')
+        if '+shenandoah' in self.spec:
+            args.append('--with-hotspot-build=shenandoah')
+            args.append('--with-hotspot-src-zip=' + self.stage[9].archive_file)
+            args.append('--with-hotspot-checksum=no')
+        else:
+            args.append('--with-hotspot-src-zip=' + self.stage[2].archive_file)
+            args.append('--with-hotspot-checksum=no')
+        args += [
+            '--with-corba-src-zip=' + self.stage[1].archive_file,
+            '--with-cobra-checksum=no',
+            '--with-jaxp-src-zip=' + self.stage[3].archive_file,
+            '--with-jaxp-checksum=no',
+            '--with-jaxws-src-zip=' + self.stage[4].archive_file,
+            '--with-jaxws-checksum=no',
+            '--with-jdk-src-zip=' + self.stage[5].archive_file,
+            '--with-jdk-checksum=no',
+            '--with-langtools-src-zip=' + self.stage[6].archive_file,
+            '--with-langtools-checksum=no',
+            '--with-openjdk-src-zip=' + self.stage[7].archive_file,
+            '--with-openjdk-checksum=no',
+            '--with-nashorn-src-zip=' + self.stage[8].archive_file,
+            '--with-nashorn-checksum=no', '--disable-maintainer-mode'
+            '--disable-downloading', '--disable-system-pcsc',
+            '--disable-system-sctp', '--disable-system-kerberos',
+            '--with-jdk-home=' + self.spec['jdk'].prefix
+        ]
+        return args
+
+    def setup_environment(self, spack_env, run_env):
+        run_env.set('JAVA_HOME', self.spec.prefix)
+
+    def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
+        spack_env.set('JAVA_HOME', self.prefix)
diff --git a/var/spack/repos/builtin/packages/jdk/package.py b/var/spack/repos/builtin/packages/jdk/package.py
index 249b03a74f..65dad76ce2 100644
--- a/var/spack/repos/builtin/packages/jdk/package.py
+++ b/var/spack/repos/builtin/packages/jdk/package.py
@@ -60,6 +60,9 @@ class Jdk(Package):
     # away you go.
     version('7u80-b0', '6152f8a7561acf795ca4701daa10a965')
 
+    provides('java@8', when='@8u0:8u999')
+    provides('java@7', when='@7u0:7u999')
+
     def url_for_version(self, version):
         url = "http://download.oracle.com/otn-pub/java/jdk/{0}/jdk-{1}-linux-x64.tar.gz"
         version = str(version)
diff --git a/var/spack/repos/builtin/packages/jmol/package.py b/var/spack/repos/builtin/packages/jmol/package.py
index 3529515d3f..f07e07f866 100644
--- a/var/spack/repos/builtin/packages/jmol/package.py
+++ b/var/spack/repos/builtin/packages/jmol/package.py
@@ -35,7 +35,7 @@ class Jmol(Package):
 
     version('14.8.0', '3c9f4004b9e617ea3ea0b78ab32397ea')
 
-    depends_on('jdk', type='run')
+    depends_on('java', type='run')
 
     def install(self, spec, prefix):
         copy_tree('jmol-{0}'.format(self.version), prefix)
diff --git a/var/spack/repos/builtin/packages/maven/package.py b/var/spack/repos/builtin/packages/maven/package.py
index 347f05a764..550ce467e2 100644
--- a/var/spack/repos/builtin/packages/maven/package.py
+++ b/var/spack/repos/builtin/packages/maven/package.py
@@ -34,7 +34,7 @@ class Maven(Package):
 
     version('3.3.9', '516923b3955b6035ba6b0a5b031fbd8b')
 
-    depends_on('jdk')
+    depends_on('java')
 
     def install(self, spec, prefix):
         # install pre-built distribution
diff --git a/var/spack/repos/builtin/packages/nextflow/package.py b/var/spack/repos/builtin/packages/nextflow/package.py
index a44df66b07..b9c52f34b7 100644
--- a/var/spack/repos/builtin/packages/nextflow/package.py
+++ b/var/spack/repos/builtin/packages/nextflow/package.py
@@ -40,7 +40,7 @@ class Nextflow(Package):
     version('0.17.3', '5df00105fb1ce6fd0ba019ae735d9617',
             expand=False)
 
-    depends_on('jdk')
+    depends_on('java')
 
     def install(self, spec, prefix):
         mkdirp(prefix.bin)
diff --git a/var/spack/repos/builtin/packages/octave/package.py b/var/spack/repos/builtin/packages/octave/package.py
index f18be0186f..29896172b1 100644
--- a/var/spack/repos/builtin/packages/octave/package.py
+++ b/var/spack/repos/builtin/packages/octave/package.py
@@ -93,7 +93,7 @@ class Octave(AutotoolsPackage):
     depends_on('gnuplot',      when='+gnuplot')
     depends_on('image-magick',  when='+magick')
     depends_on('hdf5',         when='+hdf5')
-    depends_on('jdk',          when='+jdk')        # TODO: requires Java 6 ?
+    depends_on('java',          when='+jdk')        # TODO: requires Java 6 ?
     depends_on('llvm',         when='+llvm')
     # depends_on('opengl',      when='+opengl')    # TODO: add package
     depends_on('qhull',        when='+qhull')
@@ -186,9 +186,9 @@ def configure_args(self):
 
         if '+jdk' in spec:
             config_args.extend([
-                "--with-java-homedir=%s"    % spec['jdk'].prefix,
-                "--with-java-includedir=%s" % spec['jdk'].prefix.include,
-                "--with-java-libdir=%s"     % spec['jdk'].prefix.lib
+                "--with-java-homedir=%s"    % spec['java'].prefix,
+                "--with-java-includedir=%s" % spec['java'].prefix.include,
+                "--with-java-libdir=%s"     % spec['java'].prefix.lib
             ])
         else:
             config_args.append("--disable-java")
diff --git a/var/spack/repos/builtin/packages/opencv/package.py b/var/spack/repos/builtin/packages/opencv/package.py
index e0743e17c6..33adadc15e 100644
--- a/var/spack/repos/builtin/packages/opencv/package.py
+++ b/var/spack/repos/builtin/packages/opencv/package.py
@@ -72,7 +72,7 @@ class Opencv(CMakePackage):
     depends_on('gtkplus', when='+gtk')
     depends_on('vtk', when='+vtk')
     depends_on('qt', when='+qt')
-    depends_on('jdk', when='+java')
+    depends_on('java', when='+java')
     depends_on('py-numpy', when='+python', type=('build', 'run'))
 
     extends('python', when='+python')
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py
index 30a70d948f..7fc50928db 100644
--- a/var/spack/repos/builtin/packages/openmpi/package.py
+++ b/var/spack/repos/builtin/packages/openmpi/package.py
@@ -201,7 +201,7 @@ class Openmpi(AutotoolsPackage):
 
     depends_on('hwloc')
     depends_on('hwloc +cuda', when='+cuda')
-    depends_on('jdk', when='+java')
+    depends_on('java', when='+java')
     depends_on('sqlite', when='+sqlite3@:1.11')
 
     conflicts('+cuda', when='@:1.6')  # CUDA support was added in 1.7
@@ -308,7 +308,7 @@ def configure_args(self):
                 config_args.extend([
                     '--enable-java',
                     '--enable-mpi-java',
-                    '--with-jdk-dir={0}'.format(spec['jdk'].prefix)
+                    '--with-jdk-dir={0}'.format(spec['java'].prefix)
                 ])
             else:
                 config_args.extend([
diff --git a/var/spack/repos/builtin/packages/picard/package.py b/var/spack/repos/builtin/packages/picard/package.py
index 3705c13f75..f03561a5a7 100644
--- a/var/spack/repos/builtin/packages/picard/package.py
+++ b/var/spack/repos/builtin/packages/picard/package.py
@@ -44,7 +44,7 @@ class Picard(Package):
     version('1.140', '308f95516d94c1f3273a4e7e2b315ec2',
             url='https://github.com/broadinstitute/picard/releases/download/1.140/picard-tools-1.140.zip')
 
-    depends_on('jdk@8:', type='run')
+    depends_on('java@8:', type='run')
 
     def install(self, spec, prefix):
         mkdirp(prefix.bin)
@@ -63,7 +63,7 @@ def install(self, spec, prefix):
 
         # Munge the helper script to explicitly point to java and the
         # jar file.
-        java = join_path(self.spec['jdk'].prefix, 'bin', 'java')
+        java = join_path(self.spec['java'].prefix, 'bin', 'java')
         kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
         filter_file('^java', java, script, **kwargs)
         filter_file('picard.jar', join_path(prefix.bin, 'picard.jar'),
diff --git a/var/spack/repos/builtin/packages/py-jpype/package.py b/var/spack/repos/builtin/packages/py-jpype/package.py
index b82a43ca2f..b9117f7536 100644
--- a/var/spack/repos/builtin/packages/py-jpype/package.py
+++ b/var/spack/repos/builtin/packages/py-jpype/package.py
@@ -39,6 +39,6 @@ class PyJpype(PythonPackage):
     depends_on('python@2.6:')
 
     depends_on('py-setuptools', type='build')
-    depends_on('jdk', type=('build', 'run'))
+    depends_on('java', type=('build', 'run'))
     # extra requirements
     # depends_on('py-numpy@1.6:', type=('build', 'run'))
diff --git a/var/spack/repos/builtin/packages/r-rjava/package.py b/var/spack/repos/builtin/packages/r-rjava/package.py
index 7baab54baa..55d8282cd7 100644
--- a/var/spack/repos/builtin/packages/r-rjava/package.py
+++ b/var/spack/repos/builtin/packages/r-rjava/package.py
@@ -34,4 +34,4 @@ class RRjava(RPackage):
 
     version('0.9-8', '51ae0d690ceed056ebe7c4be71fc6c7a')
 
-    depends_on('jdk')
+    depends_on('java')
diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py
index e884283ce2..886a238b06 100644
--- a/var/spack/repos/builtin/packages/r/package.py
+++ b/var/spack/repos/builtin/packages/r/package.py
@@ -84,7 +84,7 @@ class R(AutotoolsPackage):
     depends_on('libxt', when='+X')
     depends_on('curl')
     depends_on('pcre')
-    depends_on('jdk')
+    depends_on('java')
 
     patch('zlib.patch', when='@:3.3.2')
 
diff --git a/var/spack/repos/builtin/packages/rose/package.py b/var/spack/repos/builtin/packages/rose/package.py
index 0e2265f571..8ba397df55 100644
--- a/var/spack/repos/builtin/packages/rose/package.py
+++ b/var/spack/repos/builtin/packages/rose/package.py
@@ -60,7 +60,7 @@ class Rose(Package):
     variant('fortran', default=False, description='Enable fortran language support')
 
     variant('java', default=False, description='Enable java language support')
-    depends_on('jdk', when='+java')
+    depends_on('java', when='+java')
 
     variant('z3', default=False, description='Enable z3 theorem prover')
     depends_on('z3', when='+z3')
diff --git a/var/spack/repos/builtin/packages/sbt/package.py b/var/spack/repos/builtin/packages/sbt/package.py
index 27be7cc54c..6747e51b3f 100644
--- a/var/spack/repos/builtin/packages/sbt/package.py
+++ b/var/spack/repos/builtin/packages/sbt/package.py
@@ -34,7 +34,7 @@ class Sbt(Package):
 
     version('0.13.12', 'cec3071d46ef13334c8097cc3467ff28')
 
-    depends_on('jdk')
+    depends_on('java')
 
     def install(self, spec, prefix):
         shutil.copytree('bin', join_path(prefix, 'bin'), symlinks=True)
diff --git a/var/spack/repos/builtin/packages/scala/package.py b/var/spack/repos/builtin/packages/scala/package.py
index dd1ab78f6b..35a49f6be5 100644
--- a/var/spack/repos/builtin/packages/scala/package.py
+++ b/var/spack/repos/builtin/packages/scala/package.py
@@ -40,7 +40,7 @@ class Scala(Package):
     version('2.11.11', '3f5b76001f60cbc31111ddb81de5ea07')
     version('2.20.6', 'd79dc9fdc627b73289306bdaec81ca98')
 
-    depends_on('jdk')
+    depends_on('java')
 
     def install(self, spec, prefix):
 
diff --git a/var/spack/repos/builtin/packages/spark/package.py b/var/spack/repos/builtin/packages/spark/package.py
index c625f6b82a..ddd825018e 100644
--- a/var/spack/repos/builtin/packages/spark/package.py
+++ b/var/spack/repos/builtin/packages/spark/package.py
@@ -39,7 +39,7 @@ class Spark(Package):
     variant('hadoop', default=False,
             description='Build with Hadoop')
 
-    depends_on('jdk', type=('build', 'run'))
+    depends_on('java', type=('build', 'run'))
     depends_on('hadoop', when='+hadoop', type=('build', 'run'))
 
     version('2.1.0', '21d4471e78250775b1fa7c0e6c3a1326')
@@ -68,7 +68,7 @@ def install_dir(dirname):
     @when('+hadoop')
     def setup_environment(self, spack_env, run_env):
 
-        env['JAVA_HOME'] = self.spec['jdk'].prefix
+        env['JAVA_HOME'] = self.spec['java'].prefix
         # spack_env.set('JAVA_HOME', self.spec['jdk'].prefix)
 
         hadoop = self.spec['hadoop'].command
diff --git a/var/spack/repos/builtin/packages/stc/package.py b/var/spack/repos/builtin/packages/stc/package.py
index 7365943a14..2403767679 100644
--- a/var/spack/repos/builtin/packages/stc/package.py
+++ b/var/spack/repos/builtin/packages/stc/package.py
@@ -34,7 +34,7 @@ class Stc(AutotoolsPackage):
 
     version('0.7.3', '6bf769f406f6c33d1c134521373718d3')
 
-    depends_on('jdk')
+    depends_on('java')
     depends_on('ant')
     depends_on('turbine')
 
diff --git a/var/spack/repos/builtin/packages/thrift/package.py b/var/spack/repos/builtin/packages/thrift/package.py
index 306f8d9de5..598fd194d9 100644
--- a/var/spack/repos/builtin/packages/thrift/package.py
+++ b/var/spack/repos/builtin/packages/thrift/package.py
@@ -46,7 +46,7 @@ class Thrift(Package):
     variant('python', default=True,
             description="Build support for python")
 
-    depends_on('jdk')
+    depends_on('java')
     depends_on('autoconf', type='build')
     depends_on('automake', type='build')
     depends_on('libtool', type='build')
@@ -63,7 +63,7 @@ class Thrift(Package):
 
     def install(self, spec, prefix):
         env['PY_PREFIX'] = prefix
-        env['JAVA_HOME'] = spec['jdk'].prefix
+        env['JAVA_HOME'] = spec['java'].prefix
 
         # configure options
         options = ['--prefix=%s' % prefix]
diff --git a/var/spack/repos/builtin/packages/trimmomatic/package.py b/var/spack/repos/builtin/packages/trimmomatic/package.py
index 54c80d2ba0..42f0e68973 100644
--- a/var/spack/repos/builtin/packages/trimmomatic/package.py
+++ b/var/spack/repos/builtin/packages/trimmomatic/package.py
@@ -39,7 +39,7 @@ class Trimmomatic(Package):
     version('0.36', '8549130d86b6f0382b1a71a2eb45de39')
     version('0.33', '924fc8eb38fdff71740a0e05d32d6a2b')
 
-    depends_on('jdk@8:', type='run')
+    depends_on('java@8:', type='run')
 
     def install(self, spec, prefix):
         mkdirp(prefix.bin)
@@ -58,7 +58,7 @@ def install(self, spec, prefix):
 
         # Munge the helper script to explicitly point to java and the
         # jar file.
-        java = join_path(self.spec['jdk'].prefix, 'bin', 'java')
+        java = join_path(self.spec['java'].prefix, 'bin', 'java')
         kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
         filter_file('^java', java, script, **kwargs)
         filter_file('trimmomatic.jar', join_path(prefix.bin, jar_file),
-- 
GitLab