Skip to content

Instantly share code, notes, and snippets.

@armando-basile
Last active November 9, 2015 21:45
Show Gist options
  • Save armando-basile/21b5ccb677d228c9645b to your computer and use it in GitHub Desktop.
Save armando-basile/21b5ccb677d228c9645b to your computer and use it in GitHub Desktop.
comex mageia spec file
# enable build of Gtk gui
%define with_gtk 1
# enable build of Qt gui
%define with_qt 1
%define archivename comex-project
%define g_gtk %{name}-gtk
%define g_qt %{name}-qt
%define min_ver 0.1.9
%define comexbase %{name}-base
%define name_ver %{name}-%{version}
Summary: Console interface for comex project
Name: comex
Version: 0.1.9
Release: %mkrel 3
License: GPLv2
#ExcludeArch: ppc64
Group: Text tools
Source: https://github.com/armando-basile/%archivename/archive/%{name}-%{version}.tar.gz
# get sources from https://github.com/armando-basile/comex-project/archive/%{version}.tar.gz
# and rename folder from comex-project to comex
URL: https://github.com/armando-basile/%archivename/
BuildArch: noarch
BuildRequires: mono-devel
BuildRequires: log4net-devel
BuildRequires: pkgconfig
# for Gtk gui
%if %{with_gtk}
BuildRequires: gtk-sharp2-devel
BuildRequires: glade-sharp2
Provides: %{g_gtk}
%endif
# for Qt gui
%if %{with_qt}
BuildRequires: qyoto-devel
BuildRequires: qyoto
Provides: %{g_qt}
%endif
Requires: mono
Requires: log4net
Requires: %{comexbase} = 0.1.9
Obsoletes: comex-base < %{min_ver}
Obsoletes: comex-base-devel < %{min_ver}
Obsoletes: comex-gtk < %{min_ver}
Obsoletes: comex-qt < %{min_ver}
%description
Is console interface of a simple application that can be used to exchange
data with smartcards using PC/SC standard readers or smartmouse
phoenix serial reader.
%package base
Summary: Base component for comex project
Group: Office/Utilities
Requires: mono
Requires: libpcsclite1
%description base
Is base component of a simple application that can be used to exchange
data with smartcards using PC/SC standard readers or smartmouse
phoenix serial reader.
# for Gtk gui
%if %{with_gtk}
%package gtk
Summary: GTK user interface for comex project
Group: Office/Utilities
Requires: %{comexbase} = %{version}
%description gtk
GTK user interface of a simple application that can be used to exchange
data with smartcards using PC/SC standard readers or smartmouse
phoenix serial reader.
%endif
# for Qt gui
%if %{with_qt}
%package qt
Summary: Qt user interface for comex project
Group: Office/Utilities
Requires: %{comexbase} = %{version}
Requires: qyoto-devel
%description qt
Qt user interface of a simple application that can be used to exchange
data with smartcards using PC/SC standard readers or smartmouse
phoenix serial reader.
%endif
%prep
%setup -q
%build
# build commands
cd %{_builddir}/%{name}-%{version}/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}/%{comexbase}
mkdir -p %{buildroot}%{_docdir}/%{name}
# install commands
cp -f %{_builddir}/%{name_ver}/%{name}/bin/Debug/%{name}.exe* %{buildroot}%{_prefix}/lib/%{name}/
cp -f %{_builddir}/%{name_ver}/%{name}/bin/Debug/%{comexbase}.dll* %{buildroot}%{_prefix}/lib/%{name}/
cp -rf %{_builddir}/%{name_ver}/%{name}/bin/Debug/Languages %{buildroot}%{_datadir}/%{comexbase}/
# generate bin script
(
cat <<EOF
#!/bin/sh
exec mono "%{_prefix}/lib/%{name}/%{name}.exe" "\$@"
EOF
) >> %{buildroot}%{_bindir}/%{name}
chmod 775 %{buildroot}%{_bindir}/%{name}
# for Gtk gui
%if %{with_gtk}
mkdir -p %{buildroot}%{_docdir}/%{g_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}/resources/Images/%{name}_48.png %{buildroot}%{_datadir}/pixmaps/%{g_gtk}.png
cp -f %{_builddir}/%{name_ver}/%{g_gtk}/Resources/%{g_gtk} %{buildroot}%{_datadir}/applications/%{g_gtk}.desktop
(
cat <<EOF
#!/bin/sh
exec mono "%{_prefix}/lib/%{name}/%{g_gtk}.exe" "\$@"
EOF
) >> %{buildroot}%{_bindir}/%{g_gtk}
chmod 775 %{buildroot}%{_bindir}/%{g_gtk}
%endif
# for Qt gui
%if %{with_qt}
mkdir -p %{buildroot}%{_docdir}/%{g_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}/resources/Images/%{name}_48.png %{buildroot}%{_datadir}/pixmaps/%{g_qt}.png
cp -f %{_builddir}/%{name_ver}/%{g_qt}/Resources/%{g_qt} %{buildroot}%{_datadir}/applications/%{g_qt}.desktop
(
cat <<EOF
#!/bin/sh
exec mono "%{_prefix}/lib/%{name}/%{g_qt}.exe" "\$@"
EOF
) >> %{buildroot}%{_bindir}/%{g_qt}
chmod 775 %{buildroot}%{_bindir}/%{g_qt}
%endif
%files
%doc copying.gpl %{name}/readme.txt
%{_bindir}/%{name}
%_prefix/lib/%{name}/%{name}.exe*
%files base
%_prefix/lib/%{name}/%{comexbase}.dll*
%_datadir/%{comexbase}/Languages/*
%if %{with_gtk}
%files gtk
%doc copying.gpl
%{_bindir}/%{g_gtk}
%_prefix/lib/%{name}/%{g_gtk}.*
%{_datadir}/pixmaps/%{g_gtk}.png
%{_datadir}/applications/%{g_gtk}.desktop
%endif
%if %{with_qt}
%files qt
%doc copying.gpl
%{_bindir}/%{g_qt}
%_prefix/lib/%{name}/%{g_qt}.*
%{_datadir}/pixmaps/%{g_qt}.png
%{_datadir}/applications/%{g_qt}.desktop
%endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment