git: a73665376a53 - main - databases/py-gdbm: fix build with Python 3.12+

From: Charlie Li <vishwin_at_FreeBSD.org>
Date: Tue, 17 Jun 2025 19:07:45 UTC
The branch main has been updated by vishwin:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a73665376a539a144ff74abaab04f6d350f7bdb4

commit a73665376a539a144ff74abaab04f6d350f7bdb4
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2025-06-17 19:06:26 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2025-06-17 19:06:26 +0000

    databases/py-gdbm: fix build with Python 3.12+
    
    Certain internal headers are included unconditionally starting with
    Python 3.12, but this should have been built with the appropriate
    preprocessor macros for internal headers set anyway.
    
    PR: 286298
    Event: Kitchener-Waterloo Hackathon 202506
---
 databases/py-gdbm/Makefile       | 2 +-
 databases/py-gdbm/files/setup.py | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/databases/py-gdbm/Makefile b/databases/py-gdbm/Makefile
index 3514845816c4..6496b880ea85 100644
--- a/databases/py-gdbm/Makefile
+++ b/databases/py-gdbm/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	gdbm
 DISTVERSION=	${PYTHON_DISTVERSION}
-PORTREVISION=	9
+PORTREVISION=	10
 CATEGORIES=	databases python
 MASTER_SITES=	PYTHON/ftp/python/${DISTVERSION}
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/databases/py-gdbm/files/setup.py b/databases/py-gdbm/files/setup.py
index d6424297d8da..57804f9db8e7 100644
--- a/databases/py-gdbm/files/setup.py
+++ b/databases/py-gdbm/files/setup.py
@@ -4,12 +4,15 @@ import sysconfig
 from setuptools import setup, Extension
 
 prefix = sysconfig.get_config_var('prefix')
-inc_dirs = [prefix + "/include"]
+inc_dirs = [sysconfig.get_path('include') + "/internal",
+            prefix + "/include"]
 lib_dirs = [prefix + "/lib"]
 libs = ["gdbm"]
+macros = [('Py_BUILD_CORE_MODULE', 1)]
 
 setup(ext_modules = [Extension('_gdbm', ['_gdbmmodule.c'],
                                include_dirs = inc_dirs,
                                libraries = libs,
-                               library_dirs = lib_dirs)]
+                               library_dirs = lib_dirs,
+                               define_macros = macros)]
       )