File cg.spec of Package cg

#
# spec file for package cg (Version 2.2)
#
# Copyright (c) 2010 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/object/cg_toolkit.html
License:        PERMISSIVE-OSI-COMPLIANT
Group:          Development/Tools/Other
BuildRequires:  fdupes freeglut-devel
AutoReqProv:    on
Version:        2.2
Release:        5
%define fileversion 2.2_February2010
Summary:        Compiler and Runtime Libraries for the Cg Graphics Language
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64
Obsoletes:      Cg <= %{version}
Provides:       Cg = %{version}
Source:         Cg-%{fileversion}_x86.tar.bz2
Source1:        Cg-%{fileversion}_x86_64.tar.bz2
# Source100:      filter-requires.sh
# # Workaround for ELF files linked against libGLU.so, without versioning. Remove once nvidia fixes it.
# %%global _use_internal_dependency_generator 0
# %%global __find_requires /bin/sh %{S:100}
# # script contents: /usr/lib/rpm/find-requires | sed '/libGLU\.so/d'
# # Fixed now by rebuilding cgfxcat
%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:        NON-OSI-COMPLIANT(royalties)
Summary:        Development documentation and examples for the Cg graphics language
Group:          Development/Tools/Other
Requires:       %name = %version
Requires:       Mesa-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.tar.bz2

%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 usr/share %buildroot/usr/
cp -a usr/local/Cg/. %buildroot%_defaultdocdir/%name/
mkdir -p %buildroot/usr/lib/%name
# Commented as a workaround for ELF files linked against libGLU.so, without versioning. Remove once nvidia fixes it.
#mv %buildroot%_defaultdocdir/%name/examples %buildroot/usr/lib/%name/
rm -R %buildroot%_defaultdocdir/%name/examples
rm %buildroot%_defaultdocdir/%name/include/GL/glext.h
rm %buildroot%_defaultdocdir/%name/docs/CgReferenceManual.chm
rmdir %buildroot%_defaultdocdir/%name/include/GL %buildroot%_defaultdocdir/%name/include
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
%fdupes %buildroot/usr/lib/cg/examples

%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
%_mandir/man3/*.3.gz
%dir %_mandir/manCg
%_mandir/manCg/*.Cg.gz
%dir %_mandir/manCgFX
%_mandir/manCgFX/*.CgFX.gz
%_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/html
%dir /usr/lib/%name
#/usr/lib/%name/examples

%changelog