File cg.spec of Package cg

#
# spec file for package cg (Version 3.1)
#
# Copyright (c) 2012 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 http://bugs.opensuse.org/
#



Name:           cg
Url:            http://developer.nvidia.com/cg-toolkit
License:        SUSE-NonFree and GPL-2.0+
Group:          Development/Tools/Other
%if 0%{?suse_version}
BuildRequires:  fdupes
%endif
BuildRequires:  freeglut-devel
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xmu)
AutoReqProv:    on
Version:        3.1.0013
Release:        1
%define fileversion 3.1_April2012
Summary:        C for Graphics
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64
Obsoletes:      Cg < %{version}
Provides:       Cg = %{version}
Source:         Cg-%{fileversion}_x86.tgz
Source1:        Cg-%{fileversion}_x86_64.tgz
%if "%_arch" == "i386"
%define CgArch x86
%else
%define CgArch %_arch
%endif

%description
The Cg Toolkit provides a compiler for the Cg language, runtime
libraries for use with both leading graphics APIs, runtime libraries
for CgFX, example applications, and extensive documentation. Supporting
over 24 different OpenGL and DirectX profile targets, Cg will allow you
to incorporate stunning interactive effects into your 3D applications.

The runtime package contains the compiler and runtime libraries only.



Authors:
--------
    NVIDIA

%package devel
License:        SUSE-NonFree and GPL-2.0+
Summary:        Development documentation and examples for C for Graphics
Group:          Development/Tools/Other
Requires:       %name = %version
Requires:       Mesa-devel
Requires:       pkgconfig(glu)
Requires:       pkgconfig(gl)
Requires:       freeglut-devel
Obsoletes:      Cg-devel < %{version}
Provides:       Cg-devel = %{version}
AutoReqProv:    on

%description devel
The Cg Toolkit provides a compiler for the Cg language, runtime
libraries for use with both leading graphics APIs, runtime libraries
for CgFX, example applications, and extensive documentation. Supporting
over 24 different OpenGL and DirectX profile targets, Cg will allow you
to incorporate stunning interactive effects into your 3D applications.

The development package contains the complete documentation and example
files. The Cg compiler is part of the runtime package, as some external
application may need it.



Authors:
--------
    NVIDIA

%prep
%setup -q -n . -D -T
tar -xf %_sourcedir/Cg-%{fileversion}_%CgArch.tgz
# this is redundant and breaks dependencies for libGL.so.1 and libglut.so.3 in other packages
rm usr/local/Cg/examples/Trace/*.so*

%build
cp -a usr/local/Cg/examples/Tools/cgfxcat cgfxcat
cd cgfxcat
make CFLAGS="$RPM_OPT_FLAGS -I../usr/include -I../usr/local/Cg/examples/OpenGL/glew/include -L../usr/lib64 -L../usr/lib"
cd -
cp cgfxcat/cgfxcat usr/bin/

%install
mkdir -p %buildroot/usr %buildroot%_defaultdocdir/%name/docs
cp -a usr/bin usr/%_lib usr/include %buildroot/usr/
cp -a usr/local/Cg/. %buildroot%_defaultdocdir/%name/
mkdir -p %buildroot/usr/lib/%name
mv %buildroot%_defaultdocdir/%name/examples %buildroot/usr/lib/%name/
sed -i "s@/usr/local/Cg@%_defaultdocdir/cg@g" %buildroot%_defaultdocdir/%name/README
sed -i "s@/usr/local/Cg@%_defaultdocdir/cg@g" %buildroot%_defaultdocdir/%name/MANIFEST
%if 0%{?suse_version}
%fdupes %buildroot/usr/lib/cg/examples
%endif

%files
%defattr(-, root, root)
%_bindir/cgc
%_bindir/cgfxcat
%_bindir/cginfo
%_libdir/libCg.so
%_libdir/libCgGL.so
%dir %_defaultdocdir/%name
%_defaultdocdir/%name/README
%_defaultdocdir/%name/MANIFEST
%dir %_defaultdocdir/%name/docs
%_defaultdocdir/%name/docs/license.*
%_defaultdocdir/%name/docs/Cg-2.0.pdf
%_defaultdocdir/%name/docs/CgUsersManual.pdf

%files devel
%defattr(-, root, root)
%dir %_includedir/Cg
%_includedir/Cg/*.h
%_defaultdocdir/%name/docs/CgFX_bumpdemo_Tutorial.pdf
%_defaultdocdir/%name/docs/CgReferenceManual.pdf
%_defaultdocdir/%name/docs/CgReleaseNotes.pdf
%_defaultdocdir/%name/docs/Cg_bumpdemo_Tutorial.pdf
%_defaultdocdir/%name/docs/CgReferenceManual.chm
%_defaultdocdir/%name/docs/html
%dir /usr/lib/%name
/usr/lib/%name/examples

%changelog
openSUSE Build Service is sponsored by