[packages/ogre] - added python patch (adjust module install dir, use python 3), package python3-ogre module

qboosh qboosh at pld-linux.org
Tue Feb 8 06:33:45 CET 2022


commit 2b1ce9e18331464c55c3af04c48f0c3f039cb14d
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Feb 8 06:35:09 2022 +0100

    - added python patch (adjust module install dir, use python 3), package python3-ogre module

 ogre-python.patch | 23 +++++++++++++++++++++++
 ogre.spec         | 39 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 57 insertions(+), 5 deletions(-)
---
diff --git a/ogre.spec b/ogre.spec
index 9781423..36e5509 100644
--- a/ogre.spec
+++ b/ogre.spec
@@ -2,11 +2,9 @@
 # TODO:
 #  - bconds for the rest of the plugins
 #  - subpackages? (Qt library, some plugins?)
-#  - package csharp and python bindings
+#  - package csharp bindings (adjust dirs for mono?)
 #	/usr/lib/cli/ogre-sharp-1.12.13/Ogre.dll
 #	/usr/lib/cli/ogre-sharp-1.12.13/libOgre.so
-#	/usr/lib/libOgreBitesQt.so
-#	/usr/lib/libOgreBitesQt.so.1.12.13
 #  - GLSL Optimizer: GLSL Optimizer <http://github.com/aras-p/glsl-optimizer/>
 #  - HLSL2GLSL: HLSL2GLSL <http://hlsl2glslfork.googlecode.com/>
 #
@@ -14,7 +12,9 @@
 # Conditional build:
 %bcond_with	cg		# build with cg
 %bcond_with	samples		# build samples (not installed anyway)
+%bcond_with	dotnet		# C# support
 %bcond_with	java		# Java support
+%bcond_without	python		# Python support
 %bcond_with	openexr		# OpenEXR plugin
 
 %ifnarch %{ix86} %{x8664} x32
@@ -31,6 +31,7 @@ License:	MIT
 Group:		Applications/Graphics
 Source0:	https://github.com/OGRECave/ogre/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	907c68d19e16806462f14b9746a27411
+Patch0:		%{name}-python.patch
 Patch1:		x32.patch
 URL:		https://www.ogre3d.org/
 %{?with_samples:BuildRequires:	CEGUI-devel}
@@ -51,6 +52,7 @@ BuildRequires:	freetype-devel >= 2.1.0
 BuildRequires:	libstdc++-devel >= 6:4.7
 BuildRequires:	pkgconfig
 BuildRequires:	pugixml-devel
+%{?with_python:BuildRequires:	python3-devel >= 1:3.4}
 BuildRequires:	rpmbuild(macros) >= 1.742
 BuildRequires:	swig-python >= 3.0.8
 BuildRequires:	tinyxml-devel
@@ -88,6 +90,18 @@ This is the package containing the header files for OGRE library.
 %description devel -l pl.UTF-8
 Ten pakiet zawiera pliki nagłówkowe biblioteki OGRE.
 
+%package -n python3-ogre
+Summary:	Python interface to Ogre library
+Summary(pl.UTF-8):	Pythonowy interfejs do biblioteki Ogre
+Group:		Libraries/Python
+Requires:	%{name} = %{version}-%{release}
+
+%description -n python3-ogre
+Python interface to Ogre library.
+
+%description -n python3-ogre -l pl.UTF-8
+Pythonowy interfejs do biblioteki Ogre.
+
 %package examples
 Summary:	OGRE samples
 Summary(pl.UTF-8):	Przykłady do OGRE
@@ -102,10 +116,10 @@ Przykłady do OGRE.
 
 %prep
 %setup -q
+%patch0 -p1
 %patch1 -p1
 
 %build
-
 install -d build
 cd build
 # "None" is an alias for release, but uses plain CMAKE_CXX_FLAGS; "PLD" build type is not supported
