aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/binn
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/binn
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/binn')
-rw-r--r--vcpkg/ports/binn/0001_fix_uwp.patch54
-rw-r--r--vcpkg/ports/binn/CMakeLists.txt21
-rw-r--r--vcpkg/ports/binn/portfile.cmake24
-rw-r--r--vcpkg/ports/binn/vcpkg.json16
4 files changed, 115 insertions, 0 deletions
diff --git a/vcpkg/ports/binn/0001_fix_uwp.patch b/vcpkg/ports/binn/0001_fix_uwp.patch
new file mode 100644
index 0000000..f43cdd2
--- /dev/null
+++ b/vcpkg/ports/binn/0001_fix_uwp.patch
@@ -0,0 +1,54 @@
+diff --git a/src/binn.c b/src/binn.c
+index ef32f35..d12d473 100644
+--- a/src/binn.c
++++ b/src/binn.c
+@@ -142,8 +142,14 @@ BINN_PRIVATE void copy_be64(u64 *pdest, u64 *psource) {
+ /***************************************************************************/
+
+ #ifndef WIN32
+ #define stricmp strcasecmp
+ #define strnicmp strncasecmp
++#define sprintf_s(b, n, ...) sprintf(b, __VA_ARGS__)
++#define strcpy_s(b, n, s) strcpy(b, s)
++#else
++#define stricmp _stricmp
++#define strnicmp _strnicmp
++#define strdup _strdup
+ #endif
+
+ BINN_PRIVATE BOOL IsValidBinnHeader(void *pbuf, int *ptype, int *pcount, int *psize, int *pheadersize);
+@@ -1582,6 +1588,7 @@ BINN_PRIVATE BOOL binn_read_pair(int expected_type, void *ptr, int pos, int *pid
+ base = p;
+ plimit = p + size - 1;
+ p += header_size;
++ key = 0;
+
+ for (i = 0; i < count; i++) {
+ switch (type) {
+@@ -3333,7 +3340,7 @@ char * APIENTRY binn_get_str(binn *value) {
+
+ if (type_family(value->type) == BINN_FAMILY_INT) {
+ if (copy_int_value(value->ptr, &vint, value->type, BINN_INT64) == FALSE) return NULL;
+- sprintf(buf, "%" INT64_FORMAT, vint);
++ sprintf_s(buf, sizeof buf, "%" INT64_FORMAT, vint);
+ goto loc_convert_value;
+ }
+
+@@ -3341,14 +3348,14 @@ char * APIENTRY binn_get_str(binn *value) {
+ case BINN_FLOAT:
+ value->vdouble = value->vfloat;
+ case BINN_DOUBLE:
+- sprintf(buf, "%g", value->vdouble);
++ sprintf_s(buf, sizeof buf, "%g", value->vdouble);
+ goto loc_convert_value;
+ case BINN_STRING:
+ return (char*) value->ptr;
+ case BINN_BOOL:
+ if (value->vbool)
+- strcpy(buf, "true");
++ strcpy_s(buf, sizeof buf, "true");
+ else
+- strcpy(buf, "false");
++ strcpy_s(buf, sizeof buf, "false");
+ goto loc_convert_value;
+ }
diff --git a/vcpkg/ports/binn/CMakeLists.txt b/vcpkg/ports/binn/CMakeLists.txt
new file mode 100644
index 0000000..f92b00c
--- /dev/null
+++ b/vcpkg/ports/binn/CMakeLists.txt
@@ -0,0 +1,21 @@
+cmake_minimum_required(VERSION 3.8)
+
+project(binn
+ VERSION 1.0
+ DESCRIPTION "Binn is a binary data serialization format designed to be compact, fast and easy to use."
+ HOMEPAGE_URL "https://github.com/liteserver/binn"
+)
+
+add_library (binn src/binn.h src/binn.c)
+
+target_include_directories(binn
+ PUBLIC
+ ${PROJECT_SOURCE_DIR}/src
+)
+
+install(
+ TARGETS binn
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
diff --git a/vcpkg/ports/binn/portfile.cmake b/vcpkg/ports/binn/portfile.cmake
new file mode 100644
index 0000000..ebe87e0
--- /dev/null
+++ b/vcpkg/ports/binn/portfile.cmake
@@ -0,0 +1,24 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO liteserver/binn
+ REF b657ef3f38b37aa1e5dea88a9332889d0fbf3a81 # 3.0
+ SHA512 14bf572152ec5343a161dea9ebfd2b63cd5ce48c0db3decf5591aa94ae7766771cf521ba22978e9ae8855feef694bad85951f3c4a29cb9ddd881918fc6d3722a
+ HEAD_REF master
+ PATCHES
+ 0001_fix_uwp.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+file(INSTALL "${SOURCE_PATH}/src/binn.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/binn")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+)
+
+vcpkg_cmake_install()
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/binn/vcpkg.json b/vcpkg/ports/binn/vcpkg.json
new file mode 100644
index 0000000..55ee552
--- /dev/null
+++ b/vcpkg/ports/binn/vcpkg.json
@@ -0,0 +1,16 @@
+{
+ "name": "binn",
+ "version": "3.0",
+ "port-version": 3,
+ "description": "Binn is a binary data serialization format designed to be compact, fast and easy to use.",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}