* rebased llvm/hotfix-sparcv9-not-64.diff
[t2sde.git] / package / fonts / fontforge / hotfix-distutils.patch
blob21e53d1e94b3659122a83d6514987525cbaf1a29
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/fontforge/hotfix-distutils.patch
3 # Copyright (C) 2024 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 From 24968a8bf713396bc4a5dbb8bf3a03a9479b2568 Mon Sep 17 00:00:00 2001
15 From: Maxim Iorsh <iorsh@users.sourceforge.net>
16 Date: Fri, 24 May 2024 16:48:47 +0300
17 Subject: [PATCH 1/3] Use sysconfig for Python module locations
19 diff --git a/.github/workflows/scripts/ffosxbuild.sh b/.github/workflows/scripts/ffosxbuild.sh
20 index 6476ec0f0f..0da3c2944c 100755
21 --- a/.github/workflows/scripts/ffosxbuild.sh
22 +++ b/.github/workflows/scripts/ffosxbuild.sh
23 @@ -32,6 +32,12 @@ fi
24 # Now we bundle the Python libraries
25 echo "Bundling Python libraries..."
27 +# MacOS runner has way too much preinstalled Python versions. We must
28 +# use the exact one discovered by CMake.
29 +# The CMake_Python3_EXECUTABLE file resides in build/CMake_Python3_EXECUTABLE
30 +PYTHON_EXE=`cat ../CMake_Python3_EXECUTABLE`
31 +PY_DLLS_PATH=`$PYTHON_EXE -c "import sysconfig as sc; print(sc.get_path('platlib', sc.get_preferred_scheme('user'), vars={'userbase': '.'}))"`
33 PYLIB=$(otool -L $APPDIR/Contents/Resources/opt/local/bin/fontforge | grep -i python | sed -e 's/ \(.*\)//')
34 PYVER=$(echo $PYLIB | rev | cut -d/ -f2 | rev)
35 PYTHON=python$PYVER
36 @@ -42,10 +48,10 @@ mkdir -p $APPDIR/Contents/Frameworks
37 cp -a $pycruft/Python.framework $APPDIR/Contents/Frameworks
38 pushd $APPDIR/Contents/Frameworks/Python.framework/Versions/$PYVER/lib/$PYTHON/
39 rm site-packages || rm -rf site-packages
40 -ln -s ../../../../../../Resources/opt/local/lib/$PYTHON/site-packages
41 +ln -s ../../../../../../Resources/opt/local/$PY_DLLS_PATH
42 popd
44 -pushd $APPDIR/Contents/Resources/opt/local/lib/$PYTHON/site-packages
45 +pushd $APPDIR/Contents/Resources/opt/local/$PY_DLLS_PATH
46 cp -Rn "$pycruft/Python.framework/Versions/$PYVER/lib/$PYTHON/site-packages/" .
47 popd
49 diff --git a/.github/workflows/scripts/setup_linux_deps.sh b/.github/workflows/scripts/setup_linux_deps.sh
50 index d31f795327..6d82cc4c51 100755
51 --- a/.github/workflows/scripts/setup_linux_deps.sh
52 +++ b/.github/workflows/scripts/setup_linux_deps.sh
53 @@ -17,7 +17,7 @@ echo "DEPSPREFIX=$DEPSPREFIX" >> $GITHUB_ENV
54 echo "PATH=$PATH:$DEPSPREFIX/bin:$PREFIX/bin:~/.local/bin" >> $GITHUB_ENV
55 echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPSPREFIX/lib:$PREFIX/lib" >> $GITHUB_ENV
56 echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$DEPSPREFIX/lib/pkgconfig" >> $GITHUB_ENV
57 -echo "PYTHONPATH=$PYTHONPATH:$PREFIX/$($PYTHON -c "import distutils.sysconfig as sc; print(sc.get_python_lib(prefix='', plat_specific=True,standard_lib=False))")" >> $GITHUB_ENV
58 +echo "PYTHONPATH=$PYTHONPATH:$PREFIX/$($PYTHON -c "import sysconfig as sc; print(sc.get_path('platlib', sc.get_preferred_scheme('user'), vars={'userbase': '.'}))")" >> $GITHUB_ENV
60 if [ ! -d deps/install ]; then
61 echo "Custom dependencies not present - will build them"
62 diff --git a/pyhook/CMakeLists.txt b/pyhook/CMakeLists.txt
63 index dd48054aa7..1fc258a521 100644
64 --- a/pyhook/CMakeLists.txt
65 +++ b/pyhook/CMakeLists.txt
66 @@ -21,7 +21,7 @@ target_link_libraries(psMat_pyhook PRIVATE Python3::Module)
67 # So do it ourselves, getting the prefix-relative path instead
68 if(NOT DEFINED PYHOOK_INSTALL_DIR)
69 execute_process(
70 - COMMAND "${Python3_EXECUTABLE}" -c "import distutils.sysconfig as sc; print(sc.get_python_lib(prefix='', plat_specific=True,standard_lib=False))"
71 + COMMAND "${Python3_EXECUTABLE}" -c "import sysconfig as sc; print(sc.get_path('platlib', sc.get_preferred_scheme('user'), vars={'userbase': '.'}))"
72 RESULT_VARIABLE _pyhook_install_dir_result
73 OUTPUT_VARIABLE PYHOOK_INSTALL_DIR
74 OUTPUT_STRIP_TRAILING_WHITESPACE)
76 From a7d6c2571ee441fa8ec890e5347cce46d4415aea Mon Sep 17 00:00:00 2001
77 From: Maxim Iorsh <iorsh@users.sourceforge.net>
78 Date: Fri, 24 May 2024 16:49:37 +0300
79 Subject: [PATCH 2/3] [TEMP] Use iorsh/fontforgebuilds repo
81 ---
82 .github/workflows/main.yml | 3 ++-
83 1 file changed, 2 insertions(+), 1 deletion(-)
85 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
86 index 2be70e1865..62d389e9a7 100644
87 --- a/.github/workflows/main.yml
88 +++ b/.github/workflows/main.yml
89 @@ -130,7 +130,8 @@ jobs:
90 - name: Checkout FontForgeBuilds
91 uses: actions/checkout@v3
92 with:
93 - repository: fontforge/fontforgebuilds
94 + repository: iorsh/fontforgebuilds
95 + ref: py_sysconfig
96 path: fontforgebuilds
97 - name: Setup MSYS2
98 uses: msys2/setup-msys2@v2