aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/hashids
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/hashids')
-rw-r--r--vcpkg/ports/hashids/hashids.patch18
-rw-r--r--vcpkg/ports/hashids/portfile.cmake30
-rw-r--r--vcpkg/ports/hashids/vcpkg.json13
3 files changed, 61 insertions, 0 deletions
diff --git a/vcpkg/ports/hashids/hashids.patch b/vcpkg/ports/hashids/hashids.patch
new file mode 100644
index 0000000..e6877fa
--- /dev/null
+++ b/vcpkg/ports/hashids/hashids.patch
@@ -0,0 +1,18 @@
+diff --git a/src/hashids.c b/src/hashids.c
+index 7f0b2f3..8d68509 100644
+--- a/src/hashids.c
++++ b/src/hashids.c
+@@ -6,6 +6,13 @@
+
+ #include "hashids.h"
+
++#ifdef _MSC_VER
++#include <BaseTsd.h>
++typedef SSIZE_T ssize_t;
++#else
++#include <unistd.h>
++#endif
++
+ /* branch prediction hinting */
+ #ifndef __has_builtin
+ # define __has_builtin(x) (0)
diff --git a/vcpkg/ports/hashids/portfile.cmake b/vcpkg/ports/hashids/portfile.cmake
new file mode 100644
index 0000000..4ccb177
--- /dev/null
+++ b/vcpkg/ports/hashids/portfile.cmake
@@ -0,0 +1,30 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO tzvetkoff/hashids.c
+ REF "v${VERSION}"
+ SHA512 f752a95118f729eb9e9651fc5d0112271c5cb95c8cefeaef33f61611274075ba4085edca58fb14823d4665de4044eff24397b891a22c2cb196e9c1c287fae378
+ HEAD_REF master
+ PATCHES
+ hashids.patch
+)
+
+set(EXTRA_OPTS "")
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ # $LIBS is an environment variable that vcpkg already pre-populated with some libraries.
+ # We need to re-purpose it when passing LIBS option to make to avoid overriding the vcpkg's own list.
+ list(APPEND EXTRA_OPTS "LIBS=-lgetopt \$LIBS")
+endif()
+
+vcpkg_configure_make(
+ SOURCE_PATH "${SOURCE_PATH}"
+ AUTOCONFIG
+ OPTIONS
+ ${EXTRA_OPTS}
+)
+
+vcpkg_install_make()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
diff --git a/vcpkg/ports/hashids/vcpkg.json b/vcpkg/ports/hashids/vcpkg.json
new file mode 100644
index 0000000..2b97a2f
--- /dev/null
+++ b/vcpkg/ports/hashids/vcpkg.json
@@ -0,0 +1,13 @@
+{
+ "name": "hashids",
+ "version": "1.2.2",
+ "description": "generate short unique ids from integers",
+ "homepage": "https://hashids.org/c/",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "getopt",
+ "platform": "windows & !mingw"
+ }
+ ]
+}