File makehuman.spec of Package makehuman

# spec file for package makehuman
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# 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

Name:           makehuman
Version:        1.1.1
Release:        0

Source101:      makehuman.1
Patch0:         makehuman-startscript.patch 
BuildArch:      noarch
Summary:        Free, open source tool for creating realistic 3D human characters
License:        AGPL-3.0
Group:          Applications/Graphics

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  coreutils
BuildRequires:  fdupes
BuildRequires:  mercurial
BuildRequires:  python

%if 0%{?suse_version}
BuildRequires:  update-desktop-files


%if %{defined fedora}
BuildRequires:  desktop-file-utils
BuildRequires:  python-devel


%if %{defined fedora}
Requires:       %{name}-data = %version
Requires:       PyOpenGL
Requires:       PyQt4
Requires:       numpy
Requires:       python


%if 0%{?suse_version}
Requires:       %{name}-data = %version
Requires:       python
Requires:       python-numpy
Requires:       python-opengl
Requires:       python-qt4


 MakeHuman is a free, open source software which allows the creation of 
realistic 3D human characters fast and in a simplified manner, through the 
manipulation of controls for different human attributes.
 Users are able to model human characters by manipulating the controls to modify 
various human characteristics such as gender, age, height, weight and ethnicity 
as well as low level details of things such as the eye's shape, mouth's shape 
or finger's length. Via a 'point and click' approach, users can preview and 
load poses, animation cycles, facial expressions, hair, shoes and clothes onto 
characters from the MakeHuman™ Library. The human characters created can be 
saved in the custom MakeHuman format (.mhm), rendered and exported in various 
formats such as Collada (.dae), Filmbox (.fbx), MD5, Blender exchange (.mhx), 
Wavefront .obj, Stereolithography (.stl).
 The output characters are licensed under the CC0 license, one of the most 
liberal license for output content. This means that artists are given the 
freedom to use their creations for both commercial and non-commercial 
purposes. The copyright © 2001-2014 is retained by the MakeHuman™ Team 
( which grants you permission to use released code under the GNU 
Affero General Public License 3.0 (AGPL).

%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.

%setup -q -n %name-%version
#copy source 101 (manpage)
cp %{S:101} ./makehuman

%patch0 -p 1

ls -lrt
#gzip man page
gzip ./makehuman/makehuman.1

cd ./makehuman
%__mkdir -p %{buildroot}%{_datadir}/makehuman
%__mkdir -p %{buildroot}%{_datadir}/applications
%__mkdir -p %{buildroot}%{_bindir}

#remove blendertools - should be installed by user separately (typically in user space as 
#blender is normally untarred not installed from repos also blender script dir's keep changing)
rm -rf blendertools

#remove docs they should not be included in the package as they are not part of the package but part of the sources.
#(server documentation)
rm -rf docs

#put the path to shell wrapper for executable
cp  makehuman %{buildroot}%{_bindir}

#move makehuman data files and code
cp -r apps %{buildroot}%{_datadir}/makehuman/
cp -r core %{buildroot}%{_datadir}/makehuman/
cp -r data %{buildroot}%{_datadir}/makehuman/
cp -r shared %{buildroot}%{_datadir}/makehuman/
cp -r icons %{buildroot}%{_datadir}/makehuman/
cp -r lib %{buildroot}%{_datadir}/makehuman/
cp -r license.txt %{buildroot}%{_datadir}/makehuman/
cp -r licenses %{buildroot}%{_datadir}/makehuman/
cp %{buildroot}%{_datadir}/makehuman/
cp -r plugins %{buildroot}%{_datadir}/makehuman/

#check for duplicates, remove them and make symlinks
%fdupes -s %buildroot

#set permissions for python files
find %buildroot -type d -exec chmod 755 {} +
find %buildroot -name '*.py' -type f -exec chmod 755 {} +

# remove all pre-compiled py scripts and compile all py scripts manually for Fedora and Suse 
#(Note: py_byte_compile macro for fedora seems to be only for python3 so using (percent)__python macro)

find %buildroot -name '*.pyc' -type f -exec rm -f {} \;
find %buildroot -name '*.pyo' -type f -exec rm -f {} \;

%if %{defined fedora}

%__python -m compileall %buildroot


%if 0%{?suse_version}
%py_compile %buildroot


# Install desktop file

%if %{defined fedora}
desktop-file-install --dir %{buildroot}%{_datadir}/applications MakeHuman.desktop

%if 0%{?suse_version}
%suse_update_desktop_file -i MakeHuman Graphics 3DGraphics


#install makehuman man page
install -D -m 0644 makehuman.1.gz %{buildroot}%{_mandir}/man1/makehuman.1.gz


%if %{defined fedora}

%files data
%dir %{_datadir}/makehuman

#"(percent)_datadir" is /usr/share
# "(percent)dir" is to only add directory and not subdirs

openSUSE Build Service is sponsored by