File gazebo11.spec of Package gazebo11

#
# spec file for package gazebo
#
# Copyright (c) 2018 SUSE LINUX 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 http://bugs.opensuse.org/
#

%define srcname gazebo
%define major 11
%define ogre_plugindir %(pkg-config --variable=plugindir OGRE)
%define ogre_plugins %(readlink -qne %{ogre_plugindir}/RenderSystem_GL.so)
%define include_qwt %(pkg-config --variable=includedir Qt5Qwt6)
%define prepath_qwt %(basename %{include_qwt})
%bcond_with dart
%bcond_with xslt
%bcond_with openal
%bcond_with simbody
%bcond_without localtest
Name:           gazebo%{major}
Version:        11.10.2
Release:        0
Summary:        Open Source Robotics Simulator
License:        Apache-2.0
Group:          Productivity/Scientific/Other
URL:            https://github.com/osrf/gazebo.git
Source0:        %{srcname}-%{version}.tar.gz
Patch0:         gazebo11-qt5-moc-for-cmake-3_17-or-newer.patch
Patch1:         gazebo11-qwt-link.patch
Patch2:         gazebo11_remove_rpath.patch
BuildRequires:  %{rb_default_ruby_suffix}-rubygem-ronn
BuildRequires:  ImageMagick
BuildRequires:  bash-completion
BuildRequires:  cmake
BuildRequires:  cppzmq-devel
BuildRequires:  desktop-file-utils
BuildRequires:  fcl-devel
BuildRequires:  fdupes
BuildRequires:  freeimage-devel
BuildRequires:  gcc-c++
BuildRequires:  hdf5-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  ignition-cmake2
BuildRequires:  libOgreMain-plugins
BuildRequires:  libboost_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_iostreams-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  libspnav-devel
BuildRequires:  libtar-devel
BuildRequires:  pkgconfig
BuildRequires:  tbb-devel
BuildRequires:  tinyxml-devel
BuildRequires:  update-desktop-files
BuildRequires:  sdformat9-devel
BuildRequires:  dart-collision-bullet-devel
BuildRequires:  dart-collision-ode-devel
BuildRequires:  dart-utils-urdf-devel
BuildRequires:  tbb-devel
BuildRequires:  doxygen
BuildRequires:  pkgconfig(assimp)
BuildRequires:  pkgconfig(OGRE)
BuildRequires:  pkgconfig(dart)
BuildRequires:  pkgconfig(octomap)
BuildRequires:  pkgconfig(OGRE-Overlay)
BuildRequires:  pkgconfig(OGRE-Paging)
BuildRequires:  pkgconfig(OGRE-RTShaderSystem)
BuildRequires:  pkgconfig(OGRE-Terrain)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5Qwt6)
BuildRequires:  pkgconfig(Qt5Test)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(bullet)
BuildRequires:  pkgconfig(ccd)
BuildRequires:  pkgconfig(gdal)
BuildRequires:  pkgconfig(gts)
BuildRequires:  pkgconfig(ignition-fuel_tools4)
BuildRequires:  pkgconfig(ignition-math6)
BuildRequires:  pkgconfig(ignition-msgs5)
BuildRequires:  pkgconfig(ignition-transport8)
BuildRequires:  pkgconfig(jsoncpp)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavdevice)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libcgraph)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libprofiler)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(libtcmalloc)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(protobuf)
BuildRequires:  pkgconfig(tinyxml2)
BuildRequires:  pkgconfig(uuid)
Requires:       sdformat9-sdf
Requires:       %(rpm -qf %{ogre_plugins} --qf '%%{NAME} >= %%{VERSION}')
Requires:       %{name}-common = %{version}
Recommends:     %{name}-plugin-base = %{version}
Recommends:     ignition-fuel-tools-config
Conflicts:      otherproviders(gazebo)
Provides:       gazebo = %{version}
Obsoletes:      gazebo < %{version}
# SECTION operator
%{!?with_dart:BuildRequires:    freeglut-devel}
%{!?with_dart:BuildRequires:    pkgconfig(dart) >= 6.0.0}
%{!?with_dart:BuildRequires:    pkgconfig(xi)}
%{!?with_xslt:BuildRequires:    pkgconfig(libxslt)}
%{!?with_openal:BuildRequires:  pkgconfig(openal)}
%{!?with_simbody:BuildRequires: pkgconfig(simbody)}
# /SECTION

%description
Gazebo is a multi-robot simulator for outdoor environments. Like Stage
(part of the Player project), it is capable of simulating a population of
robots, sensors and objects, but does so in a three-dimensional world. It
generates both realistic sensor feedback and physically plausible
interactions between objects (it includes an accurate simulation of
rigid-body physics).

%package -n     libgazebo%{major}
Summary:        C++ library for %{name}
Group:          System/Libraries

%description -n libgazebo%{major}
Gazebo is a multi-robot simulator for outdoor environments. Like Stage
(part of the Player project), it is capable of simulating a population of
robots, sensors and objects, but does so in a three-dimensional world. It
generates both realistic sensor feedback and physically plausible
interactions between objects (it includes an accurate simulation of
rigid-body physics).

This package contains the shared library.

%package        plugin-base
Summary:        Base plug-ins for %{name}
Group:          System/Libraries
Requires:       %{name} = %{version}

%description    plugin-base
Open Source Robotics Simulator.

This package contains plugins.

%package        common
Summary:        Shared files for %{name}
Group:          Productivity/Scientific/Other
Requires:       %{name} = %{version}
Requires:       dejavu-fonts

%description    common
Open Source Robotics Simulator.

