1# rpm spec file for RedHat / Fedora linux
2
3%define name ocp
4%define version 0.2.1
5
6# Default to _with_libmad if neither _with_libmad or _without_libmad is defined
7%{!?_with_libmad: %{!?_without_libmad: %define _with_libmad --with-libmad}}
8
9# Error if both _with_libmad and _without_libmad is defined
10%{?_with_libmad: %{?_without_libmad: %{error: both _with_libmad and _without_libmad}}}
11
12Name: %{name}
13Version: %{version}
14Release: 0
15Summary: Linux port of Open Cubic Player
16Group: Applications/Multimedia
17URL: http://stian.cubic.org/coding-ocp.php
18Buildroot: /var/tmp/ocp-buildroot
19Source0: http://stian.cubic.org/ocp/%{name}-%{version}.tar.bz2
20Source1: ftp://ftp.cubic.org/pub/player/gfx/opencp25image1.zip
21Source2: ftp://ftp.cubic.org/pub/player/gfx/opencp25ani1.zip
22License: GPL-2, Creative Commons Attribution 3.0
23# OCP itself is GPL-2
24# The extra data provided is Creative Commons Attribute 3.0
25
26%if 0%{?suse_version}
27#suse doesn't have libXpm
28BuildRequires: ncurses-devel zlib-devel libadplug-devel libSDL2-devel libogg-devel libvorbis-devel libsidplay1-devel gcc >= 3.0-0 gcc-c++ >= 3.0-0 flac-devel desktop-file-utils hicolor-icon-theme unzip texinfo update-desktop-files
29%else
30%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
31BuildRequires: ncurses-devel zlib-devel adplug-devel SDL2-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
32%else
33BuildRequires: ncurses-devel zlib-devel adplug-devel libSDL2-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
34%endif
35%endif
36
37# Include libmad if given
38%{?_with_libmad:BuildRequires: libmad-devel}
39
40%description
41Open Cubic Player is a music player ported from DOS. Provides a nice text-based
42frontend, with some few optional features in graphical. Plays modules, sids,
43wave and mp3
44
45%changelog
46* Sat Jan 09 2010 - stian (at) nixia.no
47 - Initial makeover of the .spec file
48
49%prep
50%setup -q -n %{name}-%{version}
51unzip $RPM_SOURCE_DIR/opencp25image1.zip
52unzip -o $RPM_SOURCE_DIR/opencp25ani1.zip
53
54%build
55CFLAGS=$RPM_OPT_FLAGS CXXFLAGS=$RPM_OPT_FLAGS ./configure --prefix=%{_prefix} --exec_prefix=%{_exec_prefix} --infodir=%{_infodir} --sysconfdir=/etc %{?_with_libmad} %{?_without_libmad}
56make
57
58%post
59if [ "$1" = "1" ] ; then  # first install
60	if [ -x /sbin/install-info ]; then
61		install-info --info-dir=%{_infodir} %{_infodir}/ocp.info.gz || true
62	fi
63fi
64# Assembler optimizations for x86 requires relocations, so please tell SELinux this if possible
65%ifarch i386 i486 i586 i686 x86
66if [ -x /usr/bin/chcon ]; then
67	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
68fi
69%endif
70
71%preun
72if [ "$1" = "0" ] ; then # last uninstall
73	if [ -x /sbin/install-info ]; then
74		install-info --delete --info-dir=%{_infodir} %{_infodir}/ocp.info.gz || true
75	fi
76fi
77
78%install
79rm -rf %{buildroot}
80mkdir -p %{buildroot}
81make DESTDIR=%{buildroot} install
82%if 0%{?suse_version}
83 %suse_update_desktop_file -n -r cubic.org-opencubicplayer AudioVideo Player
84%endif
85mkdir -p %{buildroot}%{_prefix}/share/ocp-%{version}/data
86cp CP* %{buildroot}%{_prefix}/share/ocp-%{version}/data
87rm -f %{buildroot}/%{_infodir}/dir
88
89%clean
90rm -rf %{buildroot}
91
92%files
93%defattr(-,root,root)
94%config %{_prefix}/share/ocp-%{version}/etc/ocp.ini
95%{_exec_prefix}/lib/ocp-%{version}
96%{_prefix}/bin/ocp-%{version}
97%{_prefix}/bin/ocp
98%{_prefix}/bin/ocp-curses
99%{_prefix}/bin/ocp-sdl2
100%{_prefix}/bin/ocp-vcsa
101%{_prefix}/bin/ocp-x11
102%{_infodir}/ocp.info.gz
103%{_prefix}/share/icons/hicolor/16x16/apps/opencubicplayer.xpm
104%{_prefix}/share/icons/hicolor/48x48/apps/opencubicplayer.xpm
105%{_prefix}/share/applications/cubic.org-opencubicplayer.desktop
106
107%dir %{_prefix}/share/ocp-%{version}
108#%dir %{_prefix}/share/ocp-%{version}/data
109%dir %{_prefix}/share/ocp-%{version}/etc
110%{_prefix}/share/ocp-%{version}/data
111#data/ocp.hlp
112#data/CP*.TAG
113#data/CP*.DAT
114
115%docdir %{_prefix}/share/doc/ocp-%{version}
116%{_prefix}/share/doc/ocp-%{version}
117