@@ -113,10 +127,13 @@ cd build
 	-DCMAKE_CXX_FLAGS="%{rpmcxxflags}" \
 	-DCMAKE_BUILD_TYPE=%{?debug:Debug}%{!?debug:None} \
 	-DOGRE_BUILD_COMPONENT_HLMS=TRUE \
+	%{cmake_on_off dotnet OGRE_BUILD_COMPONENT_CSHARP} \
 	%{cmake_on_off java OGRE_BUILD_COMPONENT_JAVA} \
+	%{cmake_on_off python OGRE_BUILD_COMPONENT_PYTHON} \
 	-DOGRE_BUILD_DEPENDENCIES=FALSE \
 	%{cmake_on_off openexr OGRE_BUILD_PLUGIN_EXRCODEC} \
-	%{!?with_samples:-DOGRE_BUILD_SAMPLES=FALSE}
+	%{!?with_samples:-DOGRE_BUILD_SAMPLES=FALSE} \
+	-DPython_EXECUTABLE:PATH=%{__python3}
 
 %{__make}
 
@@ -129,6 +146,9 @@ cp -pr Samples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 %{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+%py3_comp $RPM_BUILD_ROOT%{py3_sitedir}
+%py3_ocomp $RPM_BUILD_ROOT%{py3_sitedir}
+
 # packaged as %doc
 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/OGRE
 
@@ -205,6 +225,15 @@ rm -rf $RPM_BUILD_ROOT
 %{_pkgconfigdir}/OGRE-Volume.pc
 %{_libdir}/OGRE/cmake
 
+%if %{with python}
+%files -n python3-ogre
+%defattr(644,root,root,755)
+%dir %{py3_sitedir}/Ogre
+%attr(755,root,root) %{py3_sitedir}/Ogre/*.so
+%{py3_sitedir}/Ogre/*.py
+%{py3_sitedir}/Ogre/__pycache__
+%endif
+
 %files examples
 %defattr(644,root,root,755)
 %{_examplesdir}/%{name}-%{version}
diff --git a/ogre-python.patch b/ogre-python.patch
new file mode 100644
index 0000000..e64d7fa
--- /dev/null
+++ b/ogre-python.patch
@@ -0,0 +1,23 @@
+--- ogre-1.12.13/CMake/Dependencies.cmake.orig	2021-08-04 20:33:45.000000000 +0200
++++ ogre-1.12.13/CMake/Dependencies.cmake	2022-02-07 22:53:08.197330225 +0100
+@@ -298,8 +298,7 @@ find_package(OpenEXR)
+ macro_log_feature(OPENEXR_FOUND "OpenEXR" "Load High dynamic range images" "http://www.openexr.com/" FALSE "" "")
+ 
+ # Python
+-set(Python_ADDITIONAL_VERSIONS 3.4) # allows using python3 on Ubuntu 14.04
+-find_package(PythonInterp)
++find_package(PythonInterp 3)
+ find_package(PythonLibs)
+ macro_log_feature(PYTHONLIBS_FOUND "Python" "Language bindings to use OGRE from Python" "http://www.python.org/" FALSE "" "")
+ 
+--- ogre-1.12.13/Components/Python/CMakeLists.txt.orig	2021-08-04 20:33:45.000000000 +0200
++++ ogre-1.12.13/Components/Python/CMakeLists.txt	2022-02-07 21:18:38.364713012 +0100
+@@ -8,7 +8,7 @@ include_directories(${PYTHON_INCLUDE_PAT
+ include_directories("${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/OgreMain/include")
+ include(${SWIG_USE_FILE})
+ 
+-set(PYTHON_SITE_PACKAGES lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/dist-packages/Ogre/)
++set(PYTHON_SITE_PACKAGES lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/Ogre/)
+ 
+ if(SKBUILD)
+     set(PYTHON_SITE_PACKAGES Ogre/)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ogre.git/commitdiff/2b1ce9e18331464c55c3af04c48f0c3f039cb14d



More information about the pld-cvs-commit mailing list