Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Meson build system, appstream metadata and RPM&Yum pieces #161

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bin/build/meson-logs/meson-log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Build started at 2017-05-01T21:52:57.292575
Python binary: /usr/bin/python3
Python system: Linux
The Meson build system
Version: 0.40.0
Source dir: /home/cschalle/devel/remarkable/bin
Build dir: /home/cschalle/devel/remarkable/bin/build
Build type: native build

Meson encountered an error:
First statement must be a call to project

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete your personal meson-log.txt file from this pull request.

By the way, do you know what this message means? "First statement must be a call to project"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope

35 changes: 35 additions & 0 deletions bin/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version = '1.87'


message('Getting python directiories')

py3_mod = import('python3')
py3 = py3_mod.find_python()

py3_version = py3_mod.language_version()
if py3_version.version_compare('< 3.2')
error('Invalid python version!?')
endif

py3_purelib = py3_mod.sysconfig_path('purelib')
if not py3_purelib.endswith('site-packages')
error('Python3 purelib path seems invalid?')
endif

message('Python version installed : ' + py3_version)
message('Python library path : ' + py3_purelib)
pythonlibpath=join_paths(get_option('prefix'),py3_purelib)
# Configuration params

cdata = configuration_data()
cdata.set('PACKAGE', '"Remarkable"')
# Configuration params
cdata.set('PACKAGE_URL', 'https://remarkableapp.github.io/')
cdata.set('VERSION', version)
cdata.set('PYTHON_LIB_PATH', pythonlibpath)


message('Preparing init file')
configure_file(input : 'remarkable.in', output : 'remarkable', configuration : cdata, install_dir : 'bin')
message('generated binary')

15 changes: 2 additions & 13 deletions bin/remarkable → bin/remarkable.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,9 @@ import os
import locale
locale.textdomain('remarkable')

try:
if os.path.exists("/usr/lib/python3/"):
sys.path.append("/usr/lib/python3/dist-packages/")
sys.path.append("/usr/lib/python3/dist-packages/remarkable")
else:
sys.path.append("/usr/lib/python/dist-packages/")
sys.path.append("/usr/lib/python/dist-packages/remarkable")
except:
pass
sys.path.append("@PYTHON_LIB_PATH@")
sys.path.append("@PYTHON_LIB_PATH@/remarkable")

try:
sys.path.append("/usr/lib64/python3/dist-packages/")
except:
pass

