mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-02 11:04:33 +12:00
Initial Package Manuskript for Linux with rpm tutorial
parent
d528755202
commit
90fb3ab97e
152
Package-Manuskript-for-Linux-with-rpm.md
Normal file
152
Package-Manuskript-for-Linux-with-rpm.md
Normal file
|
@ -0,0 +1,152 @@
|
|||
# SUMMARY
|
||||
|
||||
This guide describes the steps for packaging **Manuskript** for Linux
|
||||
using `rpm`. The resulting `.rpm` package runs on both 32-bit and
|
||||
64-bit Fedora based GNU/Linux distributions.
|
||||
|
||||
# CONSIDERATIONS
|
||||
|
||||
This document is heavily based on the steps found in this
|
||||
[stackoverflow.com post](https://stackoverflow.com/questions/880227/what-is-the-minimum-i-have-to-do-to-create-an-rpm-file).
|
||||
|
||||
I chose Debian 8 Jessie as the build platform because I also use this
|
||||
to
|
||||
[Package Manuskript for Linux with dpkg](https://github.com/olivierkes/manuskript/wiki/Package-Manuskript-for-Linux-with-dpkg).
|
||||
|
||||
In an effort to reduce duplication of effort, I chose to use the above
|
||||
built `.deb` package as a base starting point.
|
||||
|
||||
# PREPARATION
|
||||
|
||||
Install tools needed to build package.
|
||||
|
||||
sudo update
|
||||
sudo apt install rpm
|
||||
|
||||
# CREATE RPM PACKAGE
|
||||
|
||||
1. Create the rpm tree structure.
|
||||
|
||||
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SRPMS,SPECS,tmp}
|
||||
mkdir -p ~/rpmbuild/RPMS/noarch
|
||||
|
||||
2. Define rpm macros.
|
||||
|
||||
cat <<EOF >~/.rpmmacros
|
||||
%_topdir %(echo $HOME)/rpmbuild
|
||||
%_tmppath %{_topdir}/tmp
|
||||
EOF
|
||||
|
||||
3. Change into `rpmbuild` directory.
|
||||
|
||||
cd ~/rpmbuild
|
||||
|
||||
4. Create tarball using deb package.
|
||||
|
||||
mkdir manuskript-0.5.0
|
||||
dpkg -x /path-to/manuskript-0.5.0-1.deb manuskript-0.5.0
|
||||
# Clean up unneeded source files
|
||||
rm manuskript-0.5.0/usr/share/manuskript/{.codeclimate.yml,.gitignore}
|
||||
tar -czf manuskript-0.5.0.tar.gz manuskript-0.5.0/
|
||||
mv manuskript-0.5.0.tar.gz SOURCES/
|
||||
rm -rf manuskript-0.5.0/
|
||||
|
||||
5. Create `SPECS/manuskript.spec` file.
|
||||
Fill with contents:
|
||||
|
||||
cat <<EOF > SPECS/manuskript.spec
|
||||
# Don't try fancy stuff like debuginfo, which is useless on binary-only
|
||||
# packages. Don't strip binary too
|
||||
# Be sure buildpolicy set to do nothing
|
||||
%define name manuskript
|
||||
%define version 0.5.0
|
||||
%define release 1
|
||||
%define __spec_install_post %{nil}
|
||||
%define debug_package %{nil}
|
||||
%define __os_install_post %{_dbpath}/brp-compress
|
||||
|
||||
Summary: Manuskript open source tool for writers
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: GPL3+
|
||||
Group: Applications/Editors
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_builddir}/%{name}-%{version}-%{release}-root
|
||||
URL: http://www.theologeek.ch/manuskript/
|
||||
SOURCE0 : %{name}-%{version}.tar.gz
|
||||
Packager: Curtis Gedak <gedakc@gmail.com>
|
||||
Provides: Manuskript
|
||||
Requires: python3, python3-qt5, python3-lxml, zlib, python3-markdown, pandoc
|
||||
%if 0%{?suse_version}
|
||||
# Assume openSUSE
|
||||
# Note - have to build rpm on openSUSE for this to work.
|
||||
Requires: libQt5Svg5, python3-pyenchant
|
||||
%else
|
||||
# Assume Fedora and others
|
||||
Requires: python3-qt5-webkit, qt5-qtsvg, python3-enchant
|
||||
%endif
|
||||
|
||||
%description
|
||||
Manuskript is an open source tool for writers. It
|
||||
provides a rich environment to help writers create
|
||||
their first draft and then further refine and edit
|
||||
their masterpiece.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
# Empty section.
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}
|
||||
|
||||
# in builddir
|
||||
cp -a * %{buildroot}
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
/usr/bin/manuskript
|
||||
/usr/share/applications/manuskript.desktop
|
||||
/usr/share/manuskript/*
|
||||
|
||||
%changelog
|
||||
# Empty section.
|
||||
|
||||
EOF
|
||||
|
||||
*----- end manuskript.spec -----*
|
||||
|
||||
6. Build the "binary" rpm package.
|
||||
|
||||
rpmbuild --target=noarch -bb SPECS/manuskript.spec
|
||||
|
||||
This should create the RPM file in:
|
||||
`RPMS/noarch/manuskript-0.5.0-1.noarch.rpm`
|
||||
|
||||
|
||||
# PACKAGE INSTALL TEST
|
||||
|
||||
Install `.rpm` package with:
|
||||
|
||||
su -c "dnf install manuskript-0.5.0-1.noarch.rpm"
|
||||
|
||||
And try running manuskript.
|
||||
|
||||
Other useful commands:
|
||||
|
||||
* Remove package with: `su -c "dnf remove manuskript-0.5.0-1.noarch.rpm"`
|
||||
* List package information with: `rpm -qip manuskript-0.5.0-1.noarch.rpm`
|
||||
* List package dependencies with: `rpm -qRp manuskript-0.5.0-1.noarch.rpm`
|
||||
|
||||
# REFERENCES
|
||||
|
||||
- [What is the minimum I have to do to create an RPM file?](https://stackoverflow.com/questions/880227/what-is-the-minimum-i-have-to-do-to-create-an-rpm-file)
|
||||
- [rpmbuild tutorial - how to build rpm packages](https://rogerwelin.github.io/rpm/rpmbuild/2015/04/04/rpmbuild-tutorial-part-1.html)
|
||||
- [how to build a noarch RPM](https://www.redhat.com/archives/rpm-list/2001-December/msg00200.html)
|
||||
- [Building RPM packages for Linux distributions](http://blog.agilepartner.net/building-rpm-packages-1/)
|
Loading…
Reference in a new issue