File ocp.spec of Package ocp
# rpm spec file for RedHat / Fedora linux
%define name ocp
%define version 0.1.21
%define _without_libmad ""
# Default to _with_libmad if neither _with_libmad or _without_libmad is defined
%{!?_with_libmad: %{!?_without_libmad: %define _with_libmad --with-libmad}}
# Error if both _with_libmad and _without_libmad is defined
%{?_with_libmad: %{?_without_libmad: %{error: both _with_libmad and _without_libmad}}}
Name: %{name}
Version: %{version}
Release: 0
Summary: Linux port of Open Cubic Player
Group: Productivity/Multimedia/Sound/Players
URL: http://stian.cubic.org/coding-ocp.php
Buildroot: /var/tmp/ocp-buildroot
Source0: http://stian.cubic.org/ocp/%{name}-%{version}.tar.bz2
Source1: ftp://ftp.cubic.org/pub/player/gfx/opencp25image1.zip
Source2: ftp://ftp.cubic.org/pub/player/gfx/opencp25ani1.zip
Patch0: configure.patch
Patch1: makeinfo.patch
License: GPL-2, Creative Commons Attribution 3.0
# OCP itself is GPL-2
# The extra data provided is Creative Commons Attribute 3.0
%if 0%{?suse_version}
#suse doesn't have libXpm
BuildRequires: ncurses-devel zlib-devel libSDL-devel libogg-devel libvorbis-devel libsidplay1-devel gcc >= 3.0-0 gcc-c++ >= 3.0-0 flac-devel texinfo desktop-file-utils hicolor-icon-theme unzip texinfo update-desktop-files libncurses5 libncurses6 libXpm-devel libXxf86vm-devel alsa-devel libadplug-devel
PreReq: %install_info_prereq
%else
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: ncurses-devel zlib-devel adplug-devel SDL-devel libogg-devel libvorbis-devel libsidplayfp-devel gcc >= 3.0-0 gcc-c++ >= 3.0-0 flac-devel desktop-file-utils hicolor-icon-theme libXpm-devel unzip texinfo libXxf86vm-devel alsa-lib-devel
%else
BuildRequires: ncurses-devel zlib-devel adplug-devel libSDL-devel libogg-devel libvorbis-devel libsidplay-devel gcc >= 3.0-0 gcc-c++ >= 3.0-0 flac-devel desktop-file-utils hicolor-icon-theme libXpm-devel unzip texinfo
%endif
%endif
# Include libmad if given
%{?_with_libmad:BuildRequires: libmad-devel}
%description
Open Cubic Player is a music player ported from DOS. Provides a nice text-based
frontend, with some few optional features in graphical. Plays modules, sids,
wave and mp3
%prep
%setup -q -n %{name}-%{version}
%patch -P 0 -P 1 -p1
unzip $RPM_SOURCE_DIR/opencp25image1.zip
unzip -o $RPM_SOURCE_DIR/opencp25ani1.zip
%build
CFLAGS=$RPM_OPT_FLAGS CXXFLAGS=$RPM_OPT_FLAGS ./configure --prefix=%{_prefix} --exec_prefix=%{_exec_prefix} --infodir=%{_infodir} --sysconfdir=/etc %{?_with_libmad} %{?_without_libmad} --without-adplug --with-x11 --build %{_arch}
make
%post
%if 0%{?suse_version}
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%else
if [ "$1" = "1" ] ; then # first install
if [ -x /sbin/install-info ]; then
install-info --info-dir=%{_infodir} %{_infodir}/ocp.info.gz || true
fi
fi
%endif
%if 0%{?suse_version} >= 1140
%desktop_database_post
%icon_theme_cache_post hicolor
%endif
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
# Assembler optimizations for x86 requires relocations, so please tell SELinux this if possible
%ifarch i386 i486 i586 i686 x86
if [ -x /usr/bin/chcon ]; then
chcon -t textrel_shlib_t %{_exec_prefix}/lib/ocp-%{version}/devwmix.so %{_exec_prefix}/lib/ocp-%{version}/devwmixf.so %{_exec_prefix}/lib/ocp-%{version}/autoload/10-mixclip.so %{_exec_prefix}/lib/ocp-%{version}/autoload/30-mcpbase.so
fi
%endif
%endif
%preun
%if 0%{?suse_version}
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%else
if [ "$1" = "0" ] ; then # last uninstall
if [ -x /sbin/install-info ]; then
install-info --delete --info-dir=%{_infodir} %{_infodir}/ocp.info.gz || true
fi
fi
%endif
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}/etc
%__mv "%{buildroot}%{_prefix}/share/ocp-%{version}/etc/ocp.ini" \
"%{buildroot}/etc/ocp.ini"
%__mv "%{buildroot}%{_datadir}/applications/cubic.org-opencubicplayer.desktop" \
"%{buildroot}%{_datadir}/applications/%{name}.desktop"
#%%__cp "%%{buildroot}%%{_datadir}/applications/cubic.org-opencubicplayer.desktop" \
# "%%{buildroot}%%{_datadir}/applications/opencubicplayer.desktop"
%if 0%{?suse_version}
%suse_update_desktop_file -c ocp OpenCubicPlayer "Open Cubic Player" ocp opencubicplayer AudioVideo Player
%endif
mkdir -p %{buildroot}%{_prefix}/share/ocp-%{version}/data
cp CP* %{buildroot}%{_prefix}/share/ocp-%{version}/data
rm -f %{buildroot}/%{_infodir}/dir
%postun
%if 0%{?suse_version} >= 1140
%desktop_database_postun
%icon_theme_cache_postun hicolor
%endif
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%config /etc/ocp.ini
#%%{_prefix}/share/ocp-%%{version}/etc/ocp.ini
%{_exec_prefix}/lib/ocp-%{version}
%{_prefix}/bin/ocp-%{version}
%{_prefix}/bin/ocp
%{_prefix}/bin/ocp-curses
%{_prefix}/bin/ocp-sdl
%{_prefix}/bin/ocp-vcsa
%{_prefix}/bin/ocp-x11
%{_prefix}/bin/ultrafix.sh
%{_infodir}/ocp.info.gz
%{_prefix}/share/icons/*/*/apps/opencubicplayer.*
%{_prefix}/share/applications/*.desktop
%dir %{_prefix}/share/ocp-%{version}
%dir %{_prefix}/share/ocp-%{version}/data
#%%dir %%{_prefix}/share/ocp-%%{version}/etc
%{_prefix}/share/ocp-%{version}/data
%docdir %{_prefix}/share/doc/ocp-%{version}
%{_prefix}/share/doc/ocp-%{version}
%changelog