Skip to content

Commit

Permalink
Fix aggdraw build on mingw
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Sep 21, 2023
1 parent 9962961 commit 97939a3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bootstrap-carla.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fi

if [ "${WIN32}" -eq 1 ] && [ "${CROSS_COMPILING}" -eq 1 ]; then
PYTHONPATH="${PAWPAW_PREFIX}/lib/python3.8/site-packages"
if [ "${CROSS_COMPILING}" -eq 1 ] && [ ! -e "${PYTHONPATH}/liblo.pyd" ]; then
if [ ! -e "${PYTHONPATH}/liblo.pyd" ]; then
ln -sv "${PYTHONPATH}"/pyliblo-*.egg/*.so "${PYTHONPATH}/liblo.pyd"
fi
unset PYTHONPATH
Expand Down
16 changes: 16 additions & 0 deletions bootstrap-mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,25 @@ build_waf jack2 "${JACK2_VERSION}" "${JACK2_EXTRAFLAGS}"

AGGDRAW_VERSION="1.3.11"

if [ "${WIN32}" -eq 1 ]; then
export AGGDRAW_FREETYPE_ROOT="${PAWPAW_PREFIX}"
export EXTRA_CFLAGS="$(${PAWPAW_PREFIX}/bin/pkg-config --cflags python3 freetype2 libpng)"
export EXTRA_LDFLAGS="-shared $(${PAWPAW_PREFIX}/bin/pkg-config --libs python3 freetype2 libpng) -lgdi32 -lkernel32 -luser32"
fi

download aggdraw "${AGGDRAW_VERSION}" "https://files.pythonhosted.org/packages/ef/29/fddf555c68920bb0aff977425af786226db2a78379e706951ff32b4492ef"
build_python aggdraw "${AGGDRAW_VERSION}"

unset AGGDRAW_FREETYPE_ROOT

if [ "${WIN32}" -eq 1 ] && [ "${CROSS_COMPILING}" -eq 1 ]; then
PYTHONPATH="${PAWPAW_PREFIX}/lib/python3.8/site-packages"
if [ ! -e "${PYTHONPATH}/aggdraw.pyd" ]; then
ln -sv "${PYTHONPATH}"/aggdraw-*.egg/*.so "${PYTHONPATH}/aggdraw.pyd"
fi
unset PYTHONPATH
fi

# ---------------------------------------------------------------------------------------------------------------------
# tornado

Expand Down
14 changes: 14 additions & 0 deletions patches/Python/win32/9001-pawpaw-needed-changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ index dddf412..3edccb6 100644
result = RE_VERSION.search(out_string)
if result is None:
return None
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index f159586..004e89f 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -200,6 +200,9 @@ class UnixCCompiler(CCompiler):

if sys.platform == 'darwin':
linker = _osx_support.compiler_fixup(linker, ld_args)
+ else:
+ ld_args += linker[i+offset+1:]
+ linker = [linker[i+offset]]

self.spawn(linker + ld_args)
except DistutilsExecError as msg:
diff --git a/Misc/python.pc.in b/Misc/python.pc.in
index 3900190..a14e42b 100644
--- a/Misc/python.pc.in
Expand Down
26 changes: 26 additions & 0 deletions patches/aggdraw/01_fix-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/agg2/include/agg_array.h b/agg2/include/agg_array.h
index 37684d1..3a0f5c0 100644
--- a/agg2/include/agg_array.h
+++ b/agg2/include/agg_array.h
@@ -520,7 +520,7 @@ namespace agg
int8u* ptr = m_buf_ptr;
if(alignment > 1)
{
- unsigned align = (alignment - (unsigned long)(ptr) % alignment) % alignment;
+ unsigned align = (alignment - (uintptr_t)(ptr) % alignment) % alignment;
size += align;
ptr += align;
if(size <= m_rest)
diff --git a/aggdraw.cxx b/aggdraw.cxx
index 0ad56c7..b6f1912 100644
--- a/aggdraw.cxx
+++ b/aggdraw.cxx
@@ -49,7 +49,7 @@
#define Q(x) #x
#define QUOTE(x) Q(x)

-#if defined(_MSC_VER)
+#if defined(_WIN32)
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#endif

0 comments on commit 97939a3

Please sign in to comment.