From 38d714c7fa325ec67db0157967410d78f996b9cb Mon Sep 17 00:00:00 2001
From: Frank <65999885+FrankXie05@users.noreply.github.com>
Date: Thu, 19 Jan 2023 03:42:44 +0800
Subject: [PATCH] [libhv] add support ARM (#27524)

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
---
 ...87e954f02706502028baadc8c87e7382301b.patch | 36 +++++++++++++++++++
 ports/libhv/portfile.cmake                    |  2 ++
 ports/libhv/vcpkg.json                        |  3 +-
 versions/baseline.json                        |  2 +-
 versions/l-/libhv.json                        |  5 +++
 5 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 ports/libhv/d77287e954f02706502028baadc8c87e7382301b.patch

diff --git a/ports/libhv/d77287e954f02706502028baadc8c87e7382301b.patch b/ports/libhv/d77287e954f02706502028baadc8c87e7382301b.patch
new file mode 100644
index 0000000000..c1637a7091
--- /dev/null
+++ b/ports/libhv/d77287e954f02706502028baadc8c87e7382301b.patch
@@ -0,0 +1,36 @@
+From d77287e954f02706502028baadc8c87e7382301b Mon Sep 17 00:00:00 2001
+From: ithewei <ithewei@163.com>
+Date: Tue, 29 Nov 2022 10:37:21 +0800
+Subject: [PATCH] judge BYTE_ORDER
+
+---
+ base/hplatform.h | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/base/hplatform.h b/base/hplatform.h
+index 60023230..5e0a290c 100644
+--- a/base/hplatform.h
++++ b/base/hplatform.h
+@@ -237,13 +237,19 @@
+ 
+ // BYTE_ORDER
+ #ifndef BYTE_ORDER
+-#if defined(ARCH_X86)  || defined(ARCH_X86_64)   || \
+-    defined(__ARMEL__) || defined(__AARCH64EL__) || \
+-    defined(__MIPSEL)  || defined(__MIPS64EL)
++#if defined(__BYTE_ORDER)
++    #define BYTE_ORDER  __BYTE_ORDER
++#elif defined(__BYTE_ORDER__)
++    #define BYTE_ORDER  __BYTE_ORDER__
++#elif defined(ARCH_X86)  || defined(ARCH_X86_64)   || \
++      defined(__ARMEL__) || defined(__AARCH64EL__) || \
++      defined(__MIPSEL)  || defined(__MIPS64EL)
+     #define BYTE_ORDER  LITTLE_ENDIAN
+ #elif defined(__ARMEB__) || defined(__AARCH64EB__) || \
+       defined(__MIPSEB)  || defined(__MIPS64EB)
+     #define BYTE_ORDER  BIG_ENDIAN
++#elif defined(OS_WIN)
++    #define BYTE_ORDER  LITTLE_ENDIAN
+ #else
+     #warning "Unknown byte order!"
+ #endif
diff --git a/ports/libhv/portfile.cmake b/ports/libhv/portfile.cmake
index 1de0790206..8df398889f 100644
--- a/ports/libhv/portfile.cmake
+++ b/ports/libhv/portfile.cmake
@@ -4,6 +4,8 @@ vcpkg_from_github(
     REF 3a67fe506a291ee94ed80bbdd73553fcb6a6b1ef #v1.3.0
     SHA512 3aa341a94950b0d4f3351a6f62a4c34947b481bb59f1954dd8d031313e73d9c6add1017cf386c507b231b114d80cfc0739a50bed179bdbc31052c86e2f1321a3
     HEAD_REF master
+    PATCHES
+        d77287e954f02706502028baadc8c87e7382301b.patch
 )
 
 string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
diff --git a/ports/libhv/vcpkg.json b/ports/libhv/vcpkg.json
index af19f69724..3819c0e303 100644
--- a/ports/libhv/vcpkg.json
+++ b/ports/libhv/vcpkg.json
@@ -1,10 +1,11 @@
 {
   "name": "libhv",
   "version": "1.3.0",
+  "port-version": 1,
   "description": "Libhv is a C/C++ network library similar to libevent/libuv.",
   "homepage": "https://github.com/ithewei/libhv",
   "license": "BSD-3-Clause",
-  "supports": "!(arm | uwp)",
+  "supports": "!uwp",
   "dependencies": [
     {
       "name": "vcpkg-cmake",
diff --git a/versions/baseline.json b/versions/baseline.json
index 9fc123335b..24b954c3f9 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -3906,7 +3906,7 @@
     },
     "libhv": {
       "baseline": "1.3.0",
-      "port-version": 0
+      "port-version": 1
     },
     "libhydrogen": {
       "baseline": "2022-06-21",
diff --git a/versions/l-/libhv.json b/versions/l-/libhv.json
index e63371513f..ea7436d418 100644
--- a/versions/l-/libhv.json
+++ b/versions/l-/libhv.json
@@ -1,5 +1,10 @@
 {
   "versions": [
+    {
+      "git-tree": "13870ce60cbe4c1f12030a7d2319f9f08e860d03",
+      "version": "1.3.0",
+      "port-version": 1
+    },
     {
       "git-tree": "4a1197a59a8b7adec8ce11a66ece9d7f72cf0ee8",
       "version": "1.3.0",