changeset 112:b3a18e333f93

integration 4.0->mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 Mar 2023 17:28:16 +0200
parents 391c3b504fb6 (current diff) 6ad5da29f260 (diff)
children 5a60cbbe9bb0
files NEWS
diffstat 20 files changed, 440 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Feb 23 18:45:12 2022 +0100
+++ b/NEWS	Tue Mar 28 17:28:16 2023 +0200
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* New builders for Windows: Supporting 32 / 64bit with Python 3.9 / 3.10 / 3.11
+
 
 Version 4.0 (2022-02-23)
 ========================
--- a/Resources/Builders/BuildAllWindows.sh	Wed Feb 23 18:45:12 2022 +0100
+++ b/Resources/Builders/BuildAllWindows.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -18,8 +18,10 @@
 VERSION=`grep "set(PLUGIN_VERSION" ${DIR}/../../CMakeLists.txt | cut -d '"' -f 2`
 echo "Version of the Python plugin: ${VERSION}"
 
+set -x
 
-set -x
+
+## Windows 32
 
 bash ${DIR}/MinGW32-Python2.7/docker-compile.sh Release
 cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win32-Python2.7-${VERSION}.dll
@@ -30,6 +32,18 @@
 bash ${DIR}/MinGW32-Python3.8/docker-compile.sh Release
 cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win32-Python3.8-${VERSION}.dll
 
+bash ${DIR}/MinGW32-Python3.9/docker-compile.sh Release
+cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win32-Python3.9-${VERSION}.dll
+
+bash ${DIR}/MinGW32-Python3.10/docker-compile.sh Release
+cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win32-Python3.10-${VERSION}.dll
+
+bash ${DIR}/MinGW32-Python3.11/docker-compile.sh Release
+cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win32-Python3.11-${VERSION}.dll
+
+
+## Windows 64
+
 bash ${DIR}/MinGW64-Python2.7/docker-compile.sh Release
 cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win64-Python2.7-${VERSION}.dll
 
@@ -38,3 +52,12 @@
 
 bash ${DIR}/MinGW64-Python3.8/docker-compile.sh Release
 cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win64-Python3.8-${VERSION}.dll
+
+bash ${DIR}/MinGW64-Python3.9/docker-compile.sh Release
+cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win64-Python3.9-${VERSION}.dll
+
+bash ${DIR}/MinGW64-Python3.10/docker-compile.sh Release
+cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win64-Python3.10-${VERSION}.dll
+
+bash ${DIR}/MinGW64-Python3.11/docker-compile.sh Release
+cp ${DIR}/../../docker-build/lib/libOrthancPython.dll ${TARGET}/OrthancPython-Win64-Python3.11-${VERSION}.dll
--- a/Resources/Builders/MinGW32-Python2.7/docker-internal.sh	Wed Feb 23 18:45:12 2022 +0100
+++ b/Resources/Builders/MinGW32-Python2.7/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -10,7 +10,7 @@
 mkdir /tmp/build
 cd /tmp/build
 
-wget https://orthanc.osimis.io/ThirdPartyDownloads/Python/python-2.7.17-win32.tar.bz2
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-2.7.17-win32.tar.bz2
 tar xfj python-2.7.17-win32.tar.bz2
 
 cmake /tmp/source-writeable/ \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW32-Python3.10/docker-compile.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -ex
