diff options
Diffstat (limited to 'app-misc/golly')
-rw-r--r-- | app-misc/golly/Manifest | 7 | ||||
-rw-r--r-- | app-misc/golly/files/golly-3.3-allow-py23-exec.patch | 12 | ||||
-rw-r--r-- | app-misc/golly/files/golly-3.3-allow-py3.patch | 90 | ||||
-rw-r--r-- | app-misc/golly/files/golly-3.3-glife-py23.patch | 32 | ||||
-rw-r--r-- | app-misc/golly/files/golly-3.3-nondynamic-python.patch | 51 | ||||
-rw-r--r-- | app-misc/golly/golly-3.3-r1.ebuild | 7 | ||||
-rw-r--r-- | app-misc/golly/golly-3.3-r2.ebuild | 70 |
7 files changed, 266 insertions, 3 deletions
diff --git a/app-misc/golly/Manifest b/app-misc/golly/Manifest index ca412dc28f46..a4e7442cc7cd 100644 --- a/app-misc/golly/Manifest +++ b/app-misc/golly/Manifest @@ -1,3 +1,8 @@ +AUX golly-3.3-allow-py23-exec.patch 688 BLAKE2B d72ba8e9264f2b677818f46e94efac0b185cfb72fdac045b124a931ed8c727d644df8e76cc8d237bdb09a8adcc4a085a780c7f443a9c5c5df510efc3e3f028e2 SHA512 af7a7e132464594726d71d056105f88661e0e585f6833ea222977c5f659d3b02f4c12f2231e645955a3fea1de31cf9481cdf0949bc71adec12876550ee190393 +AUX golly-3.3-allow-py3.patch 3018 BLAKE2B ca05bc615f2bce230bb80bddcfca5d017181fba11c3117c438ec8cbff16fbd645a49b0f8f1cb3f52efb6a5c6548e2398b95167b738dfa3df36336ff43fc59d4f SHA512 409f765d7107b1f9d7df8389a57a06c7be37c050eed26f5724f24bed36fa5d93ff074d6ded991faf1c02341c726c4c8ceca268f89b64fef38f98c5c331a51f23 +AUX golly-3.3-glife-py23.patch 1087 BLAKE2B bc00e95ac7f07bae2c778f1faf93fee7e1ccd92947e12bb1fbc97c0a074c5a347c6ff084a47085c656a94bd2add2fe14c313aff39f60174c983670be006ad9b3 SHA512 814c8a9ac2e96bf4ff61bd46b86a5ef7cfd5a4ba027fd5af78029cfbfb2b8334c76bede82770912509b0c858a2e3ff3af8258aec6e8ee328710d805d527a2863 +AUX golly-3.3-nondynamic-python.patch 1830 BLAKE2B b202aebb3975f55de4748a925d3e4ef87e2033fa6dca7773327e5ca272872bdd817000a02a9bf5a6630eb1716ffa220844bfc324271d9b9a889a4f3cb25257e4 SHA512 5e12d9e6800cf4f3a495964d9320dae1a8a9ad4350d374c9ffa0ec61316d48d4d545d95e200a4b04a700fdb923a841214788da05d0d05bb8768018f83e5bf9a4 DIST golly-3.3-src.tar.gz 5465595 BLAKE2B e74da3799d1086a46fba523e6b087e6bc50c908098b27a80573936629fd5ad6195968df46b2933a9984cff85068222a80040761254298c5f648b040d5532a7ba SHA512 2aa9c2e7b2ebe3fe85bcb6177e58ee83bd08475e0a37a04cdb7e649b9faf5c2f936c534af62c8cf2322baade65c6e5197768901dfb464c17b20b941e1fa77265 -EBUILD golly-3.3-r1.ebuild 927 BLAKE2B 622e0e227aae28d5d59f91728dda34f82bf3b5ddd86edebaeff2f6ac421ad2f5f83544476f7b8468e307763202cce818cb2fc076a88aba59fec24aa34a4ed7c5 SHA512 a4ccc1e2bd716c75d65ea612d4191c5eee371265ee389098f6717330acae8dc60459e24da877bb77aa84c97ada77c9438d5d4f1b59bb5f02928a477031531c20 +EBUILD golly-3.3-r1.ebuild 1026 BLAKE2B 8cde2168e0b3ee5608ad790dc1d6197f715d012260bdecdc572e5a5c4ebe2887ef612b17b4064b8b1f2fc6a127ac067f678c79afad774a7bd053c95010860d5c SHA512 e14e63e356a06d1e78c0837636c3d34cca9ead96c5e10ded6f119c0df00f6a7cc968108e4a9017389973fe26441f4e56cd71618263bad4780fc0265e8fa82018 +EBUILD golly-3.3-r2.ebuild 1352 BLAKE2B 890bee53df3849f02d929b52a1947271d0e67991c0a2a4e8e4ba0b166d4139edbe36117f0e9b0092eae32a5c79fe5b5bb7cc47c5244a1bb8254e5fe6a579dd3a SHA512 6e5853d8a28373452f7c35104bbc3348ba2876642363ec041e38195b0672206f3da62af10eed4505dda15fe92157cf4d8b3c2656158650f487a4b805423bb5df MISC metadata.xml 326 BLAKE2B 6064832ecd0867971a46cd3c998419df96a09aea31c361b98cc81212e1a84bb99053f14a86321b194196df7e74d1859d7c82c2f55adcf0dd887224754aed381e SHA512 be4d2ed3256cbb48987657dc4a6569c4fa415a495488f17bffe0954bd54127bfc4f6652912b18666a02887bfe31769d1b0c1a67c311e286abca347a9b756301f diff --git a/app-misc/golly/files/golly-3.3-allow-py23-exec.patch b/app-misc/golly/files/golly-3.3-allow-py23-exec.patch new file mode 100644 index 000000000000..e46b608ed6c5 --- /dev/null +++ b/app-misc/golly/files/golly-3.3-allow-py23-exec.patch @@ -0,0 +1,12 @@ +'execfile' is python-2-only. 'exec/open' works for both python2 and python3. +--- a/gui-wx/wxpython.cpp ++++ b/gui-wx/wxpython.cpp +@@ -3356,7 +3388,7 @@ void RunPythonScript(const wxString& filepath) + // for the global namespace so that this script cannot change the + // globals of a caller script (which is possible now that RunScript + // is re-entrant) +- wxString command = wxT("execfile('") + fpath + wxT("',{})"); ++ wxString command = wxT("exec(open('") + fpath + wxT("').read(),{})"); + PyRun_SimpleString(command.mb_str(wxConvLocal)); + // don't use wxConvUTF8 in above line because caller has already converted + // filepath to decomposed UTF8 if on a Mac diff --git a/app-misc/golly/files/golly-3.3-allow-py3.patch b/app-misc/golly/files/golly-3.3-allow-py3.patch new file mode 100644 index 000000000000..54a047830818 --- /dev/null +++ b/app-misc/golly/files/golly-3.3-allow-py3.patch @@ -0,0 +1,90 @@ +The patch allows python3 as a python implementation. +Ports module loading to conditional python3 support. +--- a/gui-wx/configure/configure.ac ++++ b/gui-wx/configure/configure.ac +@@ -19,7 +19,7 @@ AC_ARG_WITH([python-shlib], [AS_HELP_STRING([--with-python-shlib=ARG], + , [with_python_shlib=check]) + AC_ARG_VAR([GOLLYDIR], [golly data directory [default=DATADIR/golly]]) + AC_ARG_VAR([PERL], [Perl 5 interpreter]) +-AC_ARG_VAR([PYTHON], [Python 2 interpreter]) ++AC_ARG_VAR([PYTHON], [Python interpreter]) + + # Check for build tools: + m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +@@ -76,7 +76,7 @@ AS_IF([test "x$enable_perl" = xyes], [ + ]) + + # Find Python +-AC_PATH_PROGS(PYTHON, [python2 python]) ++AC_CHECK_PROGS(PYTHON, [python python3 python2]) + AS_IF([test "x$PYTHON" = x], [AC_MSG_ERROR([missing Python])]) + AC_SUBST([PYTHON_INCLUDE], [-I"'`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())"`'"]) + AS_IF([test "x$with_python_shlib" = xcheck], +--- a/gui-wx/wxpython.cpp ++++ b/gui-wx/wxpython.cpp +@@ -90,6 +90,12 @@ + #include <Python.h> + #endif + ++#if PY_MAJOR_VERSION >= 3 ++ // python-3 got rid of int/log distinction ++ #define PyInt_AsLong PyLong_AsLong ++ #define PyInt_FromLong PyLong_FromLong ++#endif ++ + #ifdef USE_PYTHON_DYNAMIC + + #ifndef __WXMAC__ +@@ -3268,6 +3274,22 @@ static PyMethodDef py_methods[] = { + { NULL, NULL, 0, NULL } + }; + ++#if PY_MAJOR_VERSION >= 3 ++static PyModuleDef golly_module = { ++ PyModuleDef_HEAD_INIT, ++ "golly", /* name */ ++ NULL, /* doc */ ++ -1, /* size */ ++ py_methods, /* methoods */ ++}; ++ ++PyMODINIT_FUNC ++PyInit_golly(void) ++{ ++ return PyModule_Create(&golly_module); ++} ++#endif ++ + // ============================================================================= + + bool pyinited = false; // InitPython has been successfully called? +@@ -3280,6 +3302,13 @@ bool InitPython() + if (!LoadPythonLib()) return false; + #endif + ++ #if PY_MAJOR_VERSION >= 3 ++ // Autoload 'golly' builtin module at interpreter start. ++ if (PyImport_AppendInittab("golly", PyInit_golly) == -1) { ++ Warning(_("Error: could not extend in-built modules table\n")); ++ } ++ #endif ++ + // only initialize the Python interpreter once, mainly because multiple + // Py_Initialize/Py_Finalize calls cause leaks of about 12K each time! + Py_Initialize(); +@@ -3287,9 +3316,12 @@ bool InitPython() + #ifdef USE_PYTHON_DYNAMIC + GetPythonExceptions(); + #endif +- +- // allow Python to call the above py_* routines +- Py_InitModule((char*)"golly", py_methods); ++ ++ // Python-3 uses module constructor ++ #if PY_MAJOR_VERSION < 3 ++ // allow Python to call the above py_* routines ++ Py_InitModule((char*)"golly", py_methods); ++ #endif + + // catch Python messages sent to stderr and pass them to py_stderr + if (PyRun_SimpleString( diff --git a/app-misc/golly/files/golly-3.3-glife-py23.patch b/app-misc/golly/files/golly-3.3-glife-py23.patch new file mode 100644 index 000000000000..8b1599712508 --- /dev/null +++ b/app-misc/golly/files/golly-3.3-glife-py23.patch @@ -0,0 +1,32 @@ +Use python-3 compatible syntax. +--- a/Scripts/Python/glife/__init__.py ++++ b/Scripts/Python/glife/__init__.py +@@ -90,7 +90,7 @@ def rule(s = "B3/S23"): + def description(s): + """Supply a textual description to the whole pattern.""" + for line in s.split("\n"): +- print "#D", line ++ print("#D", line) + + # -------------------------------------------------------------------- + +@@ -161,7 +161,7 @@ class pattern(list): + It is also the base for computing generations subsequent to N-th.""" + if N < 0: + raise ValueError("backward evolving requested") +- if self.__phases.has_key(N): ++ if N in self.__phases: + return self.__phases[N] + M = 0 + for k in self.__phases.keys(): +--- a/Scripts/Python/glife/text.py ++++ b/Scripts/Python/glife/text.py +@@ -173,7 +173,7 @@ def make_text (string, font='Snakial'): + unknown = '-' + + for c in string: +- if not f.has_key (c): c = unknown ++ if not (c in f): c = unknown + symbol = f[c] + p += symbol (x, 0) + x += symbol.width diff --git a/app-misc/golly/files/golly-3.3-nondynamic-python.patch b/app-misc/golly/files/golly-3.3-nondynamic-python.patch new file mode 100644 index 000000000000..bc1c81a61917 --- /dev/null +++ b/app-misc/golly/files/golly-3.3-nondynamic-python.patch @@ -0,0 +1,51 @@ +Don't use runtime python loading via dlopen(). + +Just link to libpython directly. That makes python dependency +more explicit and allows catching more compile-time bugs. +--- a/gui-wx/configure/Makefile.am ++++ b/gui-wx/configure/Makefile.am +@@ -22,7 +22,7 @@ golly_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) $(PYTHON_INCLUDE) \ + $(PERL_CPPFLAGS) $(PERL_INCLUDE) \ + $(liblua_a_CPPFLAGS) -I$(top_srcdir)/../../lua + golly_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CXXFLAGS_ONLY) +-golly_LDADD = $(WX_LIBS) libgolly.a liblua.a ++golly_LDADD = $(WX_LIBS) $(PYTHON_LIBS) libgolly.a liblua.a + + if WINDOWS + golly_LDADD += gollyres.o +--- a/gui-wx/configure/configure.ac ++++ b/gui-wx/configure/configure.ac +@@ -86,6 +86,16 @@ AS_IF([test "x$with_python_shlib" = xcheck], + AS_IF([test "x$shlib" = x], AC_MSG_ERROR([could not determine Python shared library name])) + AC_DEFINE_UNQUOTED([PYTHON_SHLIB], [$shlib]) + ++# Find python interpreter ++# 1. --embed is needed for python>=3.8 ++# 2. statuc check is needed because python-3.7-config outputs error to stdout, not stderr ++if ${PYTHON}-config --libs --embed; then ++ PYTHON_LIBS=`${PYTHON}-config --libs --embed` ++elif ${PYTHON}-config --libs; then ++ PYTHON_LIBS=`${PYTHON}-config --libs` ++fi ++AC_SUBST(PYTHON_LIBS) ++ + # Find zlib (unless explicitly disabled) + AS_IF([test "x$with_zlib" != xno], + [ AC_CHECK_HEADER([zlib.h], , [AC_MSG_ERROR([missing zlib])]) +--- a/gui-wx/wxpython.cpp ++++ b/gui-wx/wxpython.cpp +@@ -59,8 +59,12 @@ + #undef SIZEOF_SIZE_T + #undef SIZEOF_VOID_P + #else +- // load Python lib at runtime +- #define USE_PYTHON_DYNAMIC ++ // On gentoo just link against python to make ++ // python dependency more explicit. ++ # if 0 ++ // load Python lib at runtime ++ #define USE_PYTHON_DYNAMIC ++ #endif + + #ifdef __UNIX__ + // avoid warning on Linux diff --git a/app-misc/golly/golly-3.3-r1.ebuild b/app-misc/golly/golly-3.3-r1.ebuild index 27ee1bae14e8..26742c324c99 100644 --- a/app-misc/golly/golly-3.3-r1.ebuild +++ b/app-misc/golly/golly-3.3-r1.ebuild @@ -4,8 +4,9 @@ EAPI=7 WX_GTK_VER=3.0 +PYTHON_COMPAT=( python2_7 ) -inherit desktop eutils flag-o-matic wxwidgets xdg-utils +inherit desktop eutils flag-o-matic python-single-r1 wxwidgets xdg-utils DESCRIPTION="simulator for Conway's Game of Life and other cellular automata" HOMEPAGE="http://golly.sourceforge.net/" @@ -15,11 +16,13 @@ LICENSE="GPL-2" SLOT="0" KEYWORDS="amd64 x86" IUSE="tiff" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" DEPEND="virtual/opengl sys-libs/zlib x11-libs/wxGTK:${WX_GTK_VER}[X,opengl,tiff?]" -RDEPEND="${DEPEND}" +RDEPEND="${DEPEND} + ${PYTHON_DEPS}" S=${WORKDIR}/${P}-src diff --git a/app-misc/golly/golly-3.3-r2.ebuild b/app-misc/golly/golly-3.3-r2.ebuild new file mode 100644 index 000000000000..e3a3e4a7e591 --- /dev/null +++ b/app-misc/golly/golly-3.3-r2.ebuild @@ -0,0 +1,70 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +WX_GTK_VER=3.0 +PYTHON_COMPAT=( python{2_7,3_{7,8,9}} ) + +inherit autotools desktop python-single-r1 wxwidgets xdg-utils + +DESCRIPTION="simulator for Conway's Game of Life and other cellular automata" +HOMEPAGE="http://golly.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}-src.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="tiff" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +DEPEND="virtual/opengl + sys-libs/zlib + x11-libs/wxGTK:${WX_GTK_VER}[X,opengl,tiff?] + ${PYTHON_DEPS} +" + +RDEPEND="${DEPEND}" + +S=${WORKDIR}/${P}-src + +PATCHES=( + "${FILESDIR}"/${P}-nondynamic-python.patch + "${FILESDIR}"/${P}-allow-py23-exec.patch + "${FILESDIR}"/${P}-glife-py23.patch + "${FILESDIR}"/${P}-allow-py3.patch +) + +pkg_setup() { + python-single-r1_pkg_setup + setup-wxwidgets +} + +src_prepare() { + default + + # patches change configure.ac and Makefile.am + pushd gui-wx/configure + eautoreconf + popd +} + +src_configure() { + ECONF_SOURCE=gui-wx/configure econf \ + --with-wxshared +} + +src_install() { + emake docdir= DESTDIR="${D}" install + dodoc docs/ReadMe.html + newicon --size 32 gui-wx/icons/appicon.xpm ${PN}.xpm + make_desktop_entry ${PN} "Golly" ${PN} "Science" +} + +pkg_postinst() { + xdg_icon_cache_update +} + +pkg_postrm() { + xdg_icon_cache_update +} |