452facb
%global		gitcommit		a098f817272443a22ddd80d40b9eb00a0ed429c9
452facb
%global		gitdate		20191205
b25042f
%global		shortcommit	%(c=%{gitcommit}; echo ${c:0:7})
b25042f
452facb
%global		tarballdate	20191230
452facb
%global		tarballtime	1643
b25042f
b25042f
Name:			mcomix3
b25042f
# For now, choose version 0
b25042f
Version:		0
441a458
Release:		0.4.D%{gitdate}git%{shortcommit}%{?dist}
b25042f
Summary:		User-friendly, customizable image viewer for comic books
b25042f
# GPL version info is from mcomix/mcomixstarter.py
b25042f
License:		GPLv2+
b25042f
URL:			https://github.com/multiSnow/mcomix3
b25042f
# Use git repository directly - with it when modifying source
b25042f
# we can do it *in git repository* and then we can directly submit
b25042f
# patch to the upstream by pull request
b25042f
Source0:		%{name}-%{tarballdate}T%{tarballtime}.tar.bz2
b25042f
# Source0 is created by Source1
b25042f
Source1:		create-mcomix3-git-bare-tarball.sh
b25042f
# Some additional files
b25042f
Source2:		mcomix3starter.sh
b25042f
# Borrow some desktop related files
b25042f
Source10:		mcomix3.desktop
b25042f
# Patches
b25042f
Patch1:		0001-Handle-encoding-exception-when-loading-bookmark-pick.patch
b25042f
Patch2:		0002-Change-domain-name-for-gettext.patch
b25042f
Patch3:		0003-Search-gettext-files-in-system-wide-directory.patch
b25042f
Patch4:		0004-Lower-pickle-protocol-version-for-mcomix-compatibili.patch
b25042f
b25042f
BuildRequires:	python3-devel
b25042f
#BuildRequires:	%%{_bindir}/appstream-util
b25042f
BuildRequires:	%{_bindir}/desktop-file-install
b25042f
BuildRequires:	gettext
b25042f
BuildRequires:	git
b25042f
Requires:		gtk3
b25042f
Requires:		python3-gobject
b25042f
Requires:		python3-pillow
b25042f
BuildArch:		noarch
b25042f
%if 0%{?fedora} >= 32
b25042f
Obsoletes:		mcomix < 1.2.2
b25042f
Obsoletes:		comix < 4.0.5
1705e00
Provides:		mcomix = 1.2.2
b25042f
%endif
b25042f
b25042f
b25042f
%description
b25042f
MComix3 is a user-friendly, customizable image viewer.
1705e00
It has been forked from the original MComix project and ported to python3.
b25042f
b25042f
%prep
b25042f
%setup -q -c -T -a 0
b25042f
b25042f
# Setup source git repository
b25042f
git clone ./%{name}.git
b25042f
cd %{name}
b25042f
b25042f
git config user.name "%{name} Fedora maintainer"
b25042f
git config user.email "%{name}-owner@fedoraproject.org"
b25042f
git checkout -b %{version}-%{release}-fedora %{gitcommit}
b25042f
b25042f
# Apply patches
b25042f
cat %{PATCH1} | git am
b25042f
cat %{PATCH2} | git am
b25042f
cat %{PATCH3} | git am
b25042f
# For now apply this
b25042f
cat %{PATCH4} | git am
b25042f
b25042f
%build
b25042f
pushd %{name}
b25042f
rm -rf localroot
b25042f
mkdir localroot
b25042f
b25042f
python3 installer.py --srcdir=mcomix --target=$(pwd)/localroot/
b25042f
popd
b25042f
b25042f
%install
b25042f
pushd %{name}
b25042f
cp -p [A-Z]* ..
b25042f
popd
b25042f
b25042f
# Install manually...
b25042f
SITETOPDIR=%{python3_sitelib}/%{name}
b25042f
DSTTOPDIR=%{buildroot}${SITETOPDIR}
b25042f
mkdir -p ${DSTTOPDIR}
b25042f
mkdir -p ${DSTTOPDIR}/mcomix3
b25042f
mkdir -p %{buildroot}%{_datadir}/locale
b25042f
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/
b25042f
b25042f
pushd %{name}
b25042f
rm -rf localroot.2
b25042f
cp -a localroot localroot.2
b25042f
b25042f
pushd localroot.2/mcomix
b25042f
b25042f
# Wrapper script
b25042f
install -cpm 0755 %{SOURCE2} ${DSTTOPDIR}
b25042f
# locale files
b25042f
find mcomix/messages/* -type f | while read f
b25042f
do
b25042f
	dir=$(dirname $f)
b25042f
	mv $f $dir/%{name}.mo
b25042f
done
b25042f
mv mcomix/messages/* %{buildroot}%{_datadir}/locale/
b25042f
# duplicate icon
b25042f
for dir in mcomix/images/*x*/
b25042f
do
b25042f
	basedir=$(basename $dir)
b25042f
	mkdir -p %{buildroot}%{_datadir}/icons/hicolor/$basedir/apps
b25042f
	cp -p $dir/*png %{buildroot}%{_datadir}/icons/hicolor/$basedir/apps/%{name}.png
b25042f
done
b25042f
# data files
b25042f
mv mcomix/ ${DSTTOPDIR}/mcomix3/
b25042f
# Not needed
b25042f
rm -f comicthumb.py
b25042f
mv mcomixstarter.py ${DSTTOPDIR}/
b25042f
b25042f
# Ensure that all files are installed
b25042f
popd
b25042f
rmdir localroot.2/mcomix
b25042f
rmdir localroot.2
b25042f
b25042f
popd
b25042f
# Wrapper symlink
b25042f
mkdir %{buildroot}/%{_bindir}
b25042f
ln -sf ${SITETOPDIR}/mcomix3starter.sh %{buildroot}%{_bindir}/mcomix3
b25042f
# Desktop file
b25042f
mkdir %{buildroot}%{_datadir}/applications
b25042f
desktop-file-install \
b25042f
	--remove-category Application \
b25042f
	--dir %{buildroot}%{_datadir}/applications/ \
b25042f
	%{SOURCE10}
b25042f
b25042f
%find_lang %{name}
b25042f
b25042f
%files -f %{name}.lang
b25042f
%license	COPYING
b25042f
%doc		ChangeLog
b25042f
%doc		README*
b25042f
%doc		TODO
b25042f
b25042f
%{_bindir}/%{name}
b25042f
%{python3_sitelib}/%{name}/
b25042f
# Do not own %%{_datadir}/icons/hicolor explicitly
b25042f
%{_datadir}/icons/hicolor/*/apps/%{name}.png
b25042f
%{_datadir}/applications/%{name}.desktop
b25042f
# TODO: appdata file, not availale yet (should item)
b25042f
b25042f
%changelog
441a458
* Mon Dec 30 2019 Mamoru TASAKA <mtasaka@fedoraproject.org> 0-0.4.D20191205gita098f81
452facb
- Update to latest git (20191205)
452facb
1705e00
* Fri Nov  8 2019 Mamoru TASAKA <mtasaka@fedoraproject.org> 0-0.2.D20190616git0405a23
1705e00
- Reflect package review suggestions (bug 1768447)
1705e00
b25042f
* Mon Nov 04 2019 Mamoru TASAKA <mtasaka@fedoraproject.org> 0-0.1.D20190616git0405a23
b25042f
- Initial packaging