Skip to content

Commit 19facb0

Browse files
authored
Add Arch Linux build documentation and Dockerfile (#389)
_Also_: * Added more tests * Moved test code & test-related code into `/tests` * Run Docker build tests in parallel
1 parent 7811deb commit 19facb0

25 files changed

Lines changed: 320 additions & 50 deletions

.github/actions/coverage/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
--output-file coverage.info \
1818
--remove coverage.info \
1919
"${GITHUB_WORKSPACE}/includes/*" \
20-
"${GITHUB_WORKSPACE}/src/gen_tile_test.cpp" \
20+
"${GITHUB_WORKSPACE}/tests/*" \
2121
"/usr/*"
2222
working-directory: build
2323
shell: bash --noprofile --norc -euxo pipefail {0}

.github/workflows/docker-image-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
service-name:
18+
- archlinux
1819
- centos-7
1920
- centos-stream-8
2021
- centos-stream-9

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ render_old_LDADD = $(PTHREAD_CFLAGS) $(GLIB_LIBS)
8787
#convert_meta_SOURCES = src/dir_utils.c src/store.c src/convert_meta.c
8888

8989
gen_tile_test_SOURCES = \
90-
src/gen_tile_test.cpp \
90+
tests/gen_tile_test.cpp \
9191
src/metatile.cpp \
9292
src/request_queue.c \
9393
src/protocol_helper.c \

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ when using it on an operating system this is not being packaged for.
6565
We prepared instructions for you on how to build the software on the following
6666
distributions:
6767

68+
* `Arch Linux </docs/build/building_on_arch_linux.md>`__
6869
* `CentOS </docs/build/building_on_centos.md>`__
6970
* `CentOS Stream </docs/build/building_on_centos_stream.md>`__
7071
* `Debian </docs/build/building_on_debian.md>`__

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AC_INIT([mod_tile],
1111
[http://trac.openstreetmap.org])
1212
AM_INIT_AUTOMAKE([subdir-objects])
1313
LT_INIT
14-
AC_CONFIG_SRCDIR([src/convert_meta.c])
14+
AC_CONFIG_SRCDIR([src/mod_tile.c])
1515
AC_CONFIG_HEADERS([includes/config.h])
1616
AC_CONFIG_MACRO_DIR([m4])
1717

docker/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ For your convenience, we have provided a Docker-based building and testing metho
44

55
### The following distributions are currently supported:
66

7+
- archlinux _(Arch Linux)_ [[Dockerfile](/docker/archlinux/Dockerfile)]
78
- centos-7 _(CentOS 7)_ [[Dockerfile](/docker/centos/7/Dockerfile)]
89
- centos-stream-8 _(CentOS Stream 8)_ [[Dockerfile](/docker/centos/stream/Dockerfile)]
910
- centos-stream-9 _(CentOS Stream 9)_ [[Dockerfile](/docker/centos/stream/Dockerfile)]

docker/archlinux/Dockerfile

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Builder
2+
FROM archlinux:latest as builder
3+
4+
## Install builder dependencies
5+
RUN --mount=id=archlinux:latest-/var/cache/pacman/pkg,sharing=locked,target=/var/cache/pacman/pkg,type=cache \
6+
--mount=id=archlinux:latest-/var/lib/pacman/sync,sharing=locked,target=/var/lib/pacman/sync,type=cache \
7+
pacman --sync --refresh --sysupgrade --noconfirm \
8+
apache \
9+
apr \
10+
boost \
11+
cairo \
12+
cmake \
13+
curl \
14+
extra-cmake-modules \
15+
gcc \
16+
git \
17+
glib2 \
18+
iniparser \
19+
lcov \
20+
libmemcached \
21+
make \
22+
mapnik \
23+
memcached \
24+
pkgconf
25+
26+
## Build, Test & Install `mod_tile`
27+
COPY . /tmp/mod_tile_src
28+
WORKDIR /tmp/mod_tile_build
29+
RUN export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
30+
cmake -B . -S /tmp/mod_tile_src \
31+
-DCMAKE_BUILD_TYPE:STRING=Release \
32+
-DENABLE_TESTS:BOOL=ON && \
33+
cmake --build .
34+
RUN export CTEST_PARALLEL_LEVEL=$(nproc) && \
35+
export DESTDIR=/tmp/mod_tile && \
36+
ctest --output-on-failure && \
37+
(cmake --install . --prefix /usr --strip || make DESTDIR=${DESTDIR} install/strip) && \
38+
mv /tmp/mod_tile/var/run /tmp/mod_tile/run
39+
40+
41+
# Runner
42+
FROM archlinux:latest as runner
43+
44+
## Install runner dependencies
45+
RUN --mount=id=archlinux:latest-/var/cache/pacman/pkg,sharing=locked,target=/var/cache/pacman/pkg,type=cache \
46+
--mount=id=archlinux:latest-/var/lib/pacman/sync,sharing=locked,target=/var/lib/pacman/sync,type=cache \
47+
pacman --sync --refresh --sysupgrade --noconfirm \
48+
apache \
49+
cairo \
50+
curl \
51+
glib2 \
52+
iniparser \
53+
libmemcached \
54+
mapnik \
55+
memcached \
56+
# GDAL optional dependencies
57+
arrow \
58+
cfitsio \
59+
hdf5 \
60+
libheif \
61+
libjxl \
62+
mariadb-libs \
63+
netcdf \
64+
openexr \
65+
openjpeg2 \
66+
podofo \
67+
poppler
68+
69+
## Copy files from builder(s)
70+
### mod_tile
71+
COPY --from=builder /tmp/mod_tile /
72+
COPY --from=builder \
73+
/tmp/mod_tile_src/utils/example-map \
74+
/usr/share/renderd/example-map
75+
COPY --from=builder \
76+
/tmp/mod_tile_src/etc/apache2/renderd-example-map.conf \
77+
/etc/httpd/conf/extra/httpd-tile-renderd-example-map.conf
78+
79+
## Add configuration
80+
RUN printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
81+
RUN printf '\n[example-map-jpg]\nTYPE=jpg image/jpeg jpeg\nURI=/tiles/renderd-example-jpg\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
82+
RUN printf '\n[example-map-png256]\nTYPE=png image/png png256\nURI=/tiles/renderd-example-png256\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
83+
RUN printf '\n[example-map-png32]\nTYPE=png image/png png32\nURI=/tiles/renderd-example-png32\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
84+
RUN printf '\n[example-map-webp]\nTYPE=webp image/webp webp\nURI=/tiles/renderd-example-webp\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
85+
86+
## Enable module & site
87+
RUN printf '\nInclude conf/extra/httpd-tile.conf\n' >> /etc/httpd/conf/httpd.conf && \
88+
printf '\nInclude conf/extra/httpd-tile-renderd-example-map.conf\n' >> /etc/httpd/conf/httpd.conf
89+
90+
## Start services
91+
CMD httpd -e debug -k start; \
92+
G_MESSAGES_DEBUG=${G_MESSAGES_DEBUG:-info} renderd --foreground

docker/centos/7/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ RUN source /opt/rh/devtoolset-9/enable && \
119119
-DCMAKE_BUILD_TYPE:STRING=Release \
120120
-DENABLE_TESTS:BOOL=ON && \
121121
cmake3 --build .
122-
RUN export DESTDIR=/tmp/mod_tile && \
122+
RUN export CTEST_PARALLEL_LEVEL=$(nproc) && \
123+
export DESTDIR=/tmp/mod_tile && \
123124
ctest3 --output-on-failure && \
124125
(cmake3 --install . --prefix /usr --strip || make DESTDIR=${DESTDIR} install/strip) && \
125126
mv /tmp/mod_tile/var/run /tmp/mod_tile/run

docker/centos/stream/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ RUN export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
133133
-DCMAKE_BUILD_TYPE:STRING=Release \
134134
-DENABLE_TESTS:BOOL=ON && \
135135
cmake --build .
136-
RUN export DESTDIR=/tmp/mod_tile && \
136+
RUN export CTEST_PARALLEL_LEVEL=$(nproc) && \
137+
export DESTDIR=/tmp/mod_tile && \
137138
ctest --output-on-failure && \
138139
(cmake --install . --prefix /usr --strip || make DESTDIR=${DESTDIR} install/strip) && \
139140
mv /tmp/mod_tile/var/run /tmp/mod_tile/run

docker/centos/stream/Dockerfile.autotools

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ RUN --mount=id=centos:stream${centos_stream_version}-/var/cache/dnf,target=/var/
4040
postgresql-devel \
4141
proj-devel \
4242
python3 \
43-
python3-scons \
4443
sqlite-devel \
4544
tar \
4645
zlib-devel
4746

4847
## Download, Build & Install `Mapnik`
49-
WORKDIR /usr/local/src/mapnik
50-
RUN --mount=id=centos:stream${centos_stream_version}-mapnik:${mapnik_version},target=/usr/local/src/mapnik,type=cache \
48+
WORKDIR /tmp/mapnik_src
49+
RUN --mount=id=centos:stream${centos_stream_version}-mapnik:${mapnik_version},target=/tmp/mapnik_src,type=cache \
5150
export DESTDIR="/tmp/mapnik"; \
5251
export GDAL_DATA="$(gdal-config --datadir)"; \
5352
export JOBS="$(nproc)"; \
@@ -65,14 +64,13 @@ RUN --mount=id=centos:stream${centos_stream_version}-mapnik:${mapnik_version},ta
6564
fi \
6665
fi; \
6766
if [ "${centos_stream_version}" = "8" ]; then \
68-
export SCONS_CMD="scons-3"; \
69-
export CUSTOM_CFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"; \
70-
export CUSTOM_CXXFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"; \
67+
export CUSTOM_DEFINES="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"; \
7168
fi; \
72-
${SCONS_CMD:-scons} configure \
69+
bash configure \
7370
CPP_TESTS=False \
7471
CUSTOM_CFLAGS="${CUSTOM_CFLAGS:-}" \
7572
CUSTOM_CXXFLAGS="${CUSTOM_CXXFLAGS:-}" \
73+
CUSTOM_DEFINES="${CUSTOM_DEFINES:-}" \
7674
CUSTOM_LDFLAGS="${CUSTOM_LDFLAGS:-}" \
7775
DEMO=False \
7876
DESTDIR="${DESTDIR}" \
@@ -133,12 +131,11 @@ COPY --from=mapnik-builder /tmp/mapnik /
133131
## Build, Test & Install `mod_tile`
134132
COPY . /tmp/mod_tile_src
135133
WORKDIR /tmp/mod_tile_src
136-
RUN ./autogen.sh && \
137-
./configure && \
138-
make
139134
RUN export DESTDIR=/tmp/mod_tile && \
140-
./gen_tile_test && \
135+
./autogen.sh && \
136+
./configure && \
141137
make DESTDIR=${DESTDIR} install install-mod_tile
138+
RUN ./gen_tile_test
142139

143140
# Runner
144141
FROM quay.io/centos/centos:stream${centos_stream_version} as runner
@@ -184,15 +181,23 @@ COPY --from=builder \
184181
/tmp/mod_tile_src/etc/apache2/renderd-example-map.conf \
185182
/etc/httpd/conf.d/renderd-example-map.conf
186183

187-
RUN printf "LoadModule tile_module $(find /usr -name mod_tile.so)\n" > /etc/httpd/conf.modules.d/11-tile.conf
188-
184+
## Fix mapnik directories
189185
RUN sed \
190186
--expression "s#/usr/lib/mapnik/3.1/input#$(find /usr -mindepth 1 -type d -name input)#g" \
191187
--expression "s#/usr/share/fonts/truetype#/usr/share/fonts#g" \
192-
/usr/local/etc/renderd.conf > /etc/renderd.conf && \
193-
printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
188+
/usr/local/etc/renderd.conf > /etc/renderd.conf
189+
190+
## Add configuration
191+
RUN printf "LoadModule tile_module $(find /usr -name mod_tile.so)\n" > /etc/httpd/conf.modules.d/11-tile.conf
192+
RUN printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
193+
RUN printf '\n[example-map-jpg]\nTYPE=jpg image/jpeg jpeg\nURI=/tiles/renderd-example-jpg\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
194+
RUN printf '\n[example-map-png256]\nTYPE=png image/png png256\nURI=/tiles/renderd-example-png256\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
195+
RUN printf '\n[example-map-png32]\nTYPE=png image/png png32\nURI=/tiles/renderd-example-png32\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
196+
RUN printf '\n[example-map-webp]\nTYPE=webp image/webp webp\nURI=/tiles/renderd-example-webp\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
194197

198+
## Create missing directories
195199
RUN mkdir --parents /run/renderd /var/cache/renderd/tiles
196200

197-
CMD /usr/sbin/httpd -e debug -k start; \
201+
## Start services
202+
CMD httpd -e debug -k start; \
198203
G_MESSAGES_DEBUG=${G_MESSAGES_DEBUG:-info} renderd --foreground

0 commit comments

Comments
 (0)