+
+if [ "$1" != "Debug" -a "$1" != "Release" ]; then
+    echo "Please provide build type: Debug or Release"
+    exit -1
+fi
+
+if [ -t 1 ]; then
+    # TTY is available => use interactive mode
+    DOCKER_FLAGS='-i'
+fi
+
+ROOT_DIR=`dirname $(readlink -f $0)`/../../..
+
+mkdir -p ${ROOT_DIR}/docker-build/
+
+( cd ${ROOT_DIR}/Resources/Builders/ && \
+        docker build \
+               -f ./Dockerfile-MinGW-BuildEnvironment \
+               -t mingw-python-build . )
+
+docker run -t ${DOCKER_FLAGS} --rm \
+    --user $(id -u):$(id -g) \
+    -v ${ROOT_DIR}:/source:ro \
+    -v ${ROOT_DIR}/docker-build:/target:rw \
+    mingw-python-build \
+    bash /source/Resources/Builders/MinGW32-Python3.10/docker-internal.sh $1
+
+ls -lR ${ROOT_DIR}/docker-build/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW32-Python3.10/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ex
+
+mkdir /tmp/source-writeable
+
+cp -r /source/CMakeLists.txt /tmp/source-writeable/
+cp -r /source/Sources /tmp/source-writeable/
+cp -r /source/Resources /tmp/source-writeable/
+
+mkdir /tmp/build
+cd /tmp/build
+
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.10.10-win32.zip
+unzip python-3.10.10-win32.zip
+
+if [ "$1" == "Release" ]; then
+    LIBRARY_NAME=python310.lib
+else
+    LIBRARY_NAME=python310_d.lib
+fi
+
+cmake /tmp/source-writeable/ \
+      -DCMAKE_BUILD_TYPE=$1 \
+      -DSTATIC_BUILD=ON \
+      -DPYTHON_VERSION=3.10 \
+      -DPYTHON_LIBRARY_NAME=${LIBRARY_NAME} \
+      -DPYTHON_WINDOWS_ROOT=/tmp/build/python-3.10.10-win32/ \
+      -DCMAKE_TOOLCHAIN_FILE=/source/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain32.cmake \
+      -DCMAKE_INSTALL_PREFIX=/target 
+
+make -j`nproc`
+
+if [ "$1" == "Release" ]; then
+    i686-w64-mingw32-strip ./libOrthancPython.dll
+fi
+
+make install
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW32-Python3.11/docker-compile.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -ex
+
+if [ "$1" != "Debug" -a "$1" != "Release" ]; then
+    echo "Please provide build type: Debug or Release"
+    exit -1
+fi
+
+if [ -t 1 ]; then
+    # TTY is available => use interactive mode
+    DOCKER_FLAGS='-i'
+fi
+
+ROOT_DIR=`dirname $(readlink -f $0)`/../../..
+
+mkdir -p ${ROOT_DIR}/docker-build/
+
+( cd ${ROOT_DIR}/Resources/Builders/ && \
+        docker build \
+               -f ./Dockerfile-MinGW-BuildEnvironment \
+               -t mingw-python-build . )
+
+docker run -t ${DOCKER_FLAGS} --rm \
+    --user $(id -u):$(id -g) \
+    -v ${ROOT_DIR}:/source:ro \
+    -v ${ROOT_DIR}/docker-build:/target:rw \
+    mingw-python-build \
+    bash /source/Resources/Builders/MinGW32-Python3.11/docker-internal.sh $1
+
+ls -lR ${ROOT_DIR}/docker-build/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW32-Python3.11/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ex
+
+mkdir /tmp/source-writeable
+
+cp -r /source/CMakeLists.txt /tmp/source-writeable/
+cp -r /source/Sources /tmp/source-writeable/
+cp -r /source/Resources /tmp/source-writeable/
+
+mkdir /tmp/build
+cd /tmp/build
+
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.11.2-win32.zip
+unzip python-3.11.2-win32.zip
+
+if [ "$1" == "Release" ]; then
+    LIBRARY_NAME=python311.lib
+else
+    LIBRARY_NAME=python311_d.lib
+fi
+
+cmake /tmp/source-writeable/ \
+      -DCMAKE_BUILD_TYPE=$1 \
+      -DSTATIC_BUILD=ON \
+      -DPYTHON_VERSION=3.11 \
+      -DPYTHON_LIBRARY_NAME=${LIBRARY_NAME} \
+      -DPYTHON_WINDOWS_ROOT=/tmp/build/python-3.11.2-win32/ \
+      -DCMAKE_TOOLCHAIN_FILE=/source/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain32.cmake \
+      -DCMAKE_INSTALL_PREFIX=/target 
+
+make -j`nproc`
+
+if [ "$1" == "Release" ]; then
+    i686-w64-mingw32-strip ./libOrthancPython.dll
+fi
+
+make install
--- a/Resources/Builders/MinGW32-Python3.7/docker-internal.sh	Wed Feb 23 18:45:12 2022 +0100
+++ b/Resources/Builders/MinGW32-Python3.7/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -10,7 +10,7 @@
 mkdir /tmp/build
 cd /tmp/build
 
