|
| 1 | +--- |
| 2 | +inputs: |
| 3 | + version: |
| 4 | + description: Version of Mapnik to build & install |
| 5 | + required: true |
| 6 | + |
| 7 | +runs: |
| 8 | + using: composite |
| 9 | + steps: |
| 10 | + - name: Install `gcc-c++` (CentOS 7) |
| 11 | + uses: ./.github/actions/dependencies/install/yum |
| 12 | + with: |
| 13 | + packages: gcc-c++ |
| 14 | + if: matrix.image == 'centos:7' && matrix.compiler == 'LLVM' |
| 15 | + |
| 16 | + - name: Create `Mapnik` source directory |
| 17 | + run: | |
| 18 | + mkdir mapnik-src |
| 19 | + shell: bash --noprofile --norc -euxo pipefail {0} |
| 20 | + |
| 21 | + - name: Cache "Download `Mapnik`" & "Build `Mapnik`" |
| 22 | + id: cache-mapnik-src |
| 23 | + uses: actions/cache@v3 |
| 24 | + with: |
| 25 | + path: mapnik-src |
| 26 | + key: ${{ matrix.image }}-${{ matrix.compiler }}-mapnik-${{ inputs.version }} |
| 27 | + |
| 28 | + - name: Download `Mapnik` |
| 29 | + run: | |
| 30 | + curl --silent --location \ |
| 31 | + https://github.com/mapnik/mapnik/releases/download/v${{ inputs.version }}/mapnik-v${{ inputs.version }}.tar.bz2 \ |
| 32 | + | tar --extract --bzip2 --strip-components=1 --file=- |
| 33 | + shell: bash --noprofile --norc -euxo pipefail {0} |
| 34 | + working-directory: mapnik-src |
| 35 | + if: steps.cache-mapnik-src.outputs.cache-hit != 'true' |
| 36 | + |
| 37 | + - name: Build `Mapnik` |
| 38 | + run: | |
| 39 | + # Export variables |
| 40 | + export GDAL_DATA=/usr/share/gdal |
| 41 | + export JOBS=${JOBS:-$(nproc)} |
| 42 | + export PROJ_LIB=/usr/share/proj |
| 43 | + export PYTHON=${PYTHON:-python3} |
| 44 | +
|
| 45 | + # Create GDAL_DATA/PROJ_LIB directories |
| 46 | + mkdir --parents ${GDAL_DATA} ${PROJ_LIB} |
| 47 | +
|
| 48 | + # Configure & build |
| 49 | + ./configure FAST=True \ |
| 50 | + PREFIX="/usr" \ |
| 51 | + OPTIMIZATION=0 |
| 52 | + make PYTHON=${PYTHON} || make PYTHON=${PYTHON} |
| 53 | + shell: bash --noprofile --norc -euxo pipefail {0} |
| 54 | + working-directory: mapnik-src |
| 55 | + if: steps.cache-mapnik-src.outputs.cache-hit != 'true' |
| 56 | + |
| 57 | + - name: Install `Mapnik` |
| 58 | + run: | |
| 59 | + # Export `PYTHON` |
| 60 | + export PYTHON=${PYTHON:-python3} |
| 61 | +
|
| 62 | + make install PYTHON=${PYTHON} |
| 63 | + shell: bash --noprofile --norc -euxo pipefail {0} |
| 64 | + working-directory: mapnik-src |
0 commit comments