Commit 4ea8729e authored by David Hummel's avatar David Hummel Committed by ǝɹʇʇɐʃǝ◖ xıʃǝɟ
Browse files

Added build & test on CentOS 7

* Requires building `Mapnik`
  * Which requires these `EPEL` repository packages
    * `boost169-devel` + dependencies
    * `gdal-devel` + dependencies
    * `proj-devel` + dependencies
* Caches `Mapnik` build directory
  * Takes about 20-30 minutes without cache
  * Takes about 5-10 minutes with cache
* Runs on `push` to `centos7` branch & `pull_request`
* Includes very basic build documentation
parent 7c4081dc
---
name: Build & Test (CentOS 7)
on:
pull_request:
push:
branches:
- centos7
env:
build-dependencies: >-
boost169-devel
cairo-devel
freetype-devel
gdal-devel
glib2-devel
harfbuzz-devel
httpd-devel
iniparser-devel
libcurl-devel
libicu-devel
libjpeg-turbo-devel
libmemcached-devel
libpng-devel
librados2-devel
libtiff-devel
libwebp-devel
libxml2-devel
postgresql-devel
proj-devel
sqlite-devel
zlib-devel
mapnik-version: 3.0.24
jobs:
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
container:
image: centos:7
env:
LD_LIBRARY_PATH: /usr/local/lib
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install `EPEL` yum repository
uses: ./.github/actions/yum/install
with:
packages: epel-release
- name: Provision environment
uses: ./.github/actions/yum/provision
with:
packages: ${{ env.build-dependencies }}
- name: Cache "Download `Mapnik`" & "Build & Install `Mapnik`"
id: cache-mapnik
uses: actions/cache@v2
with:
path: /usr/local/src/mapnik-${{ env.mapnik-version }}
key: centos-7-mapnik-${{ env.mapnik-version }}
- name: Download `Mapnik`
if: steps.cache-mapnik.outputs.cache-hit != 'true'
run: |
mkdir /usr/local/src/mapnik-${{ env.mapnik-version }}
cd /usr/local/src/mapnik-${{ env.mapnik-version }}
curl --silent --location \
https://github.com/mapnik/mapnik/releases/download/v${{ env.mapnik-version }}/mapnik-v${{ env.mapnik-version }}.tar.bz2 \
| tar --verbose --extract --bzip2 --strip-components=1 --file=-
- name: Build & Install `Mapnik`
run: |
# Export `GDAL_DATA` & `PROJ_LIB` variables and create directories (if needed)
export GDAL_DATA=$(gdal-config --datadir)
export PROJ_LIB=/usr/share/proj
mkdir -p ${GDAL_DATA} ${PROJ_LIB}
cd /usr/local/src/mapnik-${{ env.mapnik-version }}
./configure BOOST_INCLUDES=/usr/include/boost169 BOOST_LIBS=/usr/lib64/boost169
JOBS=$(nproc) make
make install
- name: Link `iniparser.h` to `iniparser/iniparser.h`
run: |
mkdir /usr/include/iniparser
ln -s /usr/include/iniparser.h /usr/include/iniparser/iniparser.h
- name: Run `./autogen.sh`
run: ./autogen.sh
- name: Run `./configure`
run: ./configure
- name: Run `make`
run: make
- name: Run `make test`
run: make test
- name: Configure Apache HTTP Server
run: |
mkdir --parents /usr/share/javascript/leaflet
curl --silent \
"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js" \
> /usr/share/javascript/leaflet/leaflet.min.js
curl --silent \
"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" \
> /usr/share/javascript/leaflet/leaflet.css
mkdir --parents /run/renderd /var/cache/renderd/tiles
ln --symbolic \
"${PWD}/utils/example-map" \
/var/www/
ln --symbolic \
/usr/share/javascript/leaflet \
/var/www/example-map/leaflet
ln --symbolic \
"${PWD}/etc/renderd/renderd.conf.examples" \
/etc/renderd.conf
ln --symbolic \
"${PWD}/etc/apache2/renderd.conf" \
/etc/httpd/conf.d/renderd.conf
ln --symbolic \
"${PWD}/etc/apache2/renderd-example-map.conf" \
/etc/httpd/conf.d/renderd-example-map.conf
echo "LoadModule tile_module /usr/lib64/httpd/modules/mod_tile.so" \
| tee --append /etc/httpd/conf.modules.d/11-mod_tile.conf
sed --in-place \
"s#/usr/lib/mapnik/3.0/input#/usr/local/lib/mapnik/input#g" \
/etc/renderd.conf
sed --in-place \
"s#/usr/share/fonts/truetype#/usr/share/fonts#g" \
/etc/renderd.conf
rm --force /etc/httpd/conf.d/welcome.conf
- name: Run `make install`
run: make install
- name: Run `make install-mod_tile`
run: make install-mod_tile
- name: Start `renderd`
run: renderd
- name: Start Apache HTTP Server
run: httpd
- name: Test Apache HTTP Server `mod_tile` module
run: |
curl --silent http://localhost/renderd-example/tiles/9/297/191.png \
| sha224sum - \
| grep 9cd82e5af9d9002a1c75126ebdb7bf054ec0b7ed0db228dfb0a09bae
# Building on CentOS 7
As `CentOS 7` does not provide any `mapnik`/`mapnik-devel` packages in the official repository (nor are any available from `EPEL`,) it must therefore be built and installed before `mod_tile` can be built. Although `boost-devel` is present in the official repository, the version available there (`1.53.0`) is not in [mapnik's recommended dependency list](https://github.com/mapnik/mapnik/blob/v3.0.24/INSTALL.md#depends), so the `boost169-devel` package from `EPEL` should probably be used instead.
```shell
#!/usr/bin/env bash
export LD_LIBRARY_PATH=/usr/local/lib
export MAPNIK_VERSION=3.0.24
# Install `EPEL` yum repository
yum --assumeyes install epel-release
# Update installed packages
yum --assumeyes update
# Install "Development Tools" group
yum --assumeyes groups install \
"Development Tools"
# Install build dependencies
yum --assumeyes install \
boost169-devel \
cairo-devel \
freetype-devel \
gdal-devel \
glib2-devel \
harfbuzz-devel \
httpd-devel \
iniparser-devel \
libcurl-devel \
libicu-devel \
libjpeg-turbo-devel \
libmemcached-devel \
libpng-devel \
librados2-devel \
libtiff-devel \
libwebp-devel \
libxml2-devel \
postgresql-devel \
proj-devel \
sqlite-devel \
zlib-devel
# Export `GDAL_DATA` & `PROJ_LIB` variables and create directories (if needed)
export GDAL_DATA=$(gdal-config --datadir)
export PROJ_LIB=/usr/share/proj
mkdir -p ${GDAL_DATA} ${PROJ_LIB}
# Download, Build & Install `Mapnik`
mkdir -p /usr/local/src/mapnik-${MAPNIK_VERSION}
cd /usr/local/src/mapnik-${MAPNIK_VERSION}
curl --silent --location https://github.com/mapnik/mapnik/releases/download/v${MAPNIK_VERSION}/mapnik-v${MAPNIK_VERSION}.tar.bz2 \
| tar --verbose --extract --bzip2 --strip-components=1 --file=-
./configure BOOST_INCLUDES=/usr/include/boost169 BOOST_LIBS=/usr/lib64/boost169
JOBS=$(nproc) make
make install
# Fix issue with `iniparser.h` from `iniparser-devel` not being in the expected location
mkdir /usr/include/iniparser
ln -s /usr/include/iniparser.h /usr/include/iniparser/iniparser.h
# Download, Build & Install `mod_tile`
git clone https://github.com/openstreetmap/mod_tile.git /usr/local/src/mod_tile
cd /usr/local/src/mod_tile
./autogen.sh
./configure
make
make install
make install-mod_tile
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment