diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | 0001-explicitly-use-QLibrary-to-load-libpython-like-pykde.patch | 37 | ||||
-rw-r--r-- | kig.spec | 108 | ||||
-rw-r--r-- | sources | 1 |
4 files changed, 147 insertions, 0 deletions
@@ -0,0 +1 @@ +/kig-22.08.0.tar.xz diff --git a/0001-explicitly-use-QLibrary-to-load-libpython-like-pykde.patch b/0001-explicitly-use-QLibrary-to-load-libpython-like-pykde.patch new file mode 100644 index 0000000..89e79f4 --- /dev/null +++ b/0001-explicitly-use-QLibrary-to-load-libpython-like-pykde.patch @@ -0,0 +1,37 @@ +diff -up kig-20.12.2/CMakeLists.txt.0001 kig-20.12.2/CMakeLists.txt +--- kig-20.12.2/CMakeLists.txt.0001 2021-01-29 14:06:32.000000000 -0600 ++++ kig-20.12.2/CMakeLists.txt 2021-02-02 16:28:15.949344601 -0600 +@@ -64,6 +64,9 @@ add_subdirectory( pykig ) + if(BoostPython_FOUND) + add_subdirectory( scripting ) + add_definitions(-DKIG_ENABLE_PYTHON_SCRIPTING) ++ get_filename_component(PYTHON_LIBRARY_REALPATH "${PYTHON_LIBRARY}" REALPATH) ++ get_filename_component(LIB_PYTHON ${PYTHON_LIBRARY_REALPATH} NAME) ++ add_definitions(-DLIB_PYTHON="${LIB_PYTHON}") + endif(BoostPython_FOUND) + + set_package_properties( +diff -up kig-20.12.2/scripting/python_scripter.cc.0001 kig-20.12.2/scripting/python_scripter.cc +--- kig-20.12.2/scripting/python_scripter.cc.0001 2021-01-29 14:06:32.000000000 -0600 ++++ kig-20.12.2/scripting/python_scripter.cc 2021-02-02 16:29:23.874429781 -0600 +@@ -23,6 +23,8 @@ + #include <Python.h> + #include "python_scripter.h" + ++#include <QLibrary> ++ + #include <iostream> + #include <string> + +@@ -375,6 +377,11 @@ PythonInitializer::PythonInitializer() + { + // tell the python interpreter about our API.. + ++ QLibrary *pythonLib = new QLibrary(); ++ pythonLib->setLoadHints(QLibrary::ExportExternalSymbolsHint); ++ pythonLib->setFileName(LIB_PYTHON); ++ pythonLib->load(); ++ + PyImport_AppendInittab( "kig", PyInit_kig ); + + Py_Initialize(); diff --git a/kig.spec b/kig.spec new file mode 100644 index 0000000..0225ab8 --- /dev/null +++ b/kig.spec @@ -0,0 +1,108 @@ +%global _python3_include %(%{__python3} -Ic "from distutils.sysconfig import get_python_inc; print(get_python_inc())") +%global _python3_lib %{_libdir}/lib%(basename %{_python3_include}).so + +Name: kig +Summary: Interactive Geometry +Version: 22.08.0 +Release: 1 + +License: GPLv2+ +URL: https://invent.kde.org/edu/%{name} + +%global revision %(echo %{version} | cut -d. -f3) + +%if %{revision} >= 50 +%global stable unstable +%else +%global stable stable +%endif + +Source0: http://download.kde.org/%{stable}/release-service/%{version}/src/%{name}-%{version}.tar.xz + +Patch1: 0001-explicitly-use-QLibrary-to-load-libpython-like-pykde.patch + +BuildRequires: boost-devel +BuildRequires: python3 +BuildRequires: python3-rpm-macros +BuildRequires: python3-devel + +BuildRequires: desktop-file-utils +BuildRequires: gettext +BuildRequires: libappstream-glib + +BuildRequires: extra-cmake-modules +BuildRequires: kf5-rpm-macros + +BuildRequires: cmake(KF5DocTools) +BuildRequires: cmake(KF5Parts) +BuildRequires: cmake(KF5I18n) +BuildRequires: cmake(KF5TextEditor) +BuildRequires: cmake(KF5ConfigWidgets) +BuildRequires: cmake(KF5IconThemes) +BuildRequires: cmake(KF5Archive) +BuildRequires: cmake(KF5XmlGui) +BuildRequires: cmake(KF5Crash) +BuildRequires: cmake(KF5CoreAddons) + +BuildRequires: pkgconfig(Qt5PrintSupport) +BuildRequires: pkgconfig(Qt5Svg) +BuildRequires: pkgconfig(Qt5XmlPatterns) + +# when split occurred +Conflicts: kdeedu-math < 4.7.0-10 + +%description +%{summary}. + + +%prep +%setup -q + +%patch1 -p1 -b .0001 + +sed -ie "s|^#!/usr/bin/env python3$|#!%{__python3}|" pykig/pykig.py + + +%build +mkdir %{_target_platform} +pushd %{_target_platform} +%{cmake_kf5} .. \ + -DPYTHON_EXECUTABLE:PATH=%{__python3} \ + -DPYTHON_INCLUDE_DIR=%{_python3_include} \ + -DPYTHON_LIBRARY=%{_python3_lib} \ + -DBoostPython_INCLUDE_DIRS="%{_python3_include};%{_includedir}/boost" \ + -DBoostPython_LIBRARIES="%{_python3_lib};%{_libdir}/libboost_python%{python3_version_nodots}.so" +popd +%make_build -C %{_target_platform} + + +%install +make install/fast DESTDIR=%{buildroot} -C %{_target_platform} + +%find_lang %{name} --all-name --with-html --with-man + + +%check +appstream-util validate-relax --nonet %{buildroot}%{_kf5_metainfodir}/org.kde.%{name}.appdata.xml +desktop-file-validate %{buildroot}%{_kf5_datadir}/applications/org.kde.%{name}.desktop + + +%files -f %{name}.lang +%license LICENSES/* +%{_kf5_bindir}/%{name}* +%{_kf5_bindir}/pykig.* +%{_kf5_datadir}/applications/org.kde.%{name}.desktop +%{_kf5_metainfodir}/org.kde.%{name}.appdata.xml +%{_kf5_datadir}/icons/hicolor/*/apps/%{name}.* +%{_kf5_datadir}/icons/hicolor/*/mimetypes/application-x-%{name}.* +%{_kf5_datadir}/%{name}/ +%{_kf5_datadir}/kservices5/kig_part.desktop +%{_kf5_datadir}/kxmlgui5/%{name}/ +%{_kf5_plugindir}/parts/kigpart.so +%{_kf5_datadir}/katepart5/syntax/python-kig.xml +%{_mandir}/man1/kig.1* + + +%changelog +* Mon Dec 19 2022 misaka00251 <liuxin@iscas.ac.cn> - 22.08.0-1 +- Init package @@ -0,0 +1 @@ +7405c803ee4b939787d2aeda607cd62a kig-22.08.0.tar.xz |