From b94a83776001fe857283b2f2b3cab074d536a05b Mon Sep 17 00:00:00 2001
From: Todd Gamblin <tgamblin@llnl.gov>
Date: Sat, 1 Aug 2020 17:33:35 -0700
Subject: [PATCH] berkeley-db: add version 18.1.40, update build options in
 package (#17839)

* berkeley-db: add version 18.1.40, update build options in package

* combine adamjstewart's changes

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
---
 .../builtin/packages/berkeley-db/package.py   | 34 ++++++++++++-------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/var/spack/repos/builtin/packages/berkeley-db/package.py b/var/spack/repos/builtin/packages/berkeley-db/package.py
index fc2fe3c4a9..52c4206d25 100644
--- a/var/spack/repos/builtin/packages/berkeley-db/package.py
+++ b/var/spack/repos/builtin/packages/berkeley-db/package.py
@@ -9,26 +9,34 @@
 class BerkeleyDb(AutotoolsPackage):
     """Oracle Berkeley DB"""
 
-    homepage = "http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html"
-    url      = "http://download.oracle.com/berkeley-db/db-5.3.28.tar.gz"
+    homepage = "https://www.oracle.com/database/technologies/related/berkeleydb.html"
+    url      = "http://download.oracle.com/berkeley-db/db-18.1.40.tar.gz"
 
+    version("18.1.40", sha256="0cecb2ef0c67b166de93732769abdeba0555086d51de1090df325e18ee8da9c8")
+    version('18.1.32', sha256='fa1fe7de9ba91ad472c25d026f931802597c29f28ae951960685cde487c8d654')
     version('6.2.32', sha256='a9c5e2b004a5777aa03510cfe5cd766a4a3b777713406b02809c17c8e0e7a8fb')
     version('6.1.29', sha256='b3c18180e4160d97dd197ba1d37c19f6ea2ec91d31bbfaf8972d99ba097af17d')
     version('6.0.35', sha256='24421affa8ae436fe427ae4f5f2d1634da83d3d55a5ad6354a98eeedb825de55')
     version('5.3.28', sha256='e0a992d740709892e81f9d93f06daf305cf73fb81b545afe72478043172c3628')
 
     configure_directory = 'dist'
-    build_directory = 'spack-build'
+    build_directory = 'build_unix'
 
-# TODO: Gentoo's website removed the BerkeleyDB archives.
-#       Please update the function bellow with a valid mirror.
-#       Right now this package will fetch from the Oracle website,
-#       and versions 5.3.28 and 6.0.35 will fail to download.
-#
-#    def url_for_version(self, version):
-#        # newer version need oracle login, so get them from gentoo mirror
-#        url_fmt = 'http://distfiles.gentoo.org/distfiles/db-{0}.tar.gz'
-#        return url_fmt.format(version)
+    def patch(self):
+        # some of the docs are missing in 18.1.40
+        if self.spec.satisfies("@18.1.40"):
+            filter_file(r'bdb-sql', '', 'dist/Makefile.in')
+            filter_file(r'gsg_db_server', '', 'dist/Makefile.in')
 
     def configure_args(self):
-        return ['--disable-static', '--enable-cxx', '--enable-stl']
+        return [
+            '--disable-static',
+            '--enable-cxx',
+            '--enable-dbm',
+            '--enable-stl',
+            # compat with system berkeley-db on darwin
+            "--enable-compat185",
+            # SSL support requires OpenSSL, but OpenSSL depends on Perl, which
+            # depends on Berkey DB, creating a circular dependency
+            '--with-repmgr-ssl=no',
+        ]
-- 
GitLab