-wget https://orthanc.osimis.io/ThirdPartyDownloads/Python/python-3.7.7-win32.zip
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.7.7-win32.zip
 unzip python-3.7.7-win32.zip
 
 cmake /tmp/source-writeable/ \
--- a/Resources/Builders/MinGW32-Python3.8/docker-internal.sh	Wed Feb 23 18:45:12 2022 +0100
+++ b/Resources/Builders/MinGW32-Python3.8/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -10,7 +10,7 @@
 mkdir /tmp/build
 cd /tmp/build
 
-wget https://orthanc.osimis.io/ThirdPartyDownloads/Python/python-3.8.3-win32.zip
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.8.3-win32.zip
 unzip python-3.8.3-win32.zip
 
 if [ "$1" == "Release" ]; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW32-Python3.9/docker-compile.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -ex
+
+if [ "$1" != "Debug" -a "$1" != "Release" ]; then
+    echo "Please provide build type: Debug or Release"
+    exit -1
+fi
+
+if [ -t 1 ]; then
+    # TTY is available => use interactive mode
+    DOCKER_FLAGS='-i'
+fi
+
+ROOT_DIR=`dirname $(readlink -f $0)`/../../..
+
+mkdir -p ${ROOT_DIR}/docker-build/
+
+( cd ${ROOT_DIR}/Resources/Builders/ && \
+        docker build \
+               -f ./Dockerfile-MinGW-BuildEnvironment \
+               -t mingw-python-build . )
+
+docker run -t ${DOCKER_FLAGS} --rm \
+    --user $(id -u):$(id -g) \
+    -v ${ROOT_DIR}:/source:ro \
+    -v ${ROOT_DIR}/docker-build:/target:rw \
+    mingw-python-build \
+    bash /source/Resources/Builders/MinGW32-Python3.9/docker-internal.sh $1
+
+ls -lR ${ROOT_DIR}/docker-build/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW32-Python3.9/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ex
+
+mkdir /tmp/source-writeable
+
+cp -r /source/CMakeLists.txt /tmp/source-writeable/
+cp -r /source/Sources /tmp/source-writeable/
+cp -r /source/Resources /tmp/source-writeable/
+
+mkdir /tmp/build
+cd /tmp/build
+
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.9.13-win32.zip
+unzip python-3.9.13-win32.zip
+
+if [ "$1" == "Release" ]; then
+    LIBRARY_NAME=python39.lib
+else
+    LIBRARY_NAME=python39_d.lib
+fi
+
+cmake /tmp/source-writeable/ \
+      -DCMAKE_BUILD_TYPE=$1 \
+      -DSTATIC_BUILD=ON \
+      -DPYTHON_VERSION=3.9 \
+      -DPYTHON_LIBRARY_NAME=${LIBRARY_NAME} \
+      -DPYTHON_WINDOWS_ROOT=/tmp/build/python-3.9.13-win32/ \
+      -DCMAKE_TOOLCHAIN_FILE=/source/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain32.cmake \
+      -DCMAKE_INSTALL_PREFIX=/target 
+
+make -j`nproc`
+
+if [ "$1" == "Release" ]; then
+    i686-w64-mingw32-strip ./libOrthancPython.dll
+fi
+
+make install
--- a/Resources/Builders/MinGW64-Python2.7/docker-internal.sh	Wed Feb 23 18:45:12 2022 +0100
+++ b/Resources/Builders/MinGW64-Python2.7/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -10,7 +10,7 @@
 mkdir /tmp/build
 cd /tmp/build
 
-wget https://orthanc.osimis.io/ThirdPartyDownloads/Python/python-2.7.17-win64.zip
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-2.7.17-win64.zip
 unzip python-2.7.17-win64.zip
 
 cmake /tmp/source-writeable/ \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW64-Python3.10/docker-compile.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -ex
