From 57e91daefea5c3d8e3604c3cc2b6c1d2adbed0d5 Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Tue, 26 Nov 2024 13:59:12 -0500
Subject: [PATCH] build: Windows: update contribs (llhttp-migration)

Change-Id: I58292280dcd9451f59033976897aae5af023241c
---
 CMakeLists.txt                               |   4 +-
 contrib/src/dhtnet/package.json              |   2 +-
 contrib/src/http_parser/http-parser-vs.patch | 134 -------------------
 contrib/src/http_parser/package.json         |  16 ---
 contrib/src/llhttp/package.json              |  11 ++
 contrib/src/opendht/package.json             |   2 +-
 contrib/src/restinio/package.json            |  30 +++--
 7 files changed, 35 insertions(+), 164 deletions(-)
 delete mode 100644 contrib/src/http_parser/http-parser-vs.patch
 delete mode 100644 contrib/src/http_parser/package.json
 create mode 100644 contrib/src/llhttp/package.json

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6fed72b7ed..77c2614fef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -393,7 +393,7 @@ if(MSVC)
            "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/asio/asio/include;"
            "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/restinio/dev;"
            "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/fmt/include;"
-           "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/http_parser;"
+           "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/llhttp/include;"
            "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/natpmp/include;"
            "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/msgpack-c/include;"
            "${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/opendht/include;"
@@ -517,7 +517,7 @@ if(MSVC)
         ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/pjproject/pjlib/lib/pjlib-x86_64-x64-vc15-Release.lib
         ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/pjproject/pjnath/lib/pjnath-x86_64-x64-vc15-Release.lib
         ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/fmt/msvc/Release/fmt.lib
