From c0a52cc59e65c48d095036a43c7e574aa088d0b3 Mon Sep 17 00:00:00 2001
From: Barry Britt <barry.britt@gmail.com>
Date: Sat, 6 May 2017 12:05:12 -0500
Subject: [PATCH] Updating bamtools to include a dependency for zlib. (#4031)

* Updating bamtools to include a dependency for zlib.

In a standard compile, bamtools will fail if zlib headers are not installed on the target machine. In order to maintain compatibility with all systems -- and since zlib is included already as a dependency for cmake -- this patch adds zlib as a link dependency for the bamtools package.

* Modified cmake rpath include.

Bamtools has a non-standard library location, so we need to append $prefix/lib/bamtools to the rpath. Not sure there's a better way to do this...

* Fixing syntax error in package.py

Fixed a non-terminated parenthesis on line 46.

* Updated bamtools to be a CMakePackage

Removed extraneous code, and altered the package to extend cmake_args
including the non-standard library location.

* UpRemoving cmake dependency and removing blank line from end of file

* Updates to cmake_args.

Removed the duplicate definition of std_cmake_args in favor of simply overriding the CMAKE_INSTALL_RPATH variable that is provided. This should allow the package to be linked correctly to itself.
---
 .../repos/builtin/packages/bamtools/package.py  | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/var/spack/repos/builtin/packages/bamtools/package.py b/var/spack/repos/builtin/packages/bamtools/package.py
index 6ad90c779b..79e71cc0f2 100644
--- a/var/spack/repos/builtin/packages/bamtools/package.py
+++ b/var/spack/repos/builtin/packages/bamtools/package.py
@@ -23,9 +23,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##############################################################################
 from spack import *
+import os
 
 
-class Bamtools(Package):
+class Bamtools(CMakePackage):
     """C++ API & command-line toolkit for working with BAM data."""
 
     homepage = "https://github.com/pezmaster31/bamtools"
@@ -36,11 +37,11 @@ class Bamtools(Package):
     version('2.3.0', 'd327df4ba037d6eb8beef65d7da75ebc')
     version('2.2.3', '6eccd3e45e4ba12a68daa3298998e76d')
 
-    depends_on('cmake', type='build')
+    depends_on('zlib', type='link')
 
-    def install(self, spec, prefix):
-        with working_dir('spack-build', create=True):
-            cmake('..', *std_cmake_args)
-
-            make()
-            make('install')
+    def cmake_args(self):
+        args = []
+        rpath = self.rpath
+        rpath.append(os.path.join(self.prefix.lib, "bamtools"))
+        args.append("-DCMAKE_INSTALL_RPATH=%s" % ':'.join(rpath))
+        return args
-- 
GitLab