Skip to content

Commit

Permalink
Use Mapnik v4.0.0 for Dockerfiles and GitHub Actions (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
hummeltech authored Jun 26, 2024
1 parent 3612c5f commit 52e7a10
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 280 deletions.
80 changes: 33 additions & 47 deletions .github/actions/dependencies/build-and-install/mapnik/action.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,52 @@
---
inputs:
version:
default: latest
description: Version of Mapnik to build & install
required: true

runs:
using: composite
steps:
- name: Create `Mapnik` source directory
run: |
mkdir mapnik-src
shell: bash --noprofile --norc -euxo pipefail {0}

- name: Cache "Download `Mapnik`" & "Build `Mapnik`"
id: cache-mapnik-src
- name: Cache "Checkout `Mapnik`" & "Build `Mapnik`"
id: cache-mapnik
uses: actions/cache@v4
with:
path: mapnik-src
key: ${{ matrix.image }}-${{ matrix.compiler }}-mapnik-${{ inputs.version }}
path: |
mapnik-build
mapnik-src
key: ${{ matrix.image || matrix.os || matrix.box_generic || github.job }}-${{ matrix.compiler }}-mapnik-${{ inputs.version }}

- name: Download `Mapnik`
run: |
curl --silent --location \
https://github.com/mapnik/mapnik/releases/download/v${{ inputs.version }}/mapnik-v${{ inputs.version }}.tar.bz2 \
| tar --extract --bzip2 --strip-components=1 --file=-
shell: bash --noprofile --norc -euxo pipefail {0}
working-directory: mapnik-src
if: steps.cache-mapnik-src.outputs.cache-hit != 'true'
- name: Checkout `Mapnik`
uses: actions/checkout@v4
with:
path: mapnik-src
ref: ${{ inputs.version != 'latest' && format('v{0}', inputs.version) || '' }}
repository: mapnik/mapnik
submodules: recursive
if: steps.cache-mapnik.outputs.cache-hit != 'true'

- name: Build `Mapnik`
run: |
# Export variables
export CUSTOM_DEFINES="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"
export GDAL_DATA=/usr/share/gdal
export JOBS=${JOBS:-$(nproc)}
export PROJ_LIB=/usr/share/proj
export PYTHON=${PYTHON:-python3}
# Create GDAL_DATA/PROJ_LIB directories
mkdir --parents ${GDAL_DATA} ${PROJ_LIB}
# Configure & build
./configure \
CC="${CC:-gcc}" \
CUSTOM_CFLAGS="${CUSTOM_CFLAGS:-}" \
CUSTOM_CXXFLAGS="${CUSTOM_CXXFLAGS:-}" \
CUSTOM_DEFINES="${CUSTOM_DEFINES:-}" \
CUSTOM_LDFLAGS="${CUSTOM_LDFLAGS:-}" \
CXX="${CXX:-g++}" \
FAST=True \
OPTIMIZATION=0 \
PREFIX="/usr"
make PYTHON=${PYTHON} || make PYTHON=${PYTHON}
export CMAKE_BUILD_PARALLEL_LEVEL=${BUILD_PARALLEL_LEVEL:-$(nproc)}
cmake -B mapnik-build -S mapnik-src \
-DBUILD_BENCHMARK:BOOL=OFF \
-DBUILD_DEMO_CPP:BOOL=OFF \
-DBUILD_DEMO_VIEWER:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DBUILD_UTILITY_GEOMETRY_TO_WKB:BOOL=OFF \
-DBUILD_UTILITY_MAPNIK_INDEX:BOOL=OFF \
-DBUILD_UTILITY_MAPNIK_RENDER:BOOL=OFF \
-DBUILD_UTILITY_OGRINDEX:BOOL=OFF \
-DBUILD_UTILITY_PGSQL2SQLITE:BOOL=OFF \
-DBUILD_UTILITY_SHAPEINDEX:BOOL=OFF \
-DBUILD_UTILITY_SVG2PNG:BOOL=OFF \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/usr
cmake --build mapnik-build
shell: bash --noprofile --norc -euxo pipefail {0}
working-directory: mapnik-src
if: steps.cache-mapnik-src.outputs.cache-hit != 'true'
if: steps.cache-mapnik.outputs.cache-hit != 'true'

- name: Install `Mapnik`
run: |
# Export `PYTHON`
export PYTHON=${PYTHON:-python3}
make install PYTHON=${PYTHON}
run: ${{ !matrix.image && 'sudo' || '' }} cmake --install mapnik-build
shell: bash --noprofile --norc -euxo pipefail {0}
working-directory: mapnik-src

This file was deleted.

28 changes: 12 additions & 16 deletions .github/actions/dependencies/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,21 @@ inputs:
memcached
opensuse-mapnik-build-dependencies:
default: >-
bzip2
cmake
freetype-devel
gdal-devel
git
harfbuzz-devel
libboost_filesystem1_75_0-devel
libboost_headers1_75_0-devel
libboost_program_options1_75_0-devel
libboost_regex1_75_0-devel
libboost_system1_75_0-devel
libicu-devel
libjpeg8-devel
libpng16-devel
libtiff-devel
libwebp-devel
libxml2-devel
make
postgresql-devel
proj-devel
python3
sqlite3-devel
tar
zlib-devel
rhel-build-dependencies:
default: >-
Expand All @@ -145,22 +139,20 @@ inputs:
rhel-mapnik-build-dependencies:
default: >-
boost-devel
bzip2
cmake
freetype-devel
gdal-devel
git
harfbuzz-devel
libicu-devel
libjpeg-devel
libpng-devel
libtiff-devel
libwebp-devel
libxml2-devel
make
postgresql-devel
proj-devel
python3
sqlite-devel
tar
zlib-devel
ubuntu-build-dependencies:
default: >-
Expand Down Expand Up @@ -196,9 +188,9 @@ inputs:
lcov
memcached
mapnik-build-version-centos-stream:
default: 3.1.0
default: 4.0.0
mapnik-build-version-opensuse:
default: 3.1.0
default: 4.0.0

runs:
using: composite
Expand Down Expand Up @@ -309,11 +301,15 @@ runs:
if: (!matrix.mapnik_latest && startsWith(matrix.image, 'opensuse/'))

- name: Build & Install latest `mapnik` (Debian/Ubuntu)
uses: ./.github/actions/dependencies/build-and-install/mapnik/latest
uses: ./.github/actions/dependencies/build-and-install/mapnik
with:
version: latest
if: |
matrix.mapnik_latest &&
(startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:') || runner.os == 'Linux')
- name: Build & Install latest `mapnik` (openSUSE)
uses: ./.github/actions/dependencies/build-and-install/mapnik/latest
uses: ./.github/actions/dependencies/build-and-install/mapnik
with:
version: latest
if: (matrix.mapnik_latest && startsWith(matrix.image, 'opensuse/'))
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ AC_CONFIG_HEADERS([includes/config.h])
AC_CONFIG_MACRO_DIR([m4])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CXX
AC_PROG_RANLIB

dnl Find C++ compiler
AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
Expand Down
6 changes: 3 additions & 3 deletions docker/archlinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ RUN export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
-DENABLE_TESTS:BOOL=ON && \
cmake --build .
RUN export CTEST_PARALLEL_LEVEL=$(nproc) && \
export DESTDIR=/tmp/mod_tile && \
ctest --output-on-failure && \
(cmake --install . --strip || make DESTDIR=${DESTDIR} install/strip)
ctest --output-on-failure
RUN export DESTDIR=/tmp/mod_tile && \
cmake --install . --strip

# Runner
FROM archlinux:latest as runner
Expand Down
Loading

0 comments on commit 52e7a10

Please sign in to comment.