diff --git a/.github/actions/mapnik/build-and-install/action.yml b/.github/actions/mapnik/build-and-install/action.yml index 2141c4b..3783204 100644 --- a/.github/actions/mapnik/build-and-install/action.yml +++ b/.github/actions/mapnik/build-and-install/action.yml @@ -19,7 +19,7 @@ runs: - name: Cache "Download `Mapnik`" & "Build & Install `Mapnik`" id: cache-mapnik - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: /usr/local/src/mapnik-${{ inputs.version }} key: ${{ matrix.image }}-mapnik-${{ inputs.version }} diff --git a/.github/actions/yum/install/action.yml b/.github/actions/yum/install/action.yml index c9bbbba..84323c3 100644 --- a/.github/actions/yum/install/action.yml +++ b/.github/actions/yum/install/action.yml @@ -14,7 +14,7 @@ runs: using: composite steps: - name: Cache `DNF` / `YUM` - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | /var/cache/dnf diff --git a/.github/workflows/build-and-test-mapnik-4.yml b/.github/workflows/build-and-test-mapnik-4.yml new file mode 100644 index 0000000..360b6b5 --- /dev/null +++ b/.github/workflows/build-and-test-mapnik-4.yml @@ -0,0 +1,141 @@ +--- +name: Build & Test (Mapnik >= 4) + +on: + pull_request: + push: + branches: + - master + - develop + +jobs: + build-and-test-mapnik-4: + name: ${{ matrix.image }} + runs-on: ubuntu-latest + strategy: + matrix: + image: + - 'debian:11' + on_default_branch: + - ${{ contains(github.ref, 'master') }} + include: + - image: 'ubuntu:22.04' + exclude: + - on_default_branch: false + fail-fast: false + container: + image: ${{ matrix.image }} + steps: + - name: Checkout `mod_tile` + uses: actions/checkout@v3 + + - name: Install Dependencies (Debian) + uses: ./.github/actions/apt-get/install + with: + packages: >- + ${{ env.debian-build-dependencies }} + ${{ env.debian-mapnik-build-dependencies }} + ${{ env.debian-test-dependencies }} + if: ${{ startsWith(matrix.image, 'debian:') }} + + - name: Install Dependencies (Ubuntu) + uses: ./.github/actions/apt-get/install + with: + packages: >- + ${{ env.ubuntu-build-dependencies }} + ${{ env.ubuntu-mapnik-build-dependencies }} + ${{ env.ubuntu-test-dependencies }} + if: ${{ startsWith(matrix.image, 'ubuntu:') }} + + - name: Checkout `mapnik` + uses: actions/checkout@v3 + with: + path: mapnik + repository: mapnik/mapnik + submodules: recursive + + - name: Build `mapnik` + run: | + export CMAKE_BUILD_PARALLEL_LEVEL=${BUILD_PARALLEL_LEVEL:-$(nproc)} + cmake -S mapnik -B mapnik-build \ + -DBUILD_DEMO_VIEWER:BOOL=OFF \ + -DBUILD_TESTING:BOOL=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX:PATH=/usr + cmake --build mapnik-build + + - name: Install `mapnik` + run: cmake --install mapnik-build + + - name: Build `mod_tile` + uses: ./.github/actions/build + + - name: Install `mod_tile` + uses: ./.github/actions/install + + - name: Configure Apache HTTP Server + uses: ./.github/actions/apache/configure + + - name: Test `mod_tile` + uses: ./.github/actions/test + timeout-minutes: 5 + +env: + debian-build-dependencies: >- + apache2-dev + libcairo2-dev + libcurl4-gnutls-dev + libglib2.0-dev + libiniparser-dev + libmemcached-dev + librados-dev + debian-test-dependencies: >- + apache2 + libjs-leaflet + debian-mapnik-build-dependencies: >- + cmake + git + libboost-filesystem-dev + libboost-program-options-dev + libboost-regex-dev + libfreetype6-dev + libgdal-dev + libharfbuzz-dev + libicu-dev + libjpeg-dev + libpq-dev + libproj-dev + libsqlite3-dev + libtiff-dev + libwebp-dev + libxml2-dev + postgresql-server-dev-all + ubuntu-build-dependencies: >- + apache2-dev + libcairo2-dev + libcurl4-gnutls-dev + libglib2.0-dev + libiniparser-dev + libmemcached-dev + librados-dev + ubuntu-test-dependencies: >- + apache2 + libjs-leaflet + ubuntu-mapnik-build-dependencies: >- + cmake + git + libboost-filesystem-dev + libboost-program-options-dev + libboost-regex-dev + libfreetype6-dev + libgdal-dev + libharfbuzz-dev + libicu-dev + libjpeg-dev + libpq-dev + libproj-dev + libsqlite3-dev + libtiff-dev + libwebp-dev + libxml2-dev + postgresql-server-dev-all diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c49c718..bdd58bd 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -32,7 +32,7 @@ jobs: image: ${{ matrix.image }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install Dependencies (CentOS) uses: ./.github/actions/yum/install diff --git a/configure.ac b/configure.ac index ea2d3e9..9535577 100644 --- a/configure.ac +++ b/configure.ac @@ -51,7 +51,11 @@ AC_SEARCH_LIBS(inet_ntoa, nsl) AC_SEARCH_LIBS(gethostbyname, resolv nsl) AC_SEARCH_LIBS(pow,m) AC_SEARCH_LIBS(clock_gettime,[rt posix4]) -AX_LIB_MAPNIK +PKG_CHECK_MODULES([MAPNIK], [libmapnik >= 4], [ + AC_DEFINE([HAVE_MAPNIK], [1]) + AC_SUBST([MAPNIK_LDFLAGS], [${MAPNIK_LIBS}]) + ], [AX_LIB_MAPNIK] +) AX_ENABLE_LIBMEMCACHED LIBCURL_CHECK_CONFIG AC_CHECK_LIB(rados, rados_version, [ diff --git a/src/gen_tile.cpp b/src/gen_tile.cpp index 2c49f0b..9b05cb7 100644 --- a/src/gen_tile.cpp +++ b/src/gen_tile.cpp @@ -67,9 +67,13 @@ #define box2d Envelope #define zoom_to_box zoomToBox #else +#if MAPNIK_VERSION >= 400000 +#include +#else #include #endif #endif +#endif using namespace mapnik; diff --git a/src/gen_tile_test.cpp b/src/gen_tile_test.cpp index 49803a0..368b65e 100644 --- a/src/gen_tile_test.cpp +++ b/src/gen_tile_test.cpp @@ -54,8 +54,12 @@ #define box2d Envelope #define zoom_to_box zoomToBox #else +#if MAPNIK_VERSION >= 400000 +#include +#else #include #endif +#endif #define NO_QUEUE_REQUESTS 9