+
+if [ "$1" != "Debug" -a "$1" != "Release" ]; then
+    echo "Please provide build type: Debug or Release"
+    exit -1
+fi
+
+if [ -t 1 ]; then
+    # TTY is available => use interactive mode
+    DOCKER_FLAGS='-i'
+fi
+
+ROOT_DIR=`dirname $(readlink -f $0)`/../../..
+
+mkdir -p ${ROOT_DIR}/docker-build/
+
+( cd ${ROOT_DIR}/Resources/Builders/ && \
+        docker build \
+               -f ./Dockerfile-MinGW-BuildEnvironment \
+               -t mingw-python-build . )
+
+docker run -t ${DOCKER_FLAGS} --rm \
+    --user $(id -u):$(id -g) \
+    -v ${ROOT_DIR}:/source:ro \
+    -v ${ROOT_DIR}/docker-build:/target:rw \
+    mingw-python-build \
+    bash /source/Resources/Builders/MinGW64-Python3.10/docker-internal.sh $1
+
+ls -lR ${ROOT_DIR}/docker-build/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW64-Python3.10/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ex
+
+mkdir /tmp/source-writeable
+
+cp -r /source/CMakeLists.txt /tmp/source-writeable/
+cp -r /source/Sources /tmp/source-writeable/
+cp -r /source/Resources /tmp/source-writeable/
+
+mkdir /tmp/build
+cd /tmp/build
+
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.10.10-win64.zip
+unzip python-3.10.10-win64.zip
+
+if [ "$1" == "Release" ]; then
+    LIBRARY_NAME=python310.lib
+else
+    LIBRARY_NAME=python310_d.lib
+fi
+
+cmake /tmp/source-writeable/ \
+      -DCMAKE_BUILD_TYPE=$1 \
+      -DSTATIC_BUILD=ON \
+      -DPYTHON_VERSION=3.10 \
+      -DPYTHON_LIBRARY_NAME=${LIBRARY_NAME} \
+      -DPYTHON_WINDOWS_ROOT=/tmp/build/python-3.10.10-win64 \
+      -DCMAKE_TOOLCHAIN_FILE=/source/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain64.cmake \
+      -DCMAKE_INSTALL_PREFIX=/target 
+
+make -j`nproc`
+
+if [ "$1" == "Release" ]; then
+    x86_64-w64-mingw32-strip ./libOrthancPython.dll
+fi
+
+make install
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW64-Python3.11/docker-compile.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -ex
+
+if [ "$1" != "Debug" -a "$1" != "Release" ]; then
+    echo "Please provide build type: Debug or Release"
+    exit -1
+fi
+
+if [ -t 1 ]; then
+    # TTY is available => use interactive mode
+    DOCKER_FLAGS='-i'
+fi
+
+ROOT_DIR=`dirname $(readlink -f $0)`/../../..
+
+mkdir -p ${ROOT_DIR}/docker-build/
+
+( cd ${ROOT_DIR}/Resources/Builders/ && \
+        docker build \
+               -f ./Dockerfile-MinGW-BuildEnvironment \
+               -t mingw-python-build . )
+
+docker run -t ${DOCKER_FLAGS} --rm \
+    --user $(id -u):$(id -g) \
+    -v ${ROOT_DIR}:/source:ro \
+    -v ${ROOT_DIR}/docker-build:/target:rw \
+    mingw-python-build \
+    bash /source/Resources/Builders/MinGW64-Python3.11/docker-internal.sh $1
+
+ls -lR ${ROOT_DIR}/docker-build/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW64-Python3.11/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ex
+
+mkdir /tmp/source-writeable
+
+cp -r /source/CMakeLists.txt /tmp/source-writeable/
+cp -r /source/Sources /tmp/source-writeable/
+cp -r /source/Resources /tmp/source-writeable/
+
+mkdir /tmp/build
+cd /tmp/build
+
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.11.2-win64.zip
+unzip python-3.11.2-win64.zip
+
+if [ "$1" == "Release" ]; then
+    LIBRARY_NAME=python311.lib
+else
+    LIBRARY_NAME=python311_d.lib
+fi
+
+cmake /tmp/source-writeable/ \
+      -DCMAKE_BUILD_TYPE=$1 \
+      -DSTATIC_BUILD=ON \
+      -DPYTHON_VERSION=3.11 \
+      -DPYTHON_LIBRARY_NAME=${LIBRARY_NAME} \
+      -DPYTHON_WINDOWS_ROOT=/tmp/build/python-3.11.2-win64 \
+      -DCMAKE_TOOLCHAIN_FILE=/source/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain64.cmake \
+      -DCMAKE_INSTALL_PREFIX=/target 
+
+make -j`nproc`
+
+if [ "$1" == "Release" ]; then
+    x86_64-w64-mingw32-strip ./libOrthancPython.dll
+fi
+
+make install
--- a/Resources/Builders/MinGW64-Python3.7/docker-internal.sh	Wed Feb 23 18:45:12 2022 +0100
+++ b/Resources/Builders/MinGW64-Python3.7/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -10,7 +10,7 @@
 mkdir /tmp/build
 cd /tmp/build
 