# Add project root directory (enable symlink and trunk execution)
PROJECT_ROOT_DIRECTORY = os.path.abspath(
Expand Down
12 changes: 12 additions & 0 deletions data/glib-2.0/schemas/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
gnome = import('gnome')




message('Compiling schemas')
gnome.compile_schemas()
install_data(
'net.launchpad.remarkable.gschema.xml',
install_dir : 'share/glib-2.0/schemas')


7 changes: 7 additions & 0 deletions data/media/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
message('Installing Tutorial data')
install_data('MarkdownTutorial.md', install_dir : 'share/remarkable/media/')


message('Installing desktop icon')
install_data('remarkable.png', install_dir : 'share/icons/hicolor/256x256/apps')
install_data('remarkable.svg', install_dir : 'share/icons/hicolor/scaleable/apps/')
7 changes: 7 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

install_subdir('ui', install_dir: 'share/remarkable')

message('Preparing appdata')
install_data('remarkable.appdata.xml', install_dir : 'share/appdata')


24 changes: 24 additions & 0 deletions data/remarkable.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>remarkable.desktop</id>
<metadata_license>CC-BY-3.0</metadata_license>
<project_license>MIT</project_license>
<name>Remarkable Markdown Editor</name>
<summary>Remarkable is a powerful markdown editor available for Linux. It is fully featured and customizable.</summary>
<description>
<p>
Remarkable is a full featured and powerful markdown editor that allows you to quickly edit and work with documents in markdown format.
</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://remarkableapp.github.io/images/main_screenshot.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://remarkableapp.github.io</url>
<url type="bugtracker">https://github.com/jamiemcg/Remarkable/issues</url>
<url type="donation">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=B5PJTSJNFYGT2</url>
<project_group>GNOME</project_group>
<update_contact>Jamie McGowan - jamiemcgowan.dev@gmail.com</update_contact>
<translation>None</translation>
</component>
20 changes: 20 additions & 0 deletions make_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -e

test -n "$srcdir" || srcdir=$1
test -n "$srcdir" || srcdir=.
echo 'Done testing for src dir'

cd $srcdir

echo 'Getting version number from git'
VERSION=$(git describe --tags --abbrev=0)
echo 'Setting name'
NAME="remarkable-${VERSION}"

echo "Creating git tree archive…"
git archive --prefix="${NAME}/" --format=tar HEAD > ${NAME}.tar

echo "Compressing archive…"
xz --verbose -f "${NAME}.tar"
42 changes: 42 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
project('remarkable', 'c')

version = '1.87'

# Configuration params
conf = configuration_data()
conf.set('PACKAGE_VERSION', version)
conf.set('PACKAGE_URL', 'https://remarkableapp.github.io/')

message('Looking for dependencies')
py3 = find_program('python3')
glib = dependency('glib-2.0')
gobject = dependency('gobject-2.0')
gir = dependency('gobject-introspection-1.0')
gtk = dependency('gtk+-3.0', version : '>=3.13.2')

message('Getting python install dir')
r = run_command(py3, '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
if r.returncode() != 0
error('Cannot find python install dir')
endif
python_dir = r.stdout().strip()

subdir('data/glib-2.0/schemas')
subdir('data/media')
subdir('data')
subdir('bin')

message('Install source code medata')
install_data('LICENSE', install_dir : 'share/doc/remarkable')
install_data('README.md', install_dir : 'share/doc/remarkable')

message('Installing Python files')
install_subdir('pdfkit', install_dir: python_dir)
install_subdir('markdown', install_dir: python_dir)
install_subdir('remarkable', install_dir: python_dir)
install_subdir('remarkable_lib', install_dir: python_dir)

message('Installing .desktop file')
install_data('remarkable.desktop', install_dir : 'share/applications')

meson.add_install_script('meson_install.sh')
8 changes: 8 additions & 0 deletions meson_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Update icon caches
#gtk-update-icon-cache -f -t ${DESTDIR}/${MESON_INSTALL_PREFIX}/share/icons/hicolor
#gtk-update-icon-cache -f -t ${DESTDIR}/${MESON_INSTALL_PREFIX}/share/icons/HighContrast

# Install new schemas
glib-compile-schemas ${DESTDIR}/${MESON_INSTALL_PREFIX}/share/glib-2.0/schemas/
6 changes: 6 additions & 0 deletions remarkable.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[remarkable]
name=Remarkable Markdown editor software and updates
baseurl=https://raw.githubusercontent.com/cschalle/hubyum/master/noarch
gpgcheck=0
enabled=1
enabled_metadata=1
56 changes: 56 additions & 0 deletions remarkable.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Summary: Markdown editor
Name: remarkable
Version: 1.87
Release: 1

Source: https://github.com/jamiemcg/Remarkable/archive/remarkable-%{version}.tar.xz
Packager: uraeus@gnome.org
License: MIT
Group: Applications/Productivity
URL: https://remarkableapp.github.io/
BuildRoot: %{_tmppath}/remarkable-%{version}-%{release}-root-%(%{__id_u} -n)

Requires: python3
BuildRequires: python3-devel
BuildRequires: meson

BuildArch: noarch

%description
Remarkable markdown editor application. Allows you to edit in Markdown format for use with Wikis.

%prep
%autosetup

%build

%meson
%meson_build
desktop-file-validate remarkable.desktop
%meson_install

%post
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc LICENSE README.md
%{_bindir}/remarkable
%{python3_sitelib}/remarkable
%{python3_sitelib}/remarkable_lib
%{python3_sitelib}/markdown/extensions
%{python3_sitelib}/pdfkit
%{_datadir}/glib-2.0/schemas
%{_datadir}/remarkable/ui
%{_datadir}/icons/hicolor/256x256/apps/remarkable.png
%{_datadir}/icons/hicolor/scaleable/apps/remarkable.svg
%{_datadir}/remarkable/media/MarkdownTutorial.md
%{_datadir}/appdata/remarkable.appdata.xml
%{_datadir}/applications/remarkable.desktop

%changelog
* Thu Apr 27 2017 Christian F.K. Schaller <uraeus@gnome.org>
- Initial release
71 changes: 71 additions & 0 deletions scripts/pythondetector
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env python3
import os
import platform
import subprocess
import sys

from distutils import sysconfig


def get_python_abiflags():
return sysconfig.get_config_var("ABIFLAGS")

def get_python_libloc():
# OSX is a pain. Python as shipped by apple installs libpython in /usr/lib
# so we hardcode that. Other systems can use --with-libpython-dir to
# override this.
if platform.system().lower() == 'darwin':
return '/usr/lib'

pylib_loc = sysconfig.get_config_var("LIBPL")
pylib_ldlibrary = sysconfig.get_config_var("LDLIBRARY")

py_sharedlib = os.path.join(pylib_loc, pylib_ldlibrary)
if os.path.exists(py_sharedlib):
return pylib_loc

# Workaround for Fedora
pylib_loc = sysconfig.get_config_var("LIBDIR")
pylib_ldlibrary = sysconfig.get_config_var("LDLIBRARY")

py_sharedlib = os.path.join(pylib_loc, pylib_ldlibrary)
if os.path.exists(py_sharedlib):
return pylib_loc

return "None"


if __name__ == "__main__":
if len(sys.argv) > 3:
print("At most 2 arguments accepted")
exit(1)

if sys.argv[1] == '--abiflags':
print(get_python_abiflags())
elif sys.argv[1] == '--sosuffix':
get = sysconfig.get_config_var
suffix = get("EXT_SUFFIX") or get("SO") or ".so"
print(suffix[1:])
elif sys.argv[1] == '--pygi-overridedir':
prefix = sys.argv[2]
version = sys.version_info

# If we are installing in the same prefix as PyGobject
# make sure to install in the right place.
import gi
if os.path.commonprefix([gi._overridesdir, prefix]) == prefix:
print(gi._overridesdir)
exit(0)

# Otherwise follow python's way of install site packages inside
# the provided prefix
if os.name == 'posix':
print(os.path.join(
prefix, 'lib', 'python%d.%d' % (version.major, version.minor),
'site-packages', 'gi', 'overrides'))
else:
print(os.path.join(
prefix, 'Lib', 'Python%d%d' % (version.major, version.minor),
'site-packages', 'gi', 'overrides'))
elif sys.argv[1] == '--libloc':
print(get_python_libloc())