xeus: new package (#9682)

* xeus: new package
cppzmq: add version 4.3.0
zeromq: make libsodium optional, on by default

* xeus: add patch so it builds, add new version
nlohmann-json: add more versions
cryptopp: add more versions

* xeus: flake8

* xeus: fix license
This commit is contained in:
Thomas Stitt 2018-10-31 20:23:44 -07:00 committed by Todd Gamblin
parent fc25ba1b22
commit 6a3552274f
6 changed files with 113 additions and 5 deletions

View File

@ -14,7 +14,9 @@ class Cppzmq(CMakePackage):
git = "https://github.com/zeromq/cppzmq.git"
version('develop', branch='master')
version('4.3.0', sha256='27d1f56406ba94ee779e639203218820975cf68174f92fbeae0f645df0fcada4')
version('4.2.2', 'bd809b47296e77fe9f192bd9dafd5cc3')
depends_on('cmake@3.0.0:', type='build')
depends_on('zeromq@4.2.2')
depends_on('zeromq@4.2.5', when='@4.3.0')
depends_on('zeromq@4.2.2', when='@4.2.2')

View File

@ -17,6 +17,10 @@ class Cryptopp(MakefilePackage):
url = "http://www.cryptopp.com/cryptopp700.zip"
version('7.0.0', '8f34884b572901b6ede89bd18f1c7ef6')
version('6.1.0', sha256='21289d2511101a9350c87c8eb1f4982d4a266e8037b19dab79a32cc13ea108c7')
version('6.0.0', sha256='64ac2db96b3f1b7a23675e2be95d16c96055edffa2d5e2de6245fdb6baa92dda')
version('5.6.5', sha256='a75ef486fe3128008bbb201efee3dcdcffbe791120952910883b26337ec32c34')
version('5.6.4', sha256='be430377b05c15971d5ccb6e44b4d95470f561024ed6d701fe3da3a188c84ad7')
version('5.6.3', '3c5b70e2ec98b7a24988734446242d07')
version('5.6.2', '7ed022585698df48e65ce9218f6c6a67')
version('5.6.1', '96cbeba0907562b077e26bcffb483828')

View File

@ -14,7 +14,9 @@ class NlohmannJson(CMakePackage):
maintainers = ['ax3l']
version('3.3.0', sha256='2fd1d207b4669a7843296c41d3b6ac5b23d00dec48dba507ba051d14564aa801')
version('3.1.2', '557651b017c36ad596ba3b577ba1b539')
version('3.2.0', sha256='2de558ff3b3b32eebfb51cf2ceb835a0fa5170e6b8712b02be9c2c07fcfe52a1')
version('3.1.2', sha256='e8fffa6cbdb3c15ecdff32eebf958b6c686bc188da8ad5c6489462d16f83ae54')
version('3.1.1', sha256='9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47')
variant('single_header', default=True,
description='Use amalgamated single-header')

View File

@ -0,0 +1,52 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 810d5d1..d6ba3e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,7 +49,33 @@ message(STATUS "xeus binary version: v${XEUS_BINARY_VERSION}")
find_package(nlohmann_json 3.2.0 REQUIRED)
find_package(xtl 0.4 REQUIRED)
find_package(cppzmq 4.3.0 REQUIRED)
-find_package(cryptopp REQUIRED)
+
+# cryptopp isn't built with cmake, find it manually
+find_path(cryptopp_ROOT_DIR
+ NAMES include/cryptopp/cryptlib.h
+ PATHS ENV cryptopp_ROOT)
+
+find_path(cryptopp_INCLUDE_DIR
+ NAMES cryptopp/cryptlib.h
+ HINTS ${cryptopp_ROOT_DIR}
+ PATH_SUFFIXES include)
+
+find_library(cryptopp_STATIC_LIB
+ NAMES libcryptopp.a
+ HINTS ${cryptopp_ROOT_DIR}
+ PATH_SUFFIXES lib)
+
+if (NOT cryptopp_INCLUDE_DIR OR NOT cryptopp_STATIC_LIB)
+ message(FATAL_ERROR "cannot find cryptopp, missing include dir or static lib")
+else()
+ message("Found cryptopp: ${cryptopp_ROOT_DIR}")
+endif()
+
+add_library(cryptopp-static STATIC IMPORTED)
+set_target_properties(cryptopp-static
+ PROPERTIES
+ IMPORTED_LOCATION ${cryptopp_STATIC_LIB}
+ INTERFACE_INCLUDE_DIRECTORIES ${cryptopp_INCLUDE_DIR})
# On Unix platforms, ZeroMQ is built with autotools and pkg-config is
# required to locate it.
@@ -157,10 +183,11 @@ get_target_property(cryptopp_INCLUDE_DIR cryptopp-static INTERFACE_INCLUDE_DIREC
get_target_property(cryptopp_LIBRARY cryptopp-static LOCATION)
set(CMAKE_REQUIRED_LIBRARIES ${cryptopp_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${cryptopp_INCLUDE_DIR})
+set(CMAKE_REQUIRED_FLAGS "--std=c++11")
check_cxx_source_compiles("
#include \"cryptopp/config.h\"
int main(){
- [[maybe_unused]] CryptoPP::byte b = CryptoPP::byte{0x36};
+ CryptoPP::byte b = CryptoPP::byte{0x36};
}" HAVE_CRYPTOPP_BYTE_T)
cmake_pop_check_state()

View File

@ -0,0 +1,44 @@
# Copyright 2013-2018 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 Xeus(CMakePackage):
"""QuantStack C++ implementation of Jupyter kernel protocol"""
homepage = "https://xeus.readthedocs.io/en/latest/"
url = "https://github.com/QuantStack/xeus/archive/0.14.1.tar.gz"
git = "https://github.com/QuantStack/xeus.git"
version('develop', branch='master')
version('0.15.0', sha256='bc99235b24d5757dc129f3ed531501fb0d0667913927ed39ee24281952649183')
version('0.14.1', sha256='a6815845d4522ec279f142d3b4e92ef52cd80847b512146a65f256a77e058cfe')
variant('examples', default=False, description="Build examples")
conflicts('%gcc@:4.8')
conflicts('%clang@:3.6')
conflicts('%intel@:17')
depends_on('zeromq@4.2.5:-libsodium')
depends_on('cppzmq@4.3.0:')
depends_on('cryptopp@7.0.0:')
depends_on('xtl@0.4.0:')
depends_on('nlohmann-json@3.2.0', when='@develop@0.15.0:')
depends_on('nlohmann-json@3.1.1', when='@0.14.1')
depends_on('libuuid')
# finds cryptopp not built with cmake, removes c++17 attribute
# in check_cxx_source_compiles
patch('cmake_find_cryptopp_and_check_cxx_compatibility.patch')
def cmake_args(self):
args = [
'-DBUILD_EXAMPLES:BOOL=%s' % (
'ON' if '+examples' in self.spec else 'OFF')
]
return args

View File

@ -24,8 +24,10 @@ class Zeromq(AutotoolsPackage):
version('4.0.6', 'd47dd09ed7ae6e7fd6f9a816d7f5fdf6')
version('4.0.5', '73c39f5eb01b9d7eaf74a5d899f1d03d')
depends_on("libsodium")
depends_on("libsodium@:1.0.3", when='@:4.1.2')
variant("libsodium", default=True, description="Build with libsodium support")
depends_on("libsodium", when='+libsodium')
depends_on("libsodium@:1.0.3", when='+libsodium@:4.1.2')
depends_on('autoconf', type='build', when='@develop')
depends_on('automake', type='build', when='@develop')
@ -40,7 +42,9 @@ def autoreconf(self, spec, prefix):
bash('./autogen.sh')
def configure_args(self):
config_args = ['--with-libsodium']
config_args = []
if '+libsodium' in self.spec:
config_args.append('--with-libsodium')
if 'clang' in self.compiler.cc:
config_args.append("CFLAGS=-Wno-gnu")
config_args.append("CXXFLAGS=-Wno-gnu")