aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/hash-library
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/hash-library
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/hash-library')
-rw-r--r--vcpkg/ports/hash-library/001-fix-macos.patch98
-rw-r--r--vcpkg/ports/hash-library/CMakeLists.txt48
-rw-r--r--vcpkg/ports/hash-library/portfile.cmake26
-rw-r--r--vcpkg/ports/hash-library/vcpkg.json18
4 files changed, 190 insertions, 0 deletions
diff --git a/vcpkg/ports/hash-library/001-fix-macos.patch b/vcpkg/ports/hash-library/001-fix-macos.patch
new file mode 100644
index 0000000..60658e3
--- /dev/null
+++ b/vcpkg/ports/hash-library/001-fix-macos.patch
@@ -0,0 +1,98 @@
+Fixes includes of endian.h on MacOS, see https://github.com/stbrumme/hash-library/pull/4.
+
+diff --git a/crc32.cpp b/crc32.cpp
+--- a/crc32.cpp
++++ b/crc32.cpp
+@@ -7,8 +7,10 @@
+ #include "crc32.h"
+
+ // big endian architectures need #define __BYTE_ORDER __BIG_ENDIAN
+-#ifndef _MSC_VER
+-#include <endian.h>
++#if defined(__APPLE__)
++ #include <machine/endian.h>
++#elif !defined(_MSC_VER)
++ #include <endian.h>
+ #endif
+
+
+diff --git a/keccak.cpp b/keccak.cpp
+--- a/keccak.cpp
++++ b/keccak.cpp
+@@ -7,8 +7,10 @@
+ #include "keccak.h"
+
+ // big endian architectures need #define __BYTE_ORDER __BIG_ENDIAN
+-#ifndef _MSC_VER
+-#include <endian.h>
++#if defined(__APPLE__)
++ #include <machine/endian.h>
++#elif !defined(_MSC_VER)
++ #include <endian.h>
+ #endif
+
+
+diff --git a/md5.cpp b/md5.cpp
+--- a/md5.cpp
++++ b/md5.cpp
+@@ -6,8 +6,10 @@
+
+ #include "md5.h"
+
+-#ifndef _MSC_VER
+-#include <endian.h>
++#if defined(__APPLE__)
++ #include <machine/endian.h>
++#elif !defined(_MSC_VER)
++ #include <endian.h>
+ #endif
+
+
+diff --git a/sha1.cpp b/sha1.cpp
+--- a/sha1.cpp
++++ b/sha1.cpp
+@@ -7,8 +7,10 @@
+ #include "sha1.h"
+
+ // big endian architectures need #define __BYTE_ORDER __BIG_ENDIAN
+-#ifndef _MSC_VER
+-#include <endian.h>
++#if defined(__APPLE__)
++ #include <machine/endian.h>
++#elif !defined(_MSC_VER)
++ #include <endian.h>
+ #endif
+
+
+diff --git a/sha256.cpp b/sha256.cpp
+--- a/sha256.cpp
++++ b/sha256.cpp
+@@ -7,8 +7,10 @@
+ #include "sha256.h"
+
+ // big endian architectures need #define __BYTE_ORDER __BIG_ENDIAN
+-#ifndef _MSC_VER
+-#include <endian.h>
++#if defined(__APPLE__)
++ #include <machine/endian.h>
++#elif !defined(_MSC_VER)
++ #include <endian.h>
+ #endif
+
+
+diff --git a/sha3.cpp b/sha3.cpp
+--- a/sha3.cpp
++++ b/sha3.cpp
+@@ -7,8 +7,10 @@
+ #include "sha3.h"
+
+ // big endian architectures need #define __BYTE_ORDER __BIG_ENDIAN
+-#ifndef _MSC_VER
+-#include <endian.h>
++#if defined(__APPLE__)
++ #include <machine/endian.h>
++#elif !defined(_MSC_VER)
++ #include <endian.h>
+ #endif
+
+ #include <iostream>
diff --git a/vcpkg/ports/hash-library/CMakeLists.txt b/vcpkg/ports/hash-library/CMakeLists.txt
new file mode 100644
index 0000000..abc69f1
--- /dev/null
+++ b/vcpkg/ports/hash-library/CMakeLists.txt
@@ -0,0 +1,48 @@
+cmake_minimum_required(VERSION 3.5.1)
+project(hash-library CXX)
+
+set(HEADERS
+ crc32.h
+ hash.h
+ hmac.h
+ keccak.h
+ md5.h
+ sha1.h
+ sha256.h
+ sha3.h
+)
+
+set(SRCS
+ crc32.cpp
+ keccak.cpp
+ md5.cpp
+ sha1.cpp
+ sha256.cpp
+ sha3.cpp
+)
+
+add_library(hash-library ${SRCS})
+
+target_include_directories(hash-library PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include/hash-library>)
+
+if(NOT DISABLE_INSTALL_HEADERS)
+ install(FILES ${HEADERS} DESTINATION include/hash-library)
+endif()
+
+install(
+ TARGETS hash-library
+ EXPORT unofficial-hash-library-targets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
+install(
+ EXPORT unofficial-hash-library-targets
+ FILE unofficial-hash-library-targets.cmake
+ NAMESPACE unofficial::
+ DESTINATION share/unofficial-hash-library
+)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-hash-library-config.cmake" "include(\${CMAKE_CURRENT_LIST_DIR}/unofficial-hash-library-targets.cmake)\n")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-hash-library-config.cmake" DESTINATION share/unofficial-hash-library)
diff --git a/vcpkg/ports/hash-library/portfile.cmake b/vcpkg/ports/hash-library/portfile.cmake
new file mode 100644
index 0000000..145f751
--- /dev/null
+++ b/vcpkg/ports/hash-library/portfile.cmake
@@ -0,0 +1,26 @@
+if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO stbrumme/hash-library
+ REF hash_library_v8
+ SHA512 1c428710c0c3e4d5d1114d757a5d9145ed12c7e2fbbfa51635f43a349ddb5634bdf49e8d8fdbc7576e90b319989fb85efec433bb43ddb551c2cf29a8e80ba78b
+ HEAD_REF master
+ PATCHES
+ 001-fix-macos.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_DEBUG
+ -DDISABLE_INSTALL_HEADERS=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(PACKAGE_NAME "unofficial-${PORT}" CONFIG_PATH "share/unofficial-${PORT}")
+
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/hash-library/vcpkg.json b/vcpkg/ports/hash-library/vcpkg.json
new file mode 100644
index 0000000..0779302
--- /dev/null
+++ b/vcpkg/ports/hash-library/vcpkg.json
@@ -0,0 +1,18 @@
+{
+ "name": "hash-library",
+ "version": "8",
+ "port-version": 3,
+ "description": "Portable C++ hashing library",
+ "homepage": "https://create.stephan-brumme.com/hash-library/",
+ "license": "Zlib",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}