gliphy / rpms / mcomix3

Forked from rpms/mcomix3 3 years ago
Blob Blame History Raw
%global		gitcommit		a098f817272443a22ddd80d40b9eb00a0ed429c9
%global		gitdate		20191205
%global		shortcommit	%(c=%{gitcommit}; echo ${c:0:7})

%global		tarballdate	20191230
%global		tarballtime	1643

Name:			mcomix3
# For now, choose version 0
Version:		0
Release:		0.4.D%{gitdate}git%{shortcommit}%{?dist}
Summary:		User-friendly, customizable image viewer for comic books
# GPL version info is from mcomix/
License:		GPLv2+
# Use git repository directly - with it when modifying source
# we can do it *in git repository* and then we can directly submit
# patch to the upstream by pull request
Source0:		%{name}-%{tarballdate}T%{tarballtime}.tar.bz2
# Source0 is created by Source1
# Some additional files
# Borrow some desktop related files
Source10:		mcomix3.desktop
# Patches
Patch1:		0001-Handle-encoding-exception-when-loading-bookmark-pick.patch
Patch2:		0002-Change-domain-name-for-gettext.patch
Patch3:		0003-Search-gettext-files-in-system-wide-directory.patch
Patch4:		0004-Lower-pickle-protocol-version-for-mcomix-compatibili.patch

BuildRequires:	python3-devel
#BuildRequires:	%%{_bindir}/appstream-util
BuildRequires:	%{_bindir}/desktop-file-install
BuildRequires:	gettext
BuildRequires:	git
Requires:		gtk3
Requires:		python3-gobject
Requires:		python3-pillow
BuildArch:		noarch
%if 0%{?fedora} >= 32
Obsoletes:		mcomix < 1.2.2
Obsoletes:		comix < 4.0.5
Provides:		mcomix = 1.2.2

MComix3 is a user-friendly, customizable image viewer.
It has been forked from the original MComix project and ported to python3.

%setup -q -c -T -a 0

# Setup source git repository
git clone ./%{name}.git
cd %{name}

git config "%{name} Fedora maintainer"
git config "%{name}"
git checkout -b %{version}-%{release}-fedora %{gitcommit}

# Apply patches
cat %{PATCH1} | git am
cat %{PATCH2} | git am
cat %{PATCH3} | git am
# For now apply this
cat %{PATCH4} | git am

pushd %{name}
rm -rf localroot
mkdir localroot

python3 --srcdir=mcomix --target=$(pwd)/localroot/

pushd %{name}
cp -p [A-Z]* ..

# Install manually...
mkdir -p ${DSTTOPDIR}
mkdir -p ${DSTTOPDIR}/mcomix3
mkdir -p %{buildroot}%{_datadir}/locale
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/

pushd %{name}
rm -rf localroot.2
cp -a localroot localroot.2

pushd localroot.2/mcomix

# Wrapper script
install -cpm 0755 %{SOURCE2} ${DSTTOPDIR}
# locale files
find mcomix/messages/* -type f | while read f
	dir=$(dirname $f)
	mv $f $dir/%{name}.mo
mv mcomix/messages/* %{buildroot}%{_datadir}/locale/
# duplicate icon
for dir in mcomix/images/*x*/
	basedir=$(basename $dir)
	mkdir -p %{buildroot}%{_datadir}/icons/hicolor/$basedir/apps
	cp -p $dir/*png %{buildroot}%{_datadir}/icons/hicolor/$basedir/apps/%{name}.png
# data files
mv mcomix/ ${DSTTOPDIR}/mcomix3/
# Not needed
rm -f

# Ensure that all files are installed
rmdir localroot.2/mcomix
rmdir localroot.2

# Wrapper symlink
mkdir %{buildroot}/%{_bindir}
ln -sf ${SITETOPDIR}/ %{buildroot}%{_bindir}/mcomix3
# Desktop file
mkdir %{buildroot}%{_datadir}/applications
desktop-file-install \
	--remove-category Application \
	--dir %{buildroot}%{_datadir}/applications/ \

%find_lang %{name}

%files -f %{name}.lang
%license	COPYING
%doc		ChangeLog
%doc		README*
%doc		TODO

# Do not own %%{_datadir}/icons/hicolor explicitly
# TODO: appdata file, not availale yet (should item)

* Mon Dec 30 2019 Mamoru TASAKA <> 0-0.4.D20191205gita098f81
- Update to latest git (20191205)

* Fri Nov  8 2019 Mamoru TASAKA <> 0-0.2.D20190616git0405a23
- Reflect package review suggestions (bug 1768447)

* Mon Nov 04 2019 Mamoru TASAKA <> 0-0.1.D20190616git0405a23
- Initial packaging