This package contains shared files such as 3d models, worlds and robots.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       libgazebo%{major} = %{version}
Requires:       tbb-devel
Requires:       libbullet-devel
Requires:       simbody-devel
Requires:       dart-devel
Requires:       dart-collision-bullet-devel
Requires:       dart-collision-ode-devel
Requires:       dart-utils-urdf-devel
Requires:       libboost_iostreams-devel
Requires:       libOgreMain-devel
Requires:       libOgreOverlay-devel
Requires:       libOgrePaging-devel
Requires:       libOgreProperty-devel
Requires:       libOgreRTShaderSystem-devel
Requires:       libOgreTerrain-devel
Requires:       libOgreVolume-devel
Requires:       pkgconfig
Requires:       pkgconfig(libavcodec)
Requires:       pkgconfig(libavdevice)
Requires:       pkgconfig(libavformat)
Requires:       pkgconfig(libavutil)

%description    devel
Open Source Robotics Simulator.

This package contains the header files and libraries needed to develop
application that use %{name}.

%prep
%setup -q -n %{srcname}-%{version}
%patch0 -p0
%patch1 -p0
%patch2 -p0

# Fix incorrect sRGB profile
find . -type f -name \*.png -exec convert {} -strip {} \;
#for _file in $(find . -type f -name \*.png); do
#    echo $_file
#    convert $_file -strip $_file
#done
# Disable quiet mode
#sed -i '/[.0-9]\+/s/\ QUIET//' cmake/SearchForStuff.cmake
# Change path to 'include' of qwt
#sed -e '/^\#include/s/qwt\//%{prepath_qwt}\//' \
#    -i $(grep -rl '^#include.*qwt\/')

%build
export CFLAGS="%{optflags} -pthread"
%ifarch %{ix86}
export CFLAGS="${CFLAGS} -msse2 -mfpmath=sse"
%endif
export CXXFLAGS="${CFLAGS}"
%cmake \
    -DCMAKE_INSTALL_LIBDIR=%{_lib} \
    -DUSE_HOST_CFLAGS=OFF \
    -DUSE_UPSTREAM_CFLAGS=OFF \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${CXXFLAGS}" \
    -DUSE_LOW_MEMORY_TESTS=ON \
    -DFORCE_GRAPHIC_TESTS_COMPILATION=ON \
    -DENABLE_SCREEN_TESTS=OFF \
    -DQWT_INCLUDE_DIR:PATH="%{include_qwt}" \
    -LA

# Out of memory: remove %%{?_smp_mflags}
make -j2 VERBOSE=1

%install
%cmake_install

install -Dm0644 \
  tools/gazebo.bash-completion \
  %{buildroot}%{_datadir}/bash-completion/completions/gazebo

install -Dm0644 {gazebo/gui/images/,%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/}gazebo.svg
%suse_update_desktop_file -c gazebo Gazebo "3D Robot simulator" gazebo gazebo Development X-SuSE-Core-Development

find %{buildroot} -type f -name \*.a -delete -print

%fdupes %{buildroot}%{_datadir}

%check
%if !%{with localtest}
    sed -i '/ctest/s|\(bin/ctest\)|\1 -V|' $(grep -rl '\ctest')
    make -j1 test -C build || :
%endif

%pre
if [ "$1" -eq 1 ] ; then
    grep ^flags /proc/cpuinfo | grep -qs sse2
    if [ $? -ne 0 ]; then
        echo "This computer cannot run gazebo because its hardware is no longer supported." 1>&2
        exit 1
    fi
fi

%post -n libgazebo%{major} -p /sbin/ldconfig
%postun -n libgazebo%{major} -p /sbin/ldconfig

%files
%license COPYING LICENSE
%doc AUTHORS Changelog.md
%{_bindir}/gazebo*
%{_bindir}/gz*
%{_datadir}/gazebo/
%dir %{_datadir}/gazebo-%{major}
%{_datadir}/gazebo-%{major}/*.sh
%{_datadir}/gazebo-%{major}/*.bash
%{_datadir}/icons/hicolor/*/apps/gazebo.svg
%{_datadir}/applications/gazebo.desktop
%{_datadir}/bash-completion/completions/gazebo
%{_mandir}/man?/gazebo.?%{ext_info}
%{_mandir}/man?/gz.?%{ext_info}
%{_mandir}/man?/gzclient.?%{ext_info}
%{_mandir}/man?/gzprop.?%{ext_info}
%{_mandir}/man?/gzserver.?%{ext_info}

%files -n libgazebo%{major}
%defattr(-,root,root)
%{_libdir}/libgazebo*.so.*

%files plugin-base
%defattr(-,root,root)
%dir %{_libdir}/gazebo-%{major}
%dir %{_libdir}/gazebo-%{major}/plugins
%{_libdir}/gazebo-%{major}/plugins/*.so

%files common
%defattr(-,root,root)
%dir %{_datadir}/gazebo-%{major}/media
%dir %{_datadir}/gazebo-%{major}/models
%dir %{_datadir}/gazebo-%{major}/worlds
%{_datadir}/gazebo-%{major}/media/*
%{_datadir}/gazebo-%{major}/models/*
%{_datadir}/gazebo-%{major}/worlds/*

%files devel
%defattr(-,root,root)
%{_includedir}/gazebo-%{major}/
%{_libdir}/pkgconfig/gazebo.pc
%{_libdir}/pkgconfig/gazebo_ode.pc
%{_libdir}/pkgconfig/gazebo_transport.pc
%{_libdir}/libgazebo*.so
%dir %{_libdir}/cmake/gazebo
%{_libdir}/cmake/gazebo/*.cmake

%changelog

openSUSE Build Service is sponsored by