[Git][debian-gis-team/mapcache][master] 2 commits: Add patch to support pcre2.
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Fri Jul 28 18:55:57 BST 2023
Bas Couwenberg pushed to branch master at Debian GIS Project / mapcache
Commits:
60c0dfed by Bas Couwenberg at 2023-07-28T19:48:50+02:00
Add patch to support pcre2.
- - - - -
6f75e185 by Bas Couwenberg at 2023-07-28T19:50:23+02:00
Enable pcre2 support.
- - - - -
5 changed files:
- debian/changelog
- debian/control
- + debian/patches/pcre2.patch
- debian/patches/series
- debian/rules
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+mapcache (1.14.0-3) UNRELEASED; urgency=medium
+
+ * Add patch to support pcre2.
+ * Enable pcre2 support.
+
+ -- Bas Couwenberg <sebastic at debian.org> Fri, 28 Jul 2023 19:48:23 +0200
+
mapcache (1.14.0-2) unstable; urgency=medium
* Bump debhelper compat to 13.
=====================================
debian/control
=====================================
@@ -24,6 +24,7 @@ Build-Depends: debhelper-compat (= 13),
libjpeg-dev,
liblmdb-dev,
libmemcached-dev,
+ libpcre2-dev,
libpixman-1-dev,
libpng-dev,
librsvg2-dev,
=====================================
debian/patches/pcre2.patch
=====================================
@@ -0,0 +1,171 @@
+Description: Add support for pcre2.
+Author: Bas Couwenberg <sebastic at xs4all.nl>
+Origin: https://github.com/MapServer/mapcache/pull/314
+Bug: https://github.com/MapServer/mapcache/issues/272
+
+--- a/.github/workflows/build-linux.yml
++++ b/.github/workflows/build-linux.yml
+@@ -28,7 +28,7 @@ jobs:
+ fi
+ if [[ 'maximal' =~ ${{ matrix.option }} ]]
+ then
+- sudo apt-get install -y libhiredis-dev libdb-dev libmapserver-dev
++ sudo apt-get install -y libhiredis-dev libdb-dev libmapserver-dev libpcre2-dev
+ fi
+
+ - name: Build MapCache
+@@ -55,7 +55,8 @@ jobs:
+ -DWITH_TIFF=ON \
+ -DWITH_TIFF_WRITE_SUPPORT=ON \
+ -DWITH_GEOTIFF=ON \
+- -DWITH_PCRE=ON \
++ -DWITH_PCRE=OFF \
++ -DWITH_PCRE2=ON \
+ -DWITH_MAPSERVER=ON \
+ -DWITH_RIAK=OFF"
+ fi
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -97,6 +97,7 @@ option(WITH_TIFF "Use TIFFs as a cache b
+ option(WITH_TIFF_WRITE_SUPPORT "Enable (experimental) support for writable TIFF cache backends" OFF)
+ option(WITH_GEOTIFF "Allow GeoTIFF metadata creation for TIFF cache backends" OFF)
+ option(WITH_PCRE "Use PCRE for regex tests" OFF)
++option(WITH_PCRE2 "Use PCRE2 for regex tests" OFF)
+ option(WITH_MAPSERVER "Enable (experimental) support for the mapserver library" OFF)
+ option(WITH_RIAK "Use Riak as a cache backend" OFF)
+ option(WITH_GDAL "Choose if GDAL raster support should be built in" ON)
+@@ -205,6 +206,18 @@ if(WITH_PCRE)
+ endif(PCRE_FOUND)
+ endif (WITH_PCRE)
+
++if(WITH_PCRE2)
++ find_package(PCRE2)
++ if(PCRE2_FOUND)
++ include_directories(${PCRE2_INCLUDE_DIR})
++ target_link_libraries(mapcache PCRE2::PCRE2-8)
++ set (USE_PCRE2 1)
++ add_definitions(-DPCRE2_CODE_UNIT_WIDTH=8)
++ else(PCRE2_FOUND)
++ report_optional_not_found(PCRE2)
++ endif(PCRE2_FOUND)
++endif (WITH_PCRE2)
++
+ if(WITH_SQLITE)
+ find_package(SQLITE)
+ if(SQLITE_FOUND)
+@@ -365,6 +378,7 @@ status_optional_component("TIFF" "${USE_
+ status_optional_component("GeoTIFF" "${USE_GEOTIFF}" "${GEOTIFF_LIBRARY}")
+ status_optional_component("Experimental TIFF write support" "${USE_TIFF_WRITE}" "${TIFF_LIBRARY}")
+ status_optional_component("PCRE" "${USE_PCRE}" "${PCRE_LIBRARY}")
++status_optional_component("PCRE2" "${USE_PCRE2}" "${PCRE2-8_LIBRARY}")
+ status_optional_component("Experimental mapserver support" "${USE_MAPSERVER}" "${MAPSERVER_LIBRARY}")
+ status_optional_component("RIAK" "${USE_RIAK}" "${RIAK_LIBRARY}")
+ status_optional_component("GDAL" "${USE_GDAL}" "${GDAL_LIBRARY}")
+--- /dev/null
++++ b/cmake/FindPCRE2.cmake
+@@ -0,0 +1,27 @@
++# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
++# file COPYING-CMAKE-SCRIPTS or https://cmake.org/licensing for details.
++
++#.rst
++# FindPCRE2
++# ~~~~~~~~~
++# Copyright (C) 2017-2018, Hiroshi Miura
++#
++# Find the native PCRE2 headers and libraries.
++
++find_path(PCRE2_INCLUDE_DIR NAMES pcre2.h)
++find_library(PCRE2-8_LIBRARY NAMES pcre2-8 pcre2-8d pcre2-8-static pcre2-8-staticd NAMES_PER_DIR)
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(PCRE2
++ REQUIRED_VARS PCRE2-8_LIBRARY PCRE2_INCLUDE_DIR)
++mark_as_advanced(PCRE2_INCLUDE_DIR PCRE2-8_LIBRARY)
++if(PCRE2_FOUND)
++ list(APPEND PCRE2_LIBRARIES "${PCRE2-8_LIBRARY}")
++ set(PCRE2_INCLUDE_DIRS "${PCRE2_INCLUDE_DIR}")
++ if(NOT TARGET PCRE2::PCRE2-8)
++ add_library(PCRE2::PCRE2-8 UNKNOWN IMPORTED)
++ set_target_properties(PCRE2::PCRE2-8 PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
++ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
++ IMPORTED_LOCATION "${PCRE2-8_LIBRARY}")
++ endif()
++endif()
+--- a/include/mapcache-config.h.in
++++ b/include/mapcache-config.h.in
+@@ -13,6 +13,7 @@
+ #cmakedefine USE_TIFF_WRITE 1
+ #cmakedefine USE_GEOTIFF 1
+ #cmakedefine USE_PCRE 1
++#cmakedefine USE_PCRE2 1
+ #cmakedefine USE_MAPSERVER 1
+ #cmakedefine USE_RIAK 1
+ #cmakedefine USE_GDAL 1
+--- a/lib/dimension.c
++++ b/lib/dimension.c
+@@ -31,7 +31,9 @@
+ #include <apr_strings.h>
+ #include <math.h>
+ #include <sys/types.h>
+-#ifdef USE_PCRE
++#if defined(USE_PCRE2)
++#include <pcre2.h>
++#elif defined(USE_PCRE)
+ #include <pcre.h>
+ #else
+ #include <regex.h>
+@@ -51,7 +53,9 @@ struct mapcache_dimension_values {
+ struct mapcache_dimension_regex {
+ mapcache_dimension dimension;
+ char *regex_string;
+-#ifdef USE_PCRE
++#if defined(USE_PCRE2)
++ pcre2_code *pcregex;
++#elif defined(USE_PCRE)
+ pcre *pcregex;
+ #else
+ regex_t *regex;
+@@ -127,7 +131,13 @@ static apr_array_header_t* _mapcache_dim
+ {
+ mapcache_dimension_regex *dimension = (mapcache_dimension_regex*)dim;
+ apr_array_header_t *values = apr_array_make(ctx->pool,1,sizeof(char*));
+-#ifdef USE_PCRE
++#if defined(USE_PCRE2)
++ pcre2_match_data *match_data;
++ int rc = pcre2_match(dimension->pcregex,(PCRE2_SPTR)value,strlen(value),0,0,match_data,NULL);
++ if(rc>0) {
++ APR_ARRAY_PUSH(values,char*) = apr_pstrdup(ctx->pool,value);
++ }
++#elif defined(USE_PCRE)
+ int ovector[30];
+ int rc = pcre_exec(dimension->pcregex,NULL,value,strlen(value),0,0,ovector,30);
+ if(rc>0) {
+@@ -168,7 +178,18 @@ static void _mapcache_dimension_regex_pa
+ ctx->set_error(ctx,400,"failed to parse %s regex: no <regex> child supplied",dim->class_name);
+ return;
+ }
+-#ifdef USE_PCRE
++#if defined(USE_PCRE2)
++ {
++ int pcre_err;
++ PCRE2_SIZE *pcre_offset;
++ dimension->pcregex = pcre2_compile((PCRE2_SPTR8)dimension->regex_string,strlen(dimension->regex_string), 0, &pcre_err, pcre_offset, NULL);
++ if(!dimension->pcregex) {
++ ctx->set_error(ctx,400,"failed to compile regular expression \"%s\" for %s \"%s\": %d",
++ dimension->regex_string,dim->class_name,dim->name,pcre_err);
++ return;
++ }
++ }
++#elif defined(USE_PCRE)
+ {
+ const char *pcre_err;
+ int pcre_offset;
+@@ -294,7 +315,7 @@ mapcache_dimension* mapcache_dimension_r
+ mapcache_dimension_regex *dimension = apr_pcalloc(pool, sizeof(mapcache_dimension_regex));
+ dimension->dimension.type = MAPCACHE_DIMENSION_REGEX;
+ dimension->dimension.class_name = "dimension";
+-#ifndef USE_PCRE
++#if !defined(USE_PCRE) && !defined(USE_PCRE2)
+ dimension->regex = (regex_t*)apr_pcalloc(pool, sizeof(regex_t));
+ #endif
+ dimension->dimension._get_entries_for_value = _mapcache_dimension_regex_get_entries_for_value;
=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
cmake-mapserver-include.patch
+pcre2.patch
=====================================
debian/rules
=====================================
@@ -45,6 +45,7 @@ CMAKE_OPTS:= \
-DWITH_MAPSERVER=0 \
-DWITH_OGR=1 \
-DWITH_PCRE=0 \
+ -DWITH_PCRE2=1 \
-DWITH_PIXMAN=1 \
-DWITH_REDIS=1 \
-DWITH_SQLITE=1 \
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapcache/-/compare/c6f2264da7eb6e28c95348308685fbce1c47d9b4...6f75e1854176b1d7965dfa7047001c69b050c7c2
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapcache/-/compare/c6f2264da7eb6e28c95348308685fbce1c47d9b4...6f75e1854176b1d7965dfa7047001c69b050c7c2
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20230728/9df25ef2/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list