summarylogtreecommitdiffstats
path: root/0001-patch-for-arch.patch
blob: 7f582bc8090953f140fc4c4db4733072d88e5a44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
From 4982ee077d8b9ed7324ca48dd356f57054a090a7 Mon Sep 17 00:00:00 2001
From: txtsd <code@ihavea.quest>
Date: Fri, 29 Nov 2024 08:51:54 +0530
Subject: [PATCH] patch for arch

Signed-off-by: txtsd <code@ihavea.quest>
---
 CMakeLists.txt       | 66 ++++++++++----------------------------------
 src/http/handler.hpp |  2 +-
 2 files changed, 16 insertions(+), 52 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30bdb3e..2ffdd6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,9 +9,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

 set(CMAKE_CXX_STANDARD 20)

-include(ExternalAntlr4Cpp)
-include(FetchContent)
-
 set(BUILD_TESTS                 OFF CACHE BOOL "Build tests" FORCE)
 set(BUILD_TOOLS         OFF CACHE BOOL "Build tools" FORCE)
 set(BUILD_REGRESS       OFF CACHE BOOL "Build regression tests" FORCE)
@@ -36,18 +33,16 @@ find_package(OpenSSL             REQUIRED)
 find_package(SQLite3             REQUIRED)
 find_package(ZLIB                REQUIRED)

-FetchContent_Declare(curl          URL https://github.com/curl/curl/archive/refs/tags/curl-8_6_0.tar.gz)
-FetchContent_Declare(jwt-cpp       URL https://github.com/Thalhammer/jwt-cpp/archive/refs/tags/v0.7.0.tar.gz)
-FetchContent_Declare(libzip        URL https://github.com/nih-at/libzip/archive/refs/tags/v1.10.1.tar.gz)
-FetchContent_Declare(tomlplusplus  URL https://github.com/marzer/tomlplusplus/archive/refs/tags/v3.4.0.tar.gz)
-FetchContent_Declare(uriparser     URL https://github.com/uriparser/uriparser/archive/refs/tags/uriparser-0.9.7.tar.gz)
-
-FetchContent_MakeAvailable(
-    curl
-    jwt-cpp
-    libzip
-    tomlplusplus
-    uriparser)
+find_package(libzip         REQUIRED)
+find_package(tomlplusplus   REQUIRED)
+find_package(uriparser      REQUIRED)
+set(jwt-cpp_DIR /usr/lib/cmake)
+find_package(jwt-cpp        REQUIRED)
+find_package(sol2           REQUIRED)
+find_package(antlr4-runtime REQUIRED)
+find_package(PkgConfig      REQUIRED)
+pkg_check_modules(usockets  REQUIRED IMPORTED_TARGET usockets)
+pkg_check_modules(curl      REQUIRED IMPORTED_TARGET libcurl)

 add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
@@ -61,38 +56,6 @@ add_custom_command(
     COMMAND ${CMAKE_COMMAND} -P
     ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FileEmbed.cmake)

-add_library(
-    uSockets
-    STATIC
-    vendor/uWebSockets/uSockets/src/crypto/openssl.c
-    vendor/uWebSockets/uSockets/src/eventing/asio.cpp
-    vendor/uWebSockets/uSockets/src/bsd.c
-    vendor/uWebSockets/uSockets/src/context.c
-    vendor/uWebSockets/uSockets/src/loop.c
-    vendor/uWebSockets/uSockets/src/quic.c
-    vendor/uWebSockets/uSockets/src/socket.c
-    vendor/uWebSockets/uSockets/src/udp.c
-)
-
-target_compile_definitions(
-    uSockets
-    PRIVATE
-    -DLIBUS_NO_SSL
-    -DLIBUS_USE_ASIO
-)
-
-target_include_directories(
-    uSockets
-    PUBLIC
-    vendor/uWebSockets/uSockets/src
-)
-
-target_link_libraries(
-    uSockets
-    PRIVATE
-    Boost::boost
-)
-
 add_library(
     ${PROJECT_NAME}_utils
     STATIC
@@ -234,7 +197,7 @@ target_include_directories(
     ${LUA_INCLUDE_DIR}
     vendor/croncpp/include
     vendor/nlohmann-json/include
-    vendor/sol2/include
+    ${SOL2_INCLUDE_DIRS}
 )

 target_link_libraries(
@@ -244,16 +207,17 @@ target_link_libraries(
     ${PROJECT_NAME}_utils

     Boost::boost Boost::log Boost::program_options
-    CURL::libcurl
+    PkgConfig::curl
     jwt-cpp::jwt-cpp
     libzip::zip
+    ZLIB::ZLIB
     lua
     sodium
     SQLite::SQLite3
     torrent-rasterbar
     tomlplusplus::tomlplusplus
     uriparser
-    uSockets
+    PkgConfig::usockets
     -lcrypto
     -lssl
     -lgit2
@@ -268,5 +232,5 @@ add_executable(
 target_link_libraries(
     ${PROJECT_NAME}
     ${PROJECT_NAME}_core
-    uSockets
+    PkgConfig::usockets
 )
diff --git a/src/http/handler.hpp b/src/http/handler.hpp
index e6ef4cd..2019df4 100644
--- a/src/http/handler.hpp
+++ b/src/http/handler.hpp
@@ -2,7 +2,7 @@

 #include <functional>

-#include "../../vendor/uWebSockets/src/App.h"
+#include <uWebSockets/App.h>

 namespace porla::Http
 {
--
2.47.1