File OpenSceneGraph1.spec of Package OpenSceneGraph1
#
# spec file for package OpenSceneGraph1
#
# Copyright (c) 2025 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 https://bugs.opensuse.org/
#
# Spec file for OSG.
%define global_version 1.2
%define openthreads_version 1.5.0
%define openthreads_release %{global_release}
%define producer_version 1.1.0
%define producer_release %{global_release}
%define openscenegraph_version %{global_version}
%define apivers 1.0
Name: OpenSceneGraph1
Version: %{openscenegraph_version}
Release: 0
Summary: 3D real-time graphics toolkit
License: LGPL-2.1-only
Group: Development/Libraries/X11
# NOTE: also SUSE-wxWidgets-3.0 http://trac.openscenegraph.org/projects/osg/attachment/wiki/Legal/LICENSE.txt
URL: http://openscenegraph.org/
Source: OpenSceneGraph-%{openscenegraph_version}.tar.bz2
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-abuild.patch adam@mizerski.pl -- Add missing C libraries
Patch0: OpenSceneGraph-1.2-abuild.patch
# PATCH-FEATURE-OPENSUSE OpenSceneGraph-1.2-misc.patch adam@mizerski.pl -- I haven't done it. It adds sonames to libraries, Doxyfiles, and fixes some sources. Looks good :)
Patch1: OpenSceneGraph-1.2-misc.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-missing-sentinel.patch adam@mizerski.pl -- Fix E: OpenSceneGraph missing-sentinel ../ConfigParser.cpp:2269
Patch2: OpenSceneGraph-1.2-missing-sentinel.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-libpng14.patch adam@mizerski.pl -- Make it compatible with libpng14
Patch3: OpenSceneGraph-1.2-libpng14.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-type-qualifiers.patch adam@mizerski.pl -- Not a big change for source, but removes lots of warnings.
Patch4: OpenSceneGraph-1.2-type-qualifiers.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-ignored-typedef.patch adam@mizerski.pl -- Not a big change for source, but removes lots of warnings.
Patch5: OpenSceneGraph-1.2-ignored-typedef.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-makerules_tabs.patch adam@mizerski.pl -- Make doesn't like 8 spaces. He likes tabs.
Patch6: OpenSceneGraph-1.2-makerules_tabs.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-gcc47.patch - gcc 4.7 build fix
Patch7: OpenSceneGraph-1.2-gcc47.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-giflib.patch - patch to work with newer giflib
Patch8: OpenSceneGraph-1.2-giflib.patch
# PATCH-FIX-UPSTREAM fix-boolean-to-pointer.patch - Fix implicit conversation from false to nullptr
Patch9: fix-boolean-to-pointer.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-gcc11.patch - gcc 11 build fix
Patch10: OpenSceneGraph-1.2-gcc11.patch
# PATCH-FIX-UPSTREAM OpenSceneGraph-1.2-gcc11.patch - gcc 15 build fix
Patch11: OpenSceneGraph-1.2-gcc15.patch
BuildRequires: dos2unix
BuildRequires: doxygen
BuildRequires: freeglut-devel
BuildRequires: freetype2-devel
BuildRequires: gcc-c++
BuildRequires: giflib-devel
BuildRequires: libXmu-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: pkg-config
BuildRequires: unzip
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
The OpenSceneGraph is a 3D graphics toolkit, used in fields such as
visual simulation, games, virtual reality, scientific visualization
and modelling.
%package -n OpenSceneGraph1-plugins
Version: %{openscenegraph_version}
Release: 0
Summary: Plugins for OpenSceneGraph
Group: Development/Libraries/X11
URL: http://openscenegraph.org/
Provides: OpenSceneGraph-plugins = %{openscenegraph_version}
%description -n OpenSceneGraph1-plugins
Plugins for OpenSceneGraph, a 3D graphics toolkit.
%package examples
Version: %{openscenegraph_version}
Release: 0
Summary: Example programs for OpenSceneGraph
Group: Development/Libraries/X11
URL: http://openscenegraph.org/
%description examples
Examples for OpenSceneGraph, a 3D graphics toolkit.
%package -n libOpenSceneGraph1
Version: %{openscenegraph_version}
Release: 0
Summary: 3D graphics toolkit
Group: System/Libraries
URL: http://openscenegraph.org/
%description -n libOpenSceneGraph1
The OpenSceneGraph is a 3D graphics toolkit, used in fields such as
visual simulation, games, virtual reality, scientific visualization
and modelling.
%package -n libOpenSceneGraph1-devel
Version: %{openscenegraph_version}
Release: 0
Summary: The Open Scene Graph Headers
Group: Development/Libraries/X11
URL: http://openscenegraph.org/
Requires: Mesa-devel
Requires: gcc-c++
Requires: libOpenSceneGraph1
Requires: libOpenThreads1-devel
Requires: libProducer1-devel
Provides: libOpenSceneGraph-devel = %{global_version}
Conflicts: libOpenSenceGraph-devel
%description -n libOpenSceneGraph1-devel
The header files and libraries needed for developing VR applications using
Open Scene Graph.
%package -n libOpenThreads1
Version: %{openthreads_version}
Release: 0
Summary: Object-oriented threading library
Group: System/Libraries
URL: http://openthreads.sourceforge.net/
%description -n libOpenThreads1
OpenThreads is an object-oriented threading library.
%package -n libOpenThreads1-devel
Version: %{openthreads_version}
Release: 0
Summary: The OpenThreads Headers
Group: Development/Libraries/X11
URL: http://openthreads.sourceforge.net/
Requires: gcc-c++
Requires: glibc-devel
Requires: libOpenThreads1
Provides: libOpenThreads-devel = %{openthreads_version}
%description -n libOpenThreads1-devel
The header files and libraries needed for developing programs using
OpenThreads.
%package -n libProducer1
Version: %{producer_version}
Release: 0
Summary: A graphics windowing toolkit
Group: System/Libraries
URL: http://andesengineering.com/Producer/
%description -n libProducer1
Open Producer is a graphics windowing toolkit.
%package -n libProducer1-devel
Version: %{producer_version}
Release: 0
Summary: Development files for OpenProducer
Group: Development/Libraries/X11
URL: http://andesengineering.com/Producer/
Requires: Mesa-devel
Requires: gcc-c++
Requires: libOpenSceneGraph1-devel
Requires: libOpenThreads1-devel
Requires: libProducer1
Requires: xorg-x11-libX11-devel
Requires: xorg-x11-proto-devel
Provides: libProducer-devel = %{producer_version}
%description -n libProducer1-devel
The header files and libraries needed for developing programs using Open
Producer.
%prep
# For now don't keep unpacking
%setup -q -n OpenSceneGraph-%{openscenegraph_version}
%autopatch -p1
# backup, we hack this file later
cp OpenSceneGraph/Make/dependencies OpenSceneGraph/Make/dependencies.bak
# Propagate RPM_OPT_FLAGS
for file in OpenSceneGraph/src/osgWrappers/*/GNUmakefile; do
sed -i -e '/^OPTF.*$/d' $file
done
#make the build faster
for dir in OpenThreads Producer OpenSceneGraph; do
sed -i -e 's,$(MAKE) $@,$(MAKE) $@ %{?_smp_mflags},g' $dir/Make/makedirrules
done
for dir in OpenThreads Producer OpenSceneGraph; do
# Add DESTDIR
# Remove bogus -lstdc++
# Install examples to %%{_bindir}
sed -i \
-e 's,^\(INST_LOCATION[ ]*?=\).*$,\1 $(DESTDIR)%{_prefix},g' \
-e 's,^\(INST_INCLUDE[ ]*=\).*$,\1 $(DESTDIR)%{_includedir},g' \
-e 's,^\(INST_SHARE[ ]*=\).*$,\1 $(DESTDIR)%{_datadir},g' \
-e 's,^\(INST_LIBS[ ]*=\).*$,\1 $(DESTDIR)%{_libdir},g' \
-e 's,^\(INST_EXAMPLES[ ]*=\).*$,\1 $(DESTDIR)%{_bindir},g' \
-e 's,\(^[ \t]*LIBS[ ]*=.*\) -lstdc++,\1,g' \
-e 's, -lXi,,g' \
-e 's,^\([ ]*LDFLAGS.*soname.*$\),# \1,g' \
$dir/Make/makedefs
# Propagate RPM_OPT_FLAGS
echo "OPTF =%{optflags} -fno-strict-aliasing" >> $dir/Make/makedefs
# Fix quoting bug
sed -i \
-e 's, DOF=$(OPTF) , "DOF=$(OPTF)" ,g' \
$dir/Make/makerules
# Fix broken shell fragments
sed -i \
-e 's,do\\,do \\,g' \
-e 's,else\\,else \\,g' \
-e 's,fi\\,fi;\\,g' \
-e 's,done\\,done;\\,g' \
-e 's,then\\,then \\,g' \
$dir/Make/*rules
find $dir -name GNUmakefile -exec grep -l '^[ ]*LIB[ ]*=' {} \; | \
xargs sed -i \
-e 's,\(^include.*makedefs\)[ ]*$,\1\ninclude \$(TOPDIR)/Make/libdefs,'
# Fix libdir
sed -i \
-e 's,^prefix=.*$,prefix = %{_prefix},' \
-e 's,^includedir=.*$,includedir = %{_includedir},' \
-e 's,^libdir=.*$,libdir = %{_libdir},' \
-e 's,^Version:.*$,Version: %{apivers},' \
-e '/^Conflicts:$/d' \
$dir/Make/$(echo $dir | tr [:upper:] [:lower:]).pc
done
find . -name "*.txt" -exec dos2unix "{}" "+"
%build
%ifarch x86_64
export LD_LIBRARY_PATH="$PWD/Producer/lib/Linux64:$PWD/OpenThreads/lib/Linux64"
%else
export LD_LIBRARY_PATH="$PWD/Producer/lib/Linux32:$PWD/OpenThreads/lib/Linux32"
%endif
echo "# Fedora custom settings" > OpenSceneGraph/Make/dependencies
echo "COMPILE_EXAMPLES = yes" >> OpenSceneGraph/Make/dependencies
echo "GLUT_INSTALLED = yes" >> OpenSceneGraph/Make/dependencies
echo >> OpenSceneGraph/Make/dependencies
cat OpenSceneGraph/Make/dependencies.bak >> OpenSceneGraph/Make/dependencies
export CXXFLAGS="$RPM_OPT_FLAGS"
export CFLAGS="$CXXFLAGS"
for dir in OpenThreads Producer OpenSceneGraph; do
make -C $dir \
COMPILE_OSG_OP_OT_WITH_SONAMES=YES \
OPENTHREADS_INC_DIR="$PWD/OpenThreads/include" \
OPENTHREADS_LIB_DIR="$PWD/OpenThreads/lib/\$(OS)\$(ARCH)" \
PRODUCER_INC_DIR="$PWD/Producer/include" \
PRODUCER_LIB_DIR="$PWD/Producer/lib/\$(OS)\$(ARCH)" \
ARCH_EXT=%{arch_ext} \
COIN_INSTALLED=no \
%{?_smp_mflags}
done
doxygen -u OpenThreads/dist/debian/Doxyfile-openthreads
doxygen OpenThreads/dist/debian/Doxyfile-openthreads
doxygen -u OpenSceneGraph/dist/debian/Doxyfile-openscenegraph
doxygen OpenSceneGraph/dist/debian/Doxyfile-openscenegraph
doxygen -u Producer/dist/debian/Doxyfile-producer
doxygen Producer/dist/debian/Doxyfile-producer
%install
%ifarch x86_64
export LD_LIBRARY_PATH="$PWD/Producer/lib/Linux64:$PWD/OpenThreads/lib/Linux64"
%else
export LD_LIBRARY_PATH="$PWD/Producer/lib/Linux32:$PWD/OpenThreads/lib/Linux32"
%endif
for dir in OpenThreads Producer OpenSceneGraph; do
make -C $dir \
COMPILE_OSG_OP_OT_WITH_SONAMES="YES" \
OPENTHREADS_INC_DIR="$PWD/OpenThreads/include" \
OPENTHREADS_LIB_DIR="$PWD/OpenThreads/lib/\$(OS)\$(ARCH)" \
PRODUCER_INC_DIR="$PWD/Producer/include" \
PRODUCER_LIB_DIR="$PWD/Producer/lib/\$(OS)\$(ARCH)" \
ARCH_EXT=%{arch_ext} \
COIN_INSTALLED=no \
DESTDIR=%{buildroot} \
INST_PLUGINS=%{buildroot}%{_libdir}/osgPlugins-%{global_version} \
install
done
rm -rf %{buildroot}%{_datadir}/OpenSceneGraph/src
# HACK ALERT: This should be fixed inside of the makefiles.
# fix up shared library symlinks
pushd %{buildroot}%{_libdir} > /dev/null
for i in lib*.so; do
if test -f $i; then
rm -f $i.*
soname=$(objdump -p $i | grep SONAME | sed 's,[ ]*SONAME[ ]*,,')
mv $i $soname
ln -s $soname $i
fi
done
popd > /dev/null
/sbin/ldconfig -Nn %{buildroot}%{_libdir}
install -m 644 -D OpenThreads/Make/openthreads.pc %{buildroot}%{_libdir}/pkgconfig/openthreads.pc
install -m 644 -D OpenSceneGraph/Make/openscenegraph.pc %{buildroot}%{_libdir}/pkgconfig/openscenegraph.pc
install -m 644 -D Producer/Make/producer.pc %{buildroot}%{_libdir}/pkgconfig/producer.pc
%post -n libOpenSceneGraph1 -p /sbin/ldconfig
%postun -n libOpenSceneGraph1 -p /sbin/ldconfig
%post -n libOpenThreads1 -p /sbin/ldconfig
%postun -n libOpenThreads1 -p /sbin/ldconfig
%post -n libProducer1 -p /sbin/ldconfig
%postun -n libProducer1 -p /sbin/ldconfig
%files -n OpenSceneGraph1-plugins
%defattr(-, root, root)
%{_libdir}/osgPlugins-%{global_version}/
%files -n libOpenSceneGraph1
%defattr(-, root, root)
%{_libdir}/libosg*.so.1
%files -n libOpenSceneGraph1-devel
%defattr(-, root, root)
%{_libdir}/libosg*.so
%{_includedir}/osg*
%{_libdir}/pkgconfig/openscenegraph.pc
%files -n libOpenThreads1
%defattr(-, root, root)
%{_libdir}/libOpenThreads.so.1
%doc OpenThreads/*.txt OpenThreads/ChangeLog
%files -n libOpenThreads1-devel
%defattr(-, root, root)
%{_libdir}/libOpenThreads.so
%{_includedir}/OpenThreads/
%{_libdir}/pkgconfig/openthreads.pc
%files -n libProducer1
%defattr(-, root, root)
%{_libdir}/libProducer.so.1
%doc Producer/*.txt
%files -n libProducer1-devel
%defattr(-, root, root)
%{_libdir}/libProducer.so
%{_includedir}/Producer/
%{_libdir}/pkgconfig/producer.pc
%files
%defattr(-, root, root)
%{_bindir}/osgarchive
%{_bindir}/osgconv
%{_bindir}/osgversion
%{_bindir}/osgviewer
%doc OpenThreads/*.txt OpenThreads/ChangeLog
%files examples
%defattr(-, root, root)
%exclude %{_bindir}/osgarchive
%exclude %{_bindir}/osgconv
%exclude %{_bindir}/osgversion
%exclude %{_bindir}/osgviewer*
%{_bindir}/*
%changelog