Skip to content

Commit

Permalink
add shared config to build Python shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
adehad committed Jan 9, 2024
1 parent 562305d commit 1571f8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/python/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"default": false,
"description": "Optimize Python for performance when compiled (slow)"
},
"shared": {
"type": "boolean",
"default": false,
"description": "Build Python with the shared library files."
},
"installPath": {
"type": "string",
"default": "/usr/local/python",
Expand Down
7 changes: 6 additions & 1 deletion src/python/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PYTHON_VERSION="${VERSION:-"latest"}" # 'system' or 'os-provided' checks the base image first, else installs 'latest'
INSTALL_PYTHON_TOOLS="${INSTALLTOOLS:-"true"}"
OPTIMIZE_BUILD_FROM_SOURCE="${OPTIMIZE:-"false"}"
SHARED_LIBS="${SHARED:-"false"}"
PYTHON_INSTALL_PATH="${INSTALLPATH:-"/usr/local/python"}"
OVERRIDE_DEFAULT_VERSION="${OVERRIDEDEFAULTVERSION:-"true"}"

Expand Down Expand Up @@ -264,7 +265,11 @@ install_from_source() {
if [ "${OPTIMIZE_BUILD_FROM_SOURCE}" = "true" ]; then
config_args="--enable-optimizations"
fi
./configure --prefix="${INSTALL_PATH}" --with-ensurepip=install ${config_args}
local shared_libs=""
if [ "${SHARED_LIBS}" = "true" ]; then
shared_libs="--enable-shared"
fi
./configure --prefix="${INSTALL_PATH}" --with-ensurepip=install ${config_args} ${shared_libs}
make -j 8
make install
cd /tmp
Expand Down

0 comments on commit 1571f8a

Please sign in to comment.