summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/aocl-crypto
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/aocl-crypto')
-rw-r--r--var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch153
-rw-r--r--var/spack/repos/builtin/packages/aocl-crypto/package.py104
2 files changed, 257 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch b/var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch
new file mode 100644
index 0000000000..6043876c41
--- /dev/null
+++ b/var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch
@@ -0,0 +1,153 @@
+diff --git a/cmake/CompilerLinux.cmake b/cmake/CompilerLinux.cmake
+index f54bea37..8541e343 100644
+--- a/cmake/CompilerLinux.cmake
++++ b/cmake/CompilerLinux.cmake
+@@ -32,22 +32,11 @@ function(alcp_get_build_environment)
+ set (ALCP_BUILD_COMPILER "Clang_v${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+
+- # uses lsb_release utility on linux, as cmake doesnt have a variable which has the Linux flavor information
+- find_program(LSB_RELEASE_EXEC lsb_release)
+- if(NOT LSB_RELEASE_EXEC)
+- MESSAGE(FATAL_ERROR "LSB Release is missing from the machine, please install lsb_release!")
+- endif()
+- execute_process(COMMAND ${LSB_RELEASE_EXEC} -r -s
+- OUTPUT_VARIABLE OS_VERSION
+- OUTPUT_STRIP_TRAILING_WHITESPACE
+- )
+- execute_process(COMMAND ${LSB_RELEASE_EXEC} -i -s
+- OUTPUT_VARIABLE OS_VENDOR
+- OUTPUT_STRIP_TRAILING_WHITESPACE
+- )
+-
++ cmake_host_system_information(RESULT OS_VERSION QUERY DISTRIB_PRETTY_NAME)
++ message(STATUS "OS Information: ${OS_VERSION}")
++
+ # final build env string will contain compiler and system environment details where the binary was created
+- set (ALCP_BUILD_ENV ${ALCP_BUILD_COMPILER}_${OS_VENDOR}_${OS_VERSION} PARENT_SCOPE)
++ set (ALCP_BUILD_ENV ${ALCP_BUILD_COMPILER}_${OS_VERSION} PARENT_SCOPE)
+ endfunction(alcp_get_build_environment)
+
+
+diff --git a/docs/resources/Quick_Start.md b/docs/resources/Quick_Start.md
+index 17bc025a..278a3d1f 100644
+--- a/docs/resources/Quick_Start.md
++++ b/docs/resources/Quick_Start.md
+@@ -141,47 +141,6 @@ AOCL_CRYPTO_REPO="https://github.com/amd/aocl-crypto.git"
+ AOCL_UTILS_REPO="https://github.com/amd/aocl-utils.git"
+ AOCL_BRANCH="amd-main"
+
+-# Function to check if lsb_release is installed
+-ensure_lsb_release(){
+- if ! type "lsb_release" > /dev/null; then
+- if type "apt" > /dev/null; then
+- if type "sudo" > /dev/null; then
+- sudo apt update
+- sudo apt install lsb-release
+- else
+- echo "lsb-release not found, cannot install! missing \"sudo\" binary"
+- exit -1; # We cannot do anything anymore
+- fi
+- else
+- echo "lsb-release not found, cannot install! missing \"apt\" binary"
+- fi
+- fi
+-
+- type lsb_release > /dev/null
+- if [ $? -ne 0 ]; then
+- echo "lsb_release not found!"
+- exit -1;
+- else
+- echo "lsb_release found"
+- fi
+-}
+-
+-# Function to check if OS is ubuntu with a specific version
+-detect_ubuntu(){
+-
+- lsb_release --id | grep "Ubuntu" > /dev/null
+- if [ $? -eq 0 ]; then
+- # Detected Ubuntu
+- echo "Detected Ubuntu"
+- lsb_release --release | grep $1 > /dev/null
+- if [ $? -eq 0 ]; then
+- echo "Detected OS Release Version $1"
+- return 0
+- fi
+- fi
+- return 1 # Return error
+-}
+-
+ # Function to exit with an error if some execution failed
+ quit_if_status_not_zero(){
+ if [ $1 -ne 0 ]; then
+@@ -338,8 +297,6 @@ run_example_cfb(){
+
+ # Make sure we dont destroy anything
+ ensure_no_directory_conflict
+-# Make sure we can detect the OS
+-ensure_lsb_release
+ # Make sure all the needed packages (dependancies) are installed
+ ensure_packages
+ # Clone Utils and Crypto
+diff --git a/scripts/Clone_Build.sh b/scripts/Clone_Build.sh
+index 89a7cd2f..1ed2f3cf 100755
+--- a/scripts/Clone_Build.sh
++++ b/scripts/Clone_Build.sh
+@@ -36,47 +36,6 @@ AOCL_CRYPTO_REPO="git@er.github.amd.com:AOCL/aocl-crypto"
+ AOCL_UTILS_REPO="git@github.amd.com:AOCL/aocl-utils"
+ AOCL_BRANCH="amd-main"
+
+-# Function to check if lsb_release is installed
+-ensure_lsb_release(){
+- if ! type "lsb_release" > /dev/null; then
+- if type "apt" > /dev/null; then
+- if type "sudo" > /dev/null; then
+- sudo apt update
+- sudo apt install lsb-release
+- else
+- echo "lsb-release not found, cannot install! missing \"sudo\" binary"
+- exit -1; # We cannot do anything anymore
+- fi
+- else
+- echo "lsb-release not found, cannot install! missing \"apt\" binary"
+- fi
+- fi
+-
+- type lsb_release > /dev/null
+- if [ $? -ne 0 ]; then
+- echo "lsb_release not found!"
+- exit -1;
+- else
+- echo "lsb_release found"
+- fi
+-}
+-
+-# Function to check if OS is ubuntu with a specific version
+-detect_ubuntu(){
+-
+- lsb_release --id | grep "Ubuntu" > /dev/null
+- if [ $? -eq 0 ]; then
+- # Detected Ubuntu
+- echo "Detected Ubuntu"
+- lsb_release --release | grep $1 > /dev/null
+- if [ $? -eq 0 ]; then
+- echo "Detected OS Release Version $1"
+- return 0
+- fi
+- fi
+- return 1 # Return error
+-}
+-
+ # Function to exit with an error if some execution failed
+ quit_if_status_not_zero(){
+ if [ $1 -ne 0 ]; then
+@@ -233,8 +192,6 @@ run_example_cfb(){
+
+ # Make sure we dont destroy anything
+ ensure_no_directory_conflict
+-# Make sure we can detect the OS
+-ensure_lsb_release
+ # Make sure all the needed packages (dependancies) are installed
+ ensure_packages
+ # Clone Utils and Crypto
diff --git a/var/spack/repos/builtin/packages/aocl-crypto/package.py b/var/spack/repos/builtin/packages/aocl-crypto/package.py
new file mode 100644
index 0000000000..4de7a3a439
--- /dev/null
+++ b/var/spack/repos/builtin/packages/aocl-crypto/package.py
@@ -0,0 +1,104 @@
+# Copyright 2013-2024 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.package import *
+
+
+class AoclCrypto(CMakePackage):
+ """
+ AOCL-Crypto is a library consisting of basic cryptographic functions
+ optimized and tuned for AMD Zen™ based microarchitecture.
+
+ This library provides a unified solution for Cryptographic routines such
+ as AES (Advanced Encryption Standard) encryption/decryption routines
+ (CFB, CTR, CBC, CCM, GCM, OFB, SIV, XTS), SHA (Secure Hash Algorithms)
+ routines (SHA2, SHA3, SHAKE), Message Authentication Code (CMAC, HMAC),
+ ECDH (Elliptic-curve Diffie–Hellman) and RSA (Rivest, Shamir, and Adleman)
+ key generation functions, etc. AOCL Crypto supports a dynamic dispatcher
+ feature that executes the most optimal function variant implemented using
+ Function Multi-versioning thereby offering a single optimized library
+ portable across different x86 CPU architectures.
+
+ AOCL Crypto framework is developed in C / C++ for Unix and Windows based
+ systems.
+
+ LICENSING INFORMATION: By downloading, installing and using this software,
+ you agree to the terms and conditions of the AMD AOCL-Cryptography license
+ agreement. You may obtain a copy of this license agreement from
+ https://www.amd.com/en/developer/aocl/cryptography/eula/cryptography-4-2-eula.html
+ """
+
+ _name = "aocl-crypto"
+ homepage = "https://www.amd.com/en/developer/aocl/cryptography.html"
+ url = "https://github.com/amd/aocl-crypto/archive/4.2.tar.gz"
+ git = "https://github.com/amd/aocl-crypto/"
+
+ maintainers("amd-toolchain-support")
+
+ version(
+ "5.0",
+ sha256="b15e609943f9977e13f2d5839195bb7411c843839a09f0ad47f78f57e8821c23",
+ preferred=True,
+ )
+ version("4.2", sha256="2bdbedd8ab1b28632cadff237f4abd776e809940ad3633ad90fc52ce225911fe")
+
+ depends_on("c", type="build") # generated
+ depends_on("cxx", type="build") # generated
+ variant("examples", default=False, description="Build examples")
+ variant("ipp", default=False, description="Build Intel IPP library")
+
+ # Removed dependency on lsb_release
+ patch(
+ "lsb_release.patch",
+ sha256="b61d6d2518276c56d37e8c64d18488081af70f29a62f315ecbd23664e0e440b9",
+ when="@5.0",
+ )
+
+ depends_on("cmake@3.22:", type="build")
+ depends_on("openssl@3.1.5:")
+ depends_on("intel-oneapi-ippcp@2021.12.0:", when="+ipp")
+ depends_on("p7zip", type="build")
+ for vers in ["4.2", "5.0"]:
+ with when(f"@={vers}"):
+ depends_on(f"aocl-utils@={vers}")
+
+ @property
+ def build_directory(self):
+ """Returns the directory to use when building the package
+
+ :return: directory where to build the package
+ """
+
+ build_directory = self.stage.source_path
+
+ if self.spec.variants["build_type"].value == "Debug":
+ build_directory = join_path(build_directory, "build", "debug")
+ else:
+ build_directory = join_path(build_directory, "build", "release")
+
+ return build_directory
+
+ def cmake_args(self):
+ """Runs ``cmake`` in the build directory"""
+ spec = self.spec
+
+ args = [
+ self.define_from_variant("ALCP_ENABLE_EXAMPLES", "examples"),
+ self.define("ENABLE_AOCL_UTILS", True),
+ self.define("AOCL_UTILS_INSTALL_DIR", spec["aocl-utils"].prefix),
+ self.define("CMAKE_INSTALL_LIBDIR", "lib"),
+ self.define("ALCP_ENABLE_DYNAMIC_COMPILER_PICK", False),
+ ]
+
+ compat_libs = ["openssl"]
+ args.append(self.define("OPENSSL_INSTALL_DIR", spec["openssl"].prefix))
+
+ if "+ipp" in spec:
+ compat_libs.append("ipp")
+ args.append(self.define("IPP_INSTALL_DIR", spec["intel-oneapi-ippcp"].prefix))
+
+ args.append(self.define("AOCL_COMPAT_LIBS", ",".join(compat_libs)))
+
+ return args