svn commit: r568377 - head/games/adonthell

Kai Knoblich kai at FreeBSD.org
Sun Mar 14 10:53:05 UTC 2021


Author: kai
Date: Sun Mar 14 10:53:04 2021
New Revision: 568377
URL: https://svnweb.freebsd.org/changeset/ports/568377

Log:
  games/adonthell: Fix linking with Python 3.8 and onwards
  
  * Link against libpython via the "--embed" flag for Python 3.8 and onwards.
  
  Excerpt from the log:
  
  main.o: In function `main':
  main.cc:(.text+0x1af): undefined reference to `PyImport_AppendInittab'
  main.cc:(.text+0x1c2): undefined reference to `Py_DecodeLocale'
  main.cc:(.text+0x1cf): undefined reference to `Py_SetProgramName'
  main.cc:(.text+0x4e9): undefined reference to `PyModule_GetDict'
  [...]
  
  PR:		253815

Modified:
  head/games/adonthell/Makefile

Modified: head/games/adonthell/Makefile
==============================================================================
--- head/games/adonthell/Makefile	Sun Mar 14 10:50:04 2021	(r568376)
+++ head/games/adonthell/Makefile	Sun Mar 14 10:53:04 2021	(r568377)
@@ -24,7 +24,7 @@ USE_SDL=	mixer2 ttf2
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-py-debug \
 		--disable-pyc \
-		--with-py-libs="$$(${PYTHON_CMD}-config --ldflags)" \
+		--with-py-libs="$$(${PYTHON_CMD}-config --ldflags ${_PY_EMBED})" \
 		--with-python=${PYTHON_CMD}
 
 PLIST_DIRS=	${DATADIR}/games
@@ -33,7 +33,17 @@ PLIST_FILES=	bin/adonthell \
 		${DATADIR}/modules/adonthell.py \
 		${DATADIR}/modules/dialogue.py
 
+.include <bsd.port.pre.mk>
+
+# The "--embed" flag was introduced with Python 3.8 and is required because
+# C extensions are no longer linked to libpython since Python 3.8 and onwards.
+#
+# See also https://bugs.python.org/issue36721 for reference.
+.if ${PYTHON_REL} >= 3800
+_PY_EMBED=	--embed
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} 's,adonthell-0.3,adonthell,g' ${WRKSRC}/src/Makefile.in
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>


More information about the svn-ports-all mailing list