File physfs.spec of Package physfs

#
# spec file for package physfs
#
# Copyright (c) 2011 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/
#


%define so_nr 1

Name:           physfs
Version:        to_be_filled_by_service
Release:        3
License:        ZLIB + LGPLv2.1/CPL plus exception
Summary:        PhysicsFS file abstraction layer for games
Url:            http://www.icculus.org/physfs/
Group:          System/Libraries
Source0:        %{name}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM %{name}-2.0.2-gcc46.patch reddwarf@opensuse.org -- Fixes gcc 4.6 compilation. From upstream trunk.
Patch0:         %{name}-2.0.2-gcc46.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
PhysicsFS is a library to provide abstract access to various archives.
It is intended for use in video games, and the design was somewhat
inspired by Quake 3's file subsystem. The programmer defines a "write
directory" on the physical filesystem. No file writing done through the
PhysicsFS API can leave that write directory, for security. For
example, an embedded scripting language cannot write outside of this
path if it uses PhysFS for all of its I/O, which means that untrusted
scripts can run more safely. Symbolic links can be disabled as well,
for added safety. For file reading, the programmer lists directories
and archives that form a "search path". Once the search path is
defined, it becomes a single, transparent hierarchical filesystem. This
makes for easy access to ZIP files in the same way as you access a file
directly on the disk, and it makes it easy to ship a new archive that
will override a previous archive on a per-file basis. Finally,
PhysicsFS gives you platform-abstracted means to determine if CD-ROMs
are available, the user's home directory, where in the real filesystem
your program is running, etc.

%package -n lib%{name}%{so_nr}


Summary:        PhysicsFS file abstraction layer for games
Group:          System/Libraries
# physfs was last used in openSUSE 11.3
Provides:       physfs = %{version}
Obsoletes:      physfs <= 1.0.1

%description -n lib%{name}%{so_nr}
PhysicsFS is a library to provide abstract access to various archives.
It is intended for use in video games, and the design was somewhat
inspired by Quake 3's file subsystem. The programmer defines a "write
directory" on the physical filesystem. No file writing done through the
PhysicsFS API can leave that write directory, for security. For
example, an embedded scripting language cannot write outside of this
path if it uses PhysFS for all of its I/O, which means that untrusted
scripts can run more safely. Symbolic links can be disabled as well,
for added safety. For file reading, the programmer lists directories
and archives that form a "search path". Once the search path is
defined, it becomes a single, transparent hierarchical filesystem. This
makes for easy access to ZIP files in the same way as you access a file
directly on the disk, and it makes it easy to ship a new archive that
will override a previous archive on a per-file basis. Finally,
PhysicsFS gives you platform-abstracted means to determine if CD-ROMs
are available, the user's home directory, where in the real filesystem
your program is running, etc.

%package -n lib%{name}-devel


Summary:        Libraries, includes and more to develop PhysicsFS applications
Group:          Development/Libraries/C and C++
Requires:       lib%{name}%{so_nr} = %{version}
# physfs-devel was last used in openSUSE 11.3
Provides:       physfs-devel = %{version}
Obsoletes:      physfs-devel <= 1.0.1

%description -n lib%{name}-devel
PhysicsFS is a library to provide abstract access to various archives.
It is intended for use in video games, and the design was somewhat
inspired by Quake 3's file subsystem. The programmer defines a "write
directory" on the physical filesystem. No file writing done through the
PhysicsFS API can leave that write directory, for security. For
example, an embedded scripting language cannot write outside of this
path if it uses PhysFS for all of its I/O, which means that untrusted
scripts can run more safely. Symbolic links can be disabled as well,
for added safety. For file reading, the programmer lists directories
and archives that form a "search path". Once the search path is
defined, it becomes a single, transparent hierarchical filesystem. This
makes for easy access to ZIP files in the same way as you access a file
directly on the disk, and it makes it easy to ship a new archive that
will override a previous archive on a per-file basis. Finally,
PhysicsFS gives you platform-abstracted means to determine if CD-ROMs
are available, the user's home directory, where in the real filesystem
your program is running, etc.

%prep
%setup -q
%patch0

%build
# just to be sure...
rm -rf zlib123
mkdir build
cd build
export CFLAGS='%{optflags}'
export CXXFLAGS='%{optflags}'
cmake -DCMAKE_SKIP_RPATH=ON \
      -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DLIB_SUFFIX=$(echo %{_lib} | cut -b4-) \
      -DCMAKE_BUILD_TYPE=Release \
      -DPHYSFS_BUILD_STATIC=FALSE \
      -DPHYSFS_BUILD_TEST=FALSE ..
make %{?_smp_mflags} VERBOSE=1

%install
cd build
make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf %{buildroot}

%post -n lib%{name}%{so_nr} -p /sbin/ldconfig

%postun -n lib%{name}%{so_nr} -p /sbin/ldconfig

%files -n lib%{name}%{so_nr}
%defattr(0644,root,root,0755)
%doc CREDITS.txt INSTALL.txt LICENSE.txt TODO.txt
%{_libdir}/libphysfs.so.%{so_nr}
%{_libdir}/libphysfs.so.%{version}

%files -n lib%{name}-devel
%defattr(0644,root,root,0755)
%{_libdir}/libphysfs.so
%{_includedir}/physfs.h

%changelog
openSUSE Build Service is sponsored by