-wget https://orthanc.osimis.io/ThirdPartyDownloads/Python/python-3.7.7-win64.zip
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.7.7-win64.zip
 unzip python-3.7.7-win64.zip
 
 cmake /tmp/source-writeable/ \
--- a/Resources/Builders/MinGW64-Python3.8/docker-internal.sh	Wed Feb 23 18:45:12 2022 +0100
+++ b/Resources/Builders/MinGW64-Python3.8/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -10,7 +10,7 @@
 mkdir /tmp/build
 cd /tmp/build
 
-wget https://orthanc.osimis.io/ThirdPartyDownloads/Python/python-3.8.3-win64.zip
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.8.3-win64.zip
 unzip python-3.8.3-win64.zip
 
 if [ "$1" == "Release" ]; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW64-Python3.9/docker-compile.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -ex
+
+if [ "$1" != "Debug" -a "$1" != "Release" ]; then
+    echo "Please provide build type: Debug or Release"
+    exit -1
+fi
+
+if [ -t 1 ]; then
+    # TTY is available => use interactive mode
+    DOCKER_FLAGS='-i'
+fi
+
+ROOT_DIR=`dirname $(readlink -f $0)`/../../..
+
+mkdir -p ${ROOT_DIR}/docker-build/
+
+( cd ${ROOT_DIR}/Resources/Builders/ && \
+        docker build \
+               -f ./Dockerfile-MinGW-BuildEnvironment \
+               -t mingw-python-build . )
+
+docker run -t ${DOCKER_FLAGS} --rm \
+    --user $(id -u):$(id -g) \
+    -v ${ROOT_DIR}:/source:ro \
+    -v ${ROOT_DIR}/docker-build:/target:rw \
+    mingw-python-build \
+    bash /source/Resources/Builders/MinGW64-Python3.9/docker-internal.sh $1
+
+ls -lR ${ROOT_DIR}/docker-build/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/MinGW64-Python3.9/docker-internal.sh	Tue Mar 28 17:28:16 2023 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ex
+
+mkdir /tmp/source-writeable
+
+cp -r /source/CMakeLists.txt /tmp/source-writeable/
+cp -r /source/Sources /tmp/source-writeable/
+cp -r /source/Resources /tmp/source-writeable/
+
+mkdir /tmp/build
+cd /tmp/build
+
+wget https://orthanc.uclouvain.be/third-party-downloads/Python/python-3.9.13-win64.zip
+unzip python-3.9.13-win64.zip
+
+if [ "$1" == "Release" ]; then
+    LIBRARY_NAME=python39.lib
+else
+    LIBRARY_NAME=python39_d.lib
+fi
+
+cmake /tmp/source-writeable/ \
+      -DCMAKE_BUILD_TYPE=$1 \
+      -DSTATIC_BUILD=ON \
+      -DPYTHON_VERSION=3.9 \
+      -DPYTHON_LIBRARY_NAME=${LIBRARY_NAME} \
+      -DPYTHON_WINDOWS_ROOT=/tmp/build/python-3.9.13-win64 \
+      -DCMAKE_TOOLCHAIN_FILE=/source/Resources/Orthanc/Toolchains/MinGW-W64-Toolchain64.cmake \
+      -DCMAKE_INSTALL_PREFIX=/target 
+
+make -j`nproc`
+
+if [ "$1" == "Release" ]; then
+    x86_64-w64-mingw32-strip ./libOrthancPython.dll
+fi
+
+make install