Control: tags -1 + patch
Please find attached a patch (build-tested only).
>From e7127e5a2fa57f84dc12cc6d63671c872c48d28b Mon Sep 17 00:00:00 2001
From: Yavor Doganov
Date: Thu, 14 Dec 2023 18:31:41 +0200
Subject: [PATCH] Port to PCRE2 (#1050187)
---
debian/changelog | 7 +
debian/control | 2 +-
debian/patches/pcre2.patch | 316 +
debian/patches/series | 1 +
4 files changed, 325 insertions(+), 1 deletion(-)
create mode 100644 debian/patches/pcre2.patch
diff --git a/debian/changelog b/debian/changelog
index 0f44607..9874ff2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mvdsv (0.35-7) UNRELEASED; urgency=medium
+
+ * debian/patches/pcre2.patch: New; port to PCRE2 (Closes: #1050187).
+ * debian/control (Build-Depends): Replace libpcre3-dev with libpcre2-dev.
+
+ -- Yavor Doganov Thu, 14 Dec 2023 18:30:40 +0200
+
mvdsv (0.35-6) unstable; urgency=high
* Fix build failure on big endian systems
diff --git a/debian/control b/debian/control
index d53102d..f69173d 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Priority: optional
Build-Depends: debhelper-compat (= 13),
cmake,
libcurl4-openssl-dev,
- libpcre3-dev,
+ libpcre2-dev,
Rules-Requires-Root: no
Standards-Version: 4.6.2
Vcs-Browser: https://salsa.debian.org/games-team/mvdsv
diff --git a/debian/patches/pcre2.patch b/debian/patches/pcre2.patch
new file mode 100644
index 000..efad8d1
--- /dev/null
+++ b/debian/patches/pcre2.patch
@@ -0,0 +1,316 @@
+Description: Port to PCRE2.
+Bug-Debian: https://bugs.debian.org/1050187
+Author: Yavor Doganov
+Forwarded: no
+Last-Update: 2023-12-14
+---
+
+--- mvdsv.orig/CMakeLists.txt
mvdsv/CMakeLists.txt
+@@ -90,18 +90,14 @@
+
##
+
+ # Check for PCRE. if found, include it; if not found, use bundled PCRE.
+-find_library(PCRE_LIBRARIES pcre)
++find_library(PCRE_LIBRARIES pcre2-8)
+ if(PCRE_LIBRARIES)
+ set(PCRE_FOUND 1)
+- find_path(PCRE_INCLUDE_DIR pcre.h)
++ find_path(PCRE_INCLUDE_DIR pcre2.h)
+ endif(PCRE_LIBRARIES)
+
+ if(NOT PCRE_FOUND)
+- message(STATUS "PCRE library not found. Using bundled PCRE instead.")
+- list(APPEND SRC_COMMON
+- "${DIR_SRC}/pcre/get.c"
+- "${DIR_SRC}/pcre/pcre.c"
+- )
++ message(FATAL_ERROR "PCRE library not found.")
+ else()
+ message(STATUS "Found PCRE: ${PCRE_LIBRARIES}")
+ endif()
+--- mvdsv.orig/src/sv_demo_misc.c
mvdsv/src/sv_demo_misc.c
+@@ -22,7 +22,8 @@
+ #ifndef CLIENTONLY
+ #include "qwsvdef.h"
+ #ifndef SERVERONLY
+-#include "pcre.h"
++#define PCRE2_CODE_UNIT_WIDTH 8
++#include
+ #endif
+
+ #define MAX_DEMOINFO_SIZE (1024 * 200)
+@@ -342,8 +343,10 @@
+ int files[MAX_DIRFILES + 1];
+
+ int r;
+- pcre*preg;
+- const char *errbuf;
++ size_t erroffset;
++ pcre2_code *preg;
++ pcre2_match_data *md;
++ PCRE2_UCHAR errbuf[120];
+
+ memset(files, 0, sizeof(files));
+
+@@ -361,26 +364,29 @@
+ {
+ if (use_regex)
+ {
+- if (!(preg =
pcre_compile(Q_normalizetext(Cmd_Argv(j)), PCRE_CASELESS, , , NULL)))
++ if (!(preg =
pcre2_compile((PCRE2_SPTR)Q_normalizetext(Cmd_Argv(j)), PCRE2_ZERO_TERMINATED,
PCRE2_CASELESS, , , NULL)))
+ {
+- Con_Printf("Sys_listdir:
pcre_compile(%s) error: %s at offset %d\n",
+- Cmd_Argv(j), errbuf, r);
+- pcre_free(preg);
++ pcre2_get_error_message(r, errbuf,
sizeof(errbuf));
++ Con_Printf("Sys_listdir:
pcre2_compile(%s) error: %s at offset %lu\n",
++ Cmd_Argv(j), errbuf,
erroffset);
+ break;
+ }
+- switch (r = pcre_exec(preg, NULL, list->name,
+-strlen(list->name), 0, 0,
NULL, 0))
++ md = pcre2_match_data_create_from_pattern(preg,
NULL);
++ switch (r = pcre2_match(preg,
(PCRE2_SPTR)list->name,
++ strlen(list->name), 0,
0, md, NULL))
+ {
+ case 0:
+- pcre_free(preg);
++ pcre2_match_data_free(md);
++ pcre2_code_free(preg);
+ continue;
+- case