-
-
Notifications
You must be signed in to change notification settings - Fork 406
Expand file tree
/
Copy pathbuild-mapscript-python.sh
More file actions
executable file
·61 lines (43 loc) · 1.67 KB
/
build-mapscript-python.sh
File metadata and controls
executable file
·61 lines (43 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -eu # Exit on error and treat unset variables as errors
cd "$WORK_DIR"
# Ensure the Python version is provided
if [ -z "${PYTHON_VERSION:-}" ]; then
echo "Error: Python version not specified. Make sure to pass it as an environment variable."
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
apt-get update -y
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
# general dependencies
apt-get install -y sudo software-properties-common wget
# pyenv dependencies
apt-get install -y \
build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# install pyenv
curl https://pyenv.run | bash
# https://github.com/pyenv/pyenv?tab=readme-ov-file#b-set-up-your-shell-environment-for-pyenv
# set up pyenv environment
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# initialize pyenv (for non-interactive shell)
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
# verify installation
pyenv --version
# export CRYPTOGRAPHY_DONT_BUILD_RUST=1 # to avoid issue when building Cryptography python module
pyenv install -s "$PYTHON_VERSION"
# set the global Python version
pyenv global $PYTHON_VERSION
# install build dependencies
ci/ubuntu/setup.sh
cd "$WORK_DIR"
export CC="ccache gcc"
export CXX="ccache g++"
# only build MapServer with the Python MapScript and not PHP, Perl etc.
make cmakebuild_mapscript_python MFLAGS="-j$(nproc)" CMAKE_C_FLAGS="-O2" CMAKE_CXX_FLAGS="-O2" LIBMAPSERVER_EXTRA_FLAGS="-Wall -Werror -Wextra"
# build the wheel and run the Python MapScript test suite
make mspython-wheel
echo "Done!"