File makehuman.spec of Package makehuman
#
# spec file for package makehuman
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: makehuman
Version: 1.3.0
Release: 0
URL: http://www.makehumancommunity.org
Source: https://github.com/makehumancommunity/makehuman/archive/refs/tags/v%{version}.tar.gz#/makehuman-%{version}.tar.gz
Summary: Tool for creating realistic 3D human characters
License: AGPL-3.0
Group: Applications/Graphics
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-base
BuildRequires: update-desktop-files
Requires: %{name}-data = %version
Requires: python3-numpy
Requires: python3-opengl
Requires: python3-qt5
BuildArch: noarch
%description
MakeHuman is a tool designed to simplify the creation of virtual humans using
a Graphical User Interface.
%package data
Summary: Makehuman data files
Group: Applications/Graphics
Requires: %{name} = %version
%description data
Various assets and other data to be used along with MakeHuman such as clothing, textures, shaders and translations.
%prep
%autosetup -N -n %name-%version
%autopatch -p 1
find makehuman/* -type f -name '*.py' -not -name makehuman.py -print -exec sed -i -e '1 { /#!/ d }' '{}' \;
sed -i -e '1 s@#!.*@#!/usr/bin/python3@' \
-e 's/release = False/release = True /' \
-e 's/versionSub = ".*"/versionSub = ""/' \
makehuman/makehuman.py
%build
# nothing to do
%install
install -D -m 0755 -t %{buildroot}%{_datadir}/makehuman/ makehuman/makehuman.py
mkdir -p %{buildroot}%{_bindir}
ln -s ../../%{_datadir}/makehuman/makehuman.py %{buildroot}%{_bindir}/makehuman
#move makehuman data files and code
cp -r makehuman/apps %{buildroot}%{_datadir}/makehuman/
cp -r makehuman/core %{buildroot}%{_datadir}/makehuman/
cp -r makehuman/data %{buildroot}%{_datadir}/makehuman/
cp -r makehuman/shared %{buildroot}%{_datadir}/makehuman/
cp -r makehuman/icons %{buildroot}%{_datadir}/makehuman/
cp -r makehuman/lib %{buildroot}%{_datadir}/makehuman/
cp -r makehuman/plugins %{buildroot}%{_datadir}/makehuman/
#check for duplicates, remove them and make symlinks
%fdupes %{buildroot}%{_datadir}/makehuman/data
%fdupes %{buildroot}%{_datadir}/makehuman/{apps,core,shared,icons,lib,plugins}
#set permissions for python files
find %{buildroot}%{_datadir} -type d -exec chmod 755 {} +
find %{buildroot}%{_datadir} -type f -name '*.py' -not -name makehuman.py -print -exec chmod 644 {} +
# remove all pre-compiled py scripts and compile all py scripts manually
find %{buildroot}%{_datadir} -type f -name '*.pyc' -print -delete
find %{buildroot}%{_datadir} -type f -name '*.pyo' -print -delete
%python3_compile
# Create and install desktop file
cat << EOF > MakeHuman.desktop
[Desktop Entry]
Name=MakeHuman
Comment=MakeHuman is a free, open source tool for creating realistic 3D human characters.
Exec=makehuman
Terminal=false
Type=Application
Icon=makehuman
Categories=Graphics;3DGraphics;
EOF
desktop-file-install --dir %{buildroot}%{_datadir}/applications MakeHuman.desktop
install -D -m 0644 -t %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/ makehuman/icons/makehuman.svg
%check
export PYTHONDONTWRITEBYTECODE=1
export PATH=%{buildroot}%{_bindir}:$PATH
makehuman --license
%files
%license makehuman/license.txt makehuman/licenses
%{_bindir}/makehuman
%{_datadir}/makehuman/apps
%{_datadir}/makehuman/core
%{_datadir}/makehuman/shared
%{_datadir}/makehuman/icons
%{_datadir}/makehuman/lib
%{_datadir}/makehuman/makehuman.py
%{_datadir}/makehuman/plugins
%{_datadir}/applications/MakeHuman.desktop
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%{_datadir}/icons/hicolor/scalable/apps/makehuman.svg
%files data
%dir %{_datadir}/makehuman
%{_datadir}/makehuman/data
%changelog