-        ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/http_parser/x64/Release/http-parser.lib
+        ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/llhttp/build/Release/llhttp.lib
         ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/libcrypto.lib
         ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/openssl/libssl.lib
         ${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/speexdsp/lib/libspeexdsp.lib
diff --git a/contrib/src/dhtnet/package.json b/contrib/src/dhtnet/package.json
index bdd074c315..109a5619a5 100644
--- a/contrib/src/dhtnet/package.json
+++ b/contrib/src/dhtnet/package.json
@@ -1,6 +1,6 @@
 {
     "name": "dhtnet",
-    "version": "3bd76bcc786d9db2b9efb118f625092146d3591b",
+    "version": "a7d1be9886dba9094c801a924c02ded59d75132c",
     "url": "https://review.jami.net/plugins/gitiles/dhtnet/+archive/__VERSION__.tar.gz",
     "deps": [
         "opendht",
diff --git a/contrib/src/http_parser/http-parser-vs.patch b/contrib/src/http_parser/http-parser-vs.patch
deleted file mode 100644
index dd6f3fb693..0000000000
--- a/contrib/src/http_parser/http-parser-vs.patch
+++ /dev/null
@@ -1,134 +0,0 @@
---- /dev/null
-+++ b/http-parser.vcxproj
-@@ -0,0 +1,127 @@
-+<?xml version="1.0" encoding="utf-8"?>
-+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-+  <ItemGroup Label="ProjectConfigurations">
-+    <ProjectConfiguration Include="Debug|Win32">
-+      <Configuration>Debug</Configuration>
-+      <Platform>Win32</Platform>
-+    </ProjectConfiguration>
-+    <ProjectConfiguration Include="Release|Win32">
-+      <Configuration>Release</Configuration>
-+      <Platform>Win32</Platform>
-+    </ProjectConfiguration>
-+    <ProjectConfiguration Include="Debug|x64">
-+      <Configuration>Debug</Configuration>
-+      <Platform>x64</Platform>
-+    </ProjectConfiguration>
-+    <ProjectConfiguration Include="Release|x64">
-+      <Configuration>Release</Configuration>
-+      <Platform>x64</Platform>
-+    </ProjectConfiguration>
-+  </ItemGroup>
-+  <PropertyGroup Label="Globals">
-+    <VCProjectVersion>15.0</VCProjectVersion>
-+    <ProjectGuid>{4B7A0E04-2DEE-4BBE-8963-93B6F081C10A}</ProjectGuid>
-+    <RootNamespace>httpparser</RootNamespace>
-+    <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
-+  </PropertyGroup>
-+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-+    <ConfigurationType>Application</ConfigurationType>
-+    <UseDebugLibraries>true</UseDebugLibraries>
-+    <PlatformToolset>v141</PlatformToolset>
-+    <CharacterSet>MultiByte</CharacterSet>
-+  </PropertyGroup>
-+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-+    <ConfigurationType>Application</ConfigurationType>
-+    <UseDebugLibraries>false</UseDebugLibraries>
-+    <PlatformToolset>v141</PlatformToolset>
-+    <WholeProgramOptimization>true</WholeProgramOptimization>
-+    <CharacterSet>MultiByte</CharacterSet>
-+  </PropertyGroup>
-+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-+    <ConfigurationType>Application</ConfigurationType>
-+    <UseDebugLibraries>true</UseDebugLibraries>
-+    <PlatformToolset>v141</PlatformToolset>
-+    <CharacterSet>MultiByte</CharacterSet>
-+  </PropertyGroup>
-+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-+    <ConfigurationType>StaticLibrary</ConfigurationType>
-+    <UseDebugLibraries>false</UseDebugLibraries>
-+    <PlatformToolset>v141</PlatformToolset>
-+    <WholeProgramOptimization>true</WholeProgramOptimization>
-+    <CharacterSet>MultiByte</CharacterSet>
-+  </PropertyGroup>
-+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-+  <ImportGroup Label="ExtensionSettings">
-+  </ImportGroup>
-+  <ImportGroup Label="Shared">
-+  </ImportGroup>
-+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-+  </ImportGroup>
-+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-+  </ImportGroup>
-+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-+  </ImportGroup>
-+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-+  </ImportGroup>
-+  <PropertyGroup Label="UserMacros" />
-+  <PropertyGroup />
-+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-+    <ClCompile>
-+      <WarningLevel>Level3</WarningLevel>
-+      <Optimization>Disabled</Optimization>
-+      <SDLCheck>true</SDLCheck>
-+      <ConformanceMode>true</ConformanceMode>
-+    </ClCompile>
-+  </ItemDefinitionGroup>
-+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-+    <ClCompile>
-+      <WarningLevel>Level3</WarningLevel>
-+      <Optimization>Disabled</Optimization>
-+      <SDLCheck>true</SDLCheck>
-+      <ConformanceMode>true</ConformanceMode>
-+    </ClCompile>
-+  </ItemDefinitionGroup>
-+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-+    <ClCompile>
-+      <WarningLevel>Level3</WarningLevel>
-+      <Optimization>MaxSpeed</Optimization>
-+      <FunctionLevelLinking>true</FunctionLevelLinking>
-+      <IntrinsicFunctions>true</IntrinsicFunctions>
-+      <SDLCheck>true</SDLCheck>
-+      <ConformanceMode>true</ConformanceMode>
-+    </ClCompile>
-+    <Link>
-+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-+      <OptimizeReferences>true</OptimizeReferences>
-+    </Link>
-+  </ItemDefinitionGroup>
-+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-+    <ClCompile>
-+      <WarningLevel>Level3</WarningLevel>
-+      <Optimization>MaxSpeed</Optimization>
-+      <FunctionLevelLinking>true</FunctionLevelLinking>
-+      <IntrinsicFunctions>true</IntrinsicFunctions>
-+      <SDLCheck>true</SDLCheck>
-+      <ConformanceMode>true</ConformanceMode>
-+      <AdditionalIncludeDirectories>$(ProjectDir)..\;$(ProjectDir)</AdditionalIncludeDirectories>
-+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-+    </ClCompile>
-+    <Link>
-+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-+      <OptimizeReferences>true</OptimizeReferences>
-+    </Link>
-+  </ItemDefinitionGroup>
-+  <ItemGroup>
-+    <ClCompile Include="contrib\parsertrace.c" />
-+    <ClCompile Include="contrib\url_parser.c" />
-+    <ClCompile Include="http_parser.c" />
-+  </ItemGroup>
-+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-+  <ImportGroup Label="ExtensionTargets">
-+  </ImportGroup>
-+</Project>
-\ No newline at end of file
--- 
-2.19.0.windows.1
-
diff --git a/contrib/src/http_parser/package.json b/contrib/src/http_parser/package.json
deleted file mode 100644
index 85e6f67c09..0000000000
--- a/contrib/src/http_parser/package.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-    "name": "http_parser",
-    "version": "2.9.4",
-    "cpe": "cpe:2.3:a:nodejs:http-parser:2.9.4:*:*:*:*:*:*:*",
-    "url": "https://github.com/nodejs/http-parser/archive/v__VERSION__.tar.gz",
-    "deps": [],
-    "patches": [],
-    "win_patches": ["http-parser-vs.patch"],
-    "project_paths": ["http-parser.vcxproj"],
-    "with_env" : "",
-    "custom_scripts": {
-        "pre_build": [],
-        "build": [],
-        "post_build": []
-    }
-}
\ No newline at end of file
diff --git a/contrib/src/llhttp/package.json b/contrib/src/llhttp/package.json
new file mode 100644
index 0000000000..00b6fa9b68
--- /dev/null
+++ b/contrib/src/llhttp/package.json
@@ -0,0 +1,11 @@
+{
+    "name": "llhttp",
+    "version": "9.2.0",
+    "cpe": "cpe:2.3:a:llhttp:llhttp:9.2.0:*:*:*:*:*:*:*",
+    "url": "https://github.com/nodejs/llhttp/archive/release/v__VERSION__.tar.gz",
+    "use_cmake": true,
+    "defines": [
+        "BUILD_SHARED_LIBS=Off",
+        "BUILD_STATIC_LIBS=On"
+    ]
+}
diff --git a/contrib/src/opendht/package.json b/contrib/src/opendht/package.json
index 00e7bc6d46..d0fac965a1 100644
--- a/contrib/src/opendht/package.json
+++ b/contrib/src/opendht/package.json
@@ -1,6 +1,6 @@
 {
     "name": "opendht",
-    "version": "3c62026b5c0d48787a726eb9efb846977ed3eced",
+    "version": "7c184e1c8cbdd87d88912831eb0b845eb427fdfb",
     "url": "https://github.com/savoirfairelinux/opendht/archive/__VERSION__.tar.gz",
     "deps": [
         "argon2",
diff --git a/contrib/src/restinio/package.json b/contrib/src/restinio/package.json
index 9fae80c258..30290f1992 100644
--- a/contrib/src/restinio/package.json
+++ b/contrib/src/restinio/package.json
@@ -1,20 +1,30 @@
 {
     "name": "restinio",
-    "version": "bbaa034dbcc7555ce67df0f8a1475591a7441733",
+    "version": "0.7.2",
     "cpe": "cpe:2.3:a:*:restinio:0.7.2:*:*:*:*:*:*:*",
-    "url": "https://github.com/aberaud/restinio/archive/__VERSION__.tar.gz",
+    "url": "https://github.com/Stiffstream/restinio/releases/download/v.__VERSION__/restinio-__VERSION__.tar.bz2",
     "deps": [
         "fmt",
         "asio",
-        "http_parser"
+        "llhttp"
+    ],
+    "use_cmake": true,
+    "defines": [
+        "RESTINIO_TEST=OFF",
+        "RESTINIO_SAMPLE=OFF",
+        "RESTINIO_BENCHMARK=OFF",
+        "RESTINIO_WITH_SOBJECTIZER=OFF",
+        "RESTINIO_DEP_BOOST_ASIO=OFF",
+        "RESTINIO_DEP_STANDALONE_ASIO=system",
+        "RESTINIO_DEP_LLHTTP=system",
+        "RESTINIO_DEP_FMT=system",
+        "RESTINIO_DEP_EXPECTED_LITE=system"
     ],
-    "patches": [],
-    "win_patches": [],
-    "project_paths": [],
-    "with_env" : "",
     "custom_scripts": {
-        "pre_build": [],
-        "build": [],
-        "post_build": []
+        "pre_build": [
+            "wget https://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp",
+            "md '.\\dev\\nonstd' 2>nul || exit /b 0",
+            "move /Y expected.hpp '.\\dev\\nonstd\\' 2>nul || exit /b 0"
+        ]
     }
 }
\ No newline at end of file
-- 
GitLab