Skip to content

Instantly share code, notes, and snippets.

@armando-basile
Last active November 9, 2015 22:18
Show Gist options
  • Save armando-basile/9ac3910acb254f66adef to your computer and use it in GitHub Desktop.
Save armando-basile/9ac3910acb254f66adef to your computer and use it in GitHub Desktop.
# enable build of Gtk gui
%define with_gtk 1
# enable build of Qt gui
%define with_qt 1
%define g_gtk %{name}-gui-gtk
%define g_qt %{name}-gui-qt
%define g_console %{name}-console
%define name_ver %{name}-%{version}
Summary: Multimedia files parser/editor)
Name: themonospot
Version: 0.9.0
Release: %mkrel 2
License: GPLv2
#ExcludeArch: ppc64
Group: Video/Utilities
# url to download source https://github.com/armando-basile/themonospot/archive/0.9.0.tar.gz
Source: https://github.com/armando-basile/%{name}/archive/%{name_ver}.tar.gz
URL: https://github.com/armando-basile/%{name}/
BuildArch: noarch
BuildRequires: mono-devel
BuildRequires: log4net-devel
BuildRequires: pkgconfig
# for Gtk gui
%if %{with_gtk}
BuildRequires: gtk-sharp2-devel
BuildRequires: glade-sharp2
Provides: themonospot-gtk
%endif
# for Qt gui
%if %{with_qt}
BuildRequires: qyoto-devel
BuildRequires: qyoto
Provides: themonospot-qt
%endif
Requires: mono
Requires: log4net
Obsoletes: %{g_gtk}
Obsoletes: %{g_qt}
Obsoletes: themonospot-base
Obsoletes: themonospot-base-devel
Obsoletes: themonospot-console
Obsoletes: themonospot-base-devel
Obsoletes: themonospot-plugin-avi
Obsoletes: themonospot-plugin-mkv
%description
base components and mono console application to scan multimedia
files using themonospot base component and his plugins.
# for Gtk gui
%if %{with_gtk}
%package gtk
Summary: Gtk application to use themonospot (multimedia files parser/editor)
Group: Video/Utilities
Requires: %{name} = %{version}
%description gtk
Gtk application to use themonospot (multimedia files parser/editor).
%endif
# for Qt gui
%if %{with_qt}
%package qt
Summary: Qt application to use themonospot (multimedia files parser/editor)
Group: Video/Utilities
Requires: %{name} = %{version}
Requires: qyoto-devel
%description qt
Qt application to use themonospot (multimedia files parser/editor).
%endif
%prep
%setup -q
%build
# build commands
cd %{_builddir}/%{name_ver}/build-linux
bash ./build-lnx-%{name}.sh
%if %{with_gtk}
bash ./build-lnx-%{name}-gtk.sh
%endif
%if %{with_qt}
bash ./build-lnx-%{name}-qt.sh
%endif
%install
# create folders if not exists
mkdir -p %{buildroot}%{_prefix}/lib/%{name}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_docdir}/%{name}
# install commands
cp -f %{_builddir}/%{name_ver}/%{g_console}/bin/Debug/%{name}-base.* %{buildroot}%{_prefix}/lib/%{name}/
cp -f %{_builddir}/%{name_ver}/%{g_console}/bin/Debug/%{name}-components.* %{buildroot}%{_prefix}/lib/%{name}/
cp -f %{_builddir}/%{name_ver}/%{g_console}/bin/Debug/%{name}-plugin-manager.* %{buildroot}%{_prefix}/lib/%{name}/
cp -f %{_builddir}/%{name_ver}/%{g_console}/bin/Debug/%{g_console}.* %{buildroot}%{_prefix}/lib/%{name}/
cp -rf %{_builddir}/%{name_ver}/%{g_console}/bin/Debug/languages %{buildroot}%{_datadir}/%{name}/
cp -rf %{_builddir}/%{name_ver}/%{g_console}/bin/Debug/plugins %{buildroot}%{_datadir}/%{name}/
# generate bin script
(
cat <<EOF
#!/bin/sh
exec mono "%{_prefix}/lib/%{name}/%{g_console}.exe" "\$@"
EOF
) >> %{buildroot}%{_bindir}/%{name}
chmod 775 %{buildroot}%{_bindir}/%{name}
# for Gtk gui
%if %{with_gtk}
mkdir -p %{buildroot}%{_docdir}/%{name}-gtk
mkdir -p %{buildroot}%{_datadir}/pixmaps/
mkdir -p %{buildroot}%{_datadir}/applications
cp -f %{_builddir}/%{name_ver}/%{g_gtk}/bin/Debug/%{g_gtk}.* %{buildroot}%{_prefix}/lib/%{name}/
cp -f %{_builddir}/%{name_ver}/%{g_gtk}/src/resources/%{name}.png %{buildroot}%{_datadir}/pixmaps/%{name}-gtk.png
cp -f %{_builddir}/%{name_ver}/%{g_gtk}/src/resources/%{name}-gtk.desktop %{buildroot}%{_datadir}/applications/%{name}-gtk.desktop
(
cat <<EOF
#!/bin/sh
exec mono "%{_prefix}/lib/%{name}/%{g_gtk}.exe" "\$@"
EOF
) >> %{buildroot}%{_bindir}/%{name}-gtk
chmod 775 %{buildroot}%{_bindir}/%{name}-gtk
%endif
# for Qt gui
%if %{with_qt}
mkdir -p %{buildroot}%{_docdir}/%{name}-qt
mkdir -p %{buildroot}%{_datadir}/pixmaps/
mkdir -p %{buildroot}%{_datadir}/applications
cp -f %{_builddir}/%{name_ver}/%{g_qt}/bin/Debug/%{g_qt}.* %{buildroot}%{_prefix}/lib/%{name}/
cp -f %{_builddir}/%{name_ver}/%{g_qt}/resources/%{name}_48.png %{buildroot}%{_datadir}/pixmaps/%{name}-qt.png
cp -f %{_builddir}/%{name_ver}/%{g_qt}/resources/%{name}-qt.desktop %{buildroot}%{_datadir}/applications/%{name}-qt.desktop
(
cat <<EOF
#!/bin/sh
exec mono "%{_prefix}/lib/%{name}/%{g_qt}.exe" "\$@"
EOF
) >> %{buildroot}%{_bindir}/%{name}-qt
chmod 775 %{buildroot}%{_bindir}/%{name}-qt
%endif
%files
%doc %{g_console}/copying.gpl
%{_bindir}/%{name}
%_prefix/lib/%{name}/%{name}-base.*
%_prefix/lib/%{name}/%{name}-components.*
%_prefix/lib/%{name}/%{name}-plugin-manager.*
%_prefix/lib/%{name}/%{g_console}.*
%_datadir/%{name}/languages/*
%_datadir/%{name}/plugins/*
%if %{with_gtk}
%files gtk
%doc %{g_gtk}/copying.gpl
%{_bindir}/%{name}-gtk
%_prefix/lib/%{name}/%{g_gtk}.*
%{_datadir}/pixmaps/%{name}-gtk.png
%{_datadir}/applications/%{name}-gtk.desktop
%endif
%if %{with_qt}
%files qt
%doc %{g_qt}/copying.gpl
%{_bindir}/%{name}-qt
%_prefix/lib/%{name}/%{g_qt}.*
%{_datadir}/pixmaps/%{name}-qt.png
%{_datadir}/applications/%{name}-qt.desktop
%endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment