Build system: init porting to meson

ft.librem5
Bilal Elmoussaoui 2019-07-01 12:43:26 +02:00
parent 0097ba667e
commit 16b5e8821f
69 changed files with 319 additions and 213 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ build/lib.linux-x86_64-2.7
*.pyc
__pycache__/
build/
_build/
debian/uberwriter/DEBIAN
debian/uberwriter/opt
debian/uberwriter/usr

View File

@ -1,6 +0,0 @@
all:
python3 ./setup.py build
install:
python3 ./setup.py install --prefix=/app --skip-build --optimize=1

View File

@ -1 +0,0 @@

View File

@ -1,59 +0,0 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
import sys
import os
import pkg_resources
import gettext
import locale
# Add project root directory (enable symlink and trunk execution)
PROJECT_ROOT_DIRECTORY = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
# Set the path if needed. This allows uberwriter to run without installing it :)
python_path = []
if os.path.abspath(__file__).startswith('/opt'):
gettext.bindtextdomain('uberwriter', '/opt/extras.ubuntu.com/uberwriter/share/locale')
syspath = sys.path[:] # copy to avoid infinite loop in pending objects
for path in syspath:
opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/uberwriter')
python_path.insert(0, opt_path)
sys.path.insert(0, opt_path)
os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/uberwriter/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")))
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'uberwriter'))
and PROJECT_ROOT_DIRECTORY not in sys.path):
python_path.insert(0, PROJECT_ROOT_DIRECTORY)
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
if python_path:
os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
import uberwriter
locale_dir = os.path.abspath(os.path.join(os.path.dirname(uberwriter.__file__),'../po/'))
# L10n
locale.textdomain('uberwriter')
locale.bindtextdomain('uberwriter', locale_dir)
gettext.textdomain('uberwriter')
gettext.bindtextdomain('uberwriter', locale_dir)
uberwriter.main()

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="addon">
<id>de.wolfvollprecht.UberWriter.Plugin.TexLive</id>
<extends>de.wolfvollprecht.UberWriter.desktop</extends>
<extends>de.wolfvollprecht.UberWriter</extends>
<name>TexLive Plugin</name>
<summary>Allows to export to pdf and to show formulas in the inline preview</summary>
<url type="homepage">https://www.tug.org/texlive//</url>
<project_license>LPPL</project_license>
<metadata_license>CC0-1.0</metadata_license>
<update_contact>w.vollprecht_AT_gmail.com</update_contact>
</component>
</component>

View File

@ -0,0 +1,102 @@
{
"app-id": "de.wolfvollprecht.UberWriter",
"runtime": "org.gnome.Platform",
"runtime-version": "3.32",
"sdk": "org.gnome.Sdk",
"command": "uberwriter",
"finish-args": [
"--socket=x11",
"--share=ipc",
"--filesystem=host",
"--env=IN_FLATPAK=1",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--env=XDG_DATA_DIRS=/app/usr/share",
"--env=PATH=/app/extensions/TexLive/bin:/app/extensions/TexLive/2018/bin/x86_64-linux:/app/usr/bin:/app/bin"
],
"add-extensions": {
"de.wolfvollprecht.UberWriter.Plugin": {
"directory": "extensions",
"version": "stable",
"subdirectories": true,
"no-autodownload": true,
"autodelete": true
}
},
"modules": [{
"name": "uberwriter",
"buildsystem": "meson",
"sources": [{
"type" : "git",
"url" : "../",
"branch" : "refactoring"
}],
"post-install": [
"install -d /app/extensions"
]
},
{
"name": "pandoc",
"only-arches": [
"x86_64"
],
"buildsystem": "simple",
"build-commands": [
"cp bin/pandoc /app/usr/bin/pandoc",
"cp bin/pandoc-citeproc /app/usr/bin/pandoc-citeproc"
],
"sources": [{
"type": "archive",
"url": "https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-linux.tar.gz",
"sha256": "06ecd882e42ef9b7390b1c82e1e71b3ea48679181289b9b810a8797825bed8ed"
}]
},
{
"name": "pipdeps",
"buildsystem": "simple",
"build-commands": [
"pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} pyenchant regex pypandoc"
],
"sources": [{
"type": "file",
"url": "https://files.pythonhosted.org/packages/5d/c1/45947333669b31bc6b4933308dd07c2aa2fedcec0a95b14eedae993bd449/wheel-0.31.0.tar.gz",
"sha256": "1ae8153bed701cb062913b72429bcf854ba824f973735427681882a688cb55ce"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz",
"sha256": "f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/71/81/00184643e5a10a456b4118fc12c96780823adb8ed974eb2289f29703b29b/pypandoc-1.4.tar.gz",
"sha256": "e914e6d5f84a76764887e4d909b09d63308725f0cbb5293872c2c92f07c11a5b"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/a2/51/c39562cfed3272592c60cfd229e5464d715b78537e332eac2b695422dc49/regex-2018.02.21.tar.gz",
"sha256": "b44624a38d07d3c954c84ad302c29f7930f4bf01443beef5589e9157b14e2a29"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/9e/54/04d88a59efa33fefb88133ceb638cdf754319030c28aadc5a379d82140ed/pyenchant-2.0.0.tar.gz",
"sha256": "fc31cda72ace001da8fe5d42f11c26e514a91fa8c70468739216ddd8de64e2a0"
}]
},
{
"name": "fonts",
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/share/fonts/",
"cp ttf/* /app/share/fonts/"
],
"sources": [{
"type": "git",
"url": "https://github.com/mozilla/Fira",
"tag": "4.202"
}]
}
]
}

View File

@ -2,7 +2,7 @@
"id": "de.wolfvollprecht.UberWriter.Plugin.WebPhoto",
"runtime": "de.wolfvollprecht.UberWriter",
"branch": "stable",
"sdk": "org.gnome.Sdk//3.26",
"sdk": "org.gnome.Sdk//3.32",
"build-extension": true,
"separate-locales": false,
"appstream-compose": false,

View File

@ -2,7 +2,7 @@
"id": "de.wolfvollprecht.UberWriter.Plugin.TexLive",
"runtime": "de.wolfvollprecht.UberWriter",
"branch": "stable",
"sdk": "org.gnome.Sdk//3.26",
"sdk": "org.gnome.Sdk//3.32",
"build-extension": true,
"separate-locales": false,
"appstream-compose": false,

View File

@ -2,7 +2,7 @@
"id": "de.wolfvollprecht.UberWriter.Plugin.TexLive",
"runtime": "de.wolfvollprecht.UberWriter",
"branch": "stable",
"sdk": "org.gnome.Sdk//3.26",
"sdk": "org.gnome.Sdk//3.32",
"build-extension": true,
"separate-locales": false,
"appstream-compose": false,

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
from os import environ, path
from subprocess import call
if not environ.get('DESTDIR', ''):
PREFIX = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
DATA_DIR = path.join(PREFIX, 'share')
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')])
print("compiling new schemas")
call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0/schemas')])

1
configure vendored
View File

@ -1 +0,0 @@

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>de.wolfvollprecht.UberWriter</id>
<launchable type="desktop-id">de.wolfvollprecht.UberWriter.desktop</launchable>
<id>@app-id@</id>
<launchable type="desktop-id">@app-id@.desktop</launchable>
<name>UberWriter</name>
<summary>An elegant, free distraction GTK+ markdown editor</summary>
<description>
@ -116,5 +116,5 @@
<url type="help">http://uberwriter.github.io/uberwriter</url>
<url type="translate">https://poeditor.com/join/project/gxVzFyXb2x</url>
<update_contact>manuel.genoves_at_gmail.com</update_contact>
<translation type="gettext">uberwriter</translation>
</component>
<translation type="gettext">@gettext-package@</translation>
</component>

View File

@ -3,7 +3,7 @@ Name=UberWriter
Comment=UberWriter, a simple and distraction free Markdown Editor
Categories=GNOME;GTK;Office;
Exec=uberwriter %U
Icon=de.wolfvollprecht.UberWriter
Icon=@icon@
Terminal=false
Type=Application
MimeType=text/x-markdown;text/plain;

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,11 @@
install_data(
'de.wolfvollprecht.UberWriter.svg',
install_dir: datadir / 'icons' / 'hicolor' / 'scalable',
rename: '@0@.svg'.format(application_id)
)
install_data(
'de.wolfvollprecht.UberWriter-symbolic.svg',
install_dir: datadir / 'icons' / 'hicolor' / 'symbolic',
rename: '@0@-symbolic.svg'.format(application_id)
)

73
data/meson.build 100644
View File

@ -0,0 +1,73 @@
# FreeDesktop Desktop File
desktop_conf = configuration_data()
desktop_conf.set('icon', application_id)
desktop_file = i18n.merge_file(
'desktop',
input: configure_file(
input: 'de.wolfvollprecht.UberWriter.desktop.in.in',
output: '@BASENAME@',
configuration: desktop_conf
),
output: '@0@.desktop'.format(application_id),
po_dir: podir,
type: 'desktop',
install: true,
install_dir: get_option('datadir') / 'applications'
)
# Validate Desktop File
desktop_file_validate = find_program('desktop-file-validate', required: false)
if desktop_file_validate.found()
test (
'Validate desktop file',
desktop_file_validate,
args: desktop_file.full_path()
)
endif
# Freedesktop AppData File
appdata_conf = configuration_data()
appdata_conf.set('app-id', application_id)
appdata_conf.set('gettext-package', gettext_package)
appdata_file = i18n.merge_file(
'appdata',
input: configure_file(
input: 'de.wolfvollprecht.UberWriter.appdata.xml.in.in',
output: '@BASENAME@',
configuration: appdata_conf
),
output: '@0@.appdata.xml'.format(application_id),
po_dir: podir,
install: true,
install_dir: get_option('datadir') / 'metainfo'
)
# Validate AppData File
appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test (
'Validate appdata file',
appstream_util,
args: ['validate-relax', '--nonet', appdata_file.full_path()]
)
endif
# Gschema
install_data(
'de.wolfvollprecht.UberWriter.gschema.xml',
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
rename: '@0@.gschema.xml'.format(application_id)
)
subdir('icons')
install_subdir(
'lua',
install_dir: pkgdatadir
)
install_subdir(
'media',
install_dir: pkgdatadir
)
install_subdir(
'ui',
install_dir: pkgdatadir
)

View File

@ -1,134 +0,0 @@
{
"app-id": "de.wolfvollprecht.UberWriter",
"runtime": "org.gnome.Platform",
"runtime-version": "3.28",
"sdk": "org.gnome.Sdk",
"command": "/app/usr/bin/uberwriter",
"finish-args": [
"--socket=x11",
"--share=ipc",
"--filesystem=host",
"--env=IN_FLATPAK=1",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--env=XDG_DATA_DIRS=/app/usr/share",
"--env=PATH=/app/extensions/TexLive/bin:/app/extensions/TexLive/2018/bin/x86_64-linux:/app/usr/bin:/app/bin"
],
"build-options" : {
"env": {
"PYTHON": "python3",
"IN_FLATPAK": "1"
}
},
"add-extensions": {
"de.wolfvollprecht.UberWriter.Plugin": {
"directory": "extensions",
"version": "stable",
"subdirectories": true,
"no-autodownload": true,
"autodelete": true
}
},
"modules": [
{
"name": "uberwriter",
"sources": [
{
"type" : "git",
"url" : "../",
"branch" : "refactoring"
}
],
"build-commands": [
"install -Dm644 flatpak/de.wolfvollprecht.UberWriter.appdata.xml /app/share/appdata/de.wolfvollprecht.UberWriter.appdata.xml "
],
"post-install": [
"glib-compile-schemas /app/usr/share/glib-2.0/schemas",
"install -d /app/extensions"
]
},
{
"name": "pandoc",
"only-arches": [
"x86_64"
],
"buildsystem": "simple",
"build-commands": [
"cp bin/pandoc /app/usr/bin/pandoc",
"cp bin/pandoc-citeproc /app/usr/bin/pandoc-citeproc"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-linux.tar.gz",
"sha256": "06ecd882e42ef9b7390b1c82e1e71b3ea48679181289b9b810a8797825bed8ed"
}
]
},
{
"name": "pipdeps",
"buildsystem": "simple",
"build-commands": [
"pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} pyenchant regex pypandoc"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/5d/c1/45947333669b31bc6b4933308dd07c2aa2fedcec0a95b14eedae993bd449/wheel-0.31.0.tar.gz",
"sha256": "1ae8153bed701cb062913b72429bcf854ba824f973735427681882a688cb55ce"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz",
"sha256": "f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/71/81/00184643e5a10a456b4118fc12c96780823adb8ed974eb2289f29703b29b/pypandoc-1.4.tar.gz",
"sha256": "e914e6d5f84a76764887e4d909b09d63308725f0cbb5293872c2c92f07c11a5b"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/a2/51/c39562cfed3272592c60cfd229e5464d715b78537e332eac2b695422dc49/regex-2018.02.21.tar.gz",
"sha256": "b44624a38d07d3c954c84ad302c29f7930f4bf01443beef5589e9157b14e2a29"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/9e/54/04d88a59efa33fefb88133ceb638cdf754319030c28aadc5a379d82140ed/pyenchant-2.0.0.tar.gz",
"sha256": "fc31cda72ace001da8fe5d42f11c26e514a91fa8c70468739216ddd8de64e2a0"
}
]
},
{
"name": "fonts",
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/share/fonts/",
"cp ttf/* /app/share/fonts/"
],
"sources": [
{
"type": "git",
"url": "https://github.com/mozilla/Fira",
"tag": "4.202"
}
]
},
{
"name": "appdata",
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/share/appdata",
"install -Dm644 de.wolfvollprecht.UberWriter.appdata.xml /app/share/appdata/de.wolfvollprecht.UberWriter.appdata.xml"
],
"sources": [
{
"type": "file",
"path": "de.wolfvollprecht.UberWriter.appdata.xml"
}
]
}
]
}

16
help/meson.build 100644
View File

@ -0,0 +1,16 @@
help_pages = files(
'index.page',
'pandocs-markdown.page',
'preview.page'
)
help_media = files(
'figures/icon.png',
'figures/icon_down.png'
)
gnome.yelp(meson.project_name(),
sources: help_pages,
media: help_media,
symlink_media: true
)

61
meson.build 100644
View File

@ -0,0 +1,61 @@
project(
'uberwriter',
version: '2.2.0',
license: 'GPL2+',
meson_version: '>= 0.50.0'
)
if get_option('profile') == 'development'
profile = 'Devel'
name_suffix = ' (Development)'
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
if vcs_tag == ''
version_suffix = '-devel'
else
version_suffix = '-@0@'.format (vcs_tag)
endif
else
profile = ''
name_suffix = ''
version_suffix = ''
endif
application_id = 'de.wolfvollprecht.UberWriter@0@'.format(profile)
# This doesn't work yet. It's doesn't find the python3 from the sandboxed env first
# python = import('python')
# python3 = python.find_installation('python3')
python = import('python3')
python3 = python.find_python()
if not python3.found()
error('No valid python3 binary found')
else
message('Found python3 binary')
endif
gnome = import('gnome')
i18n = import('i18n')
dependency('glib-2.0')
dependency('gobject-2.0')
dependency('gobject-introspection-1.0')
dependency('gtk+-3.0')
find_program('glib-compile-schemas', required: true)
find_program('gtk-update-icon-cache', required: false)
find_program('update-desktop-database', required: false)
gettext_package = meson.project_name()
localedir = get_option('prefix') / get_option('localedir')
pythondir = get_option('prefix') / python.sysconfig_path('purelib')
datadir = get_option('prefix') / get_option('datadir')
pkgdatadir = datadir / meson.project_name()
podir = meson.source_root() / 'po'
subdir('bin')
subdir('data')
subdir('help')
subdir('po')
meson.add_install_script('build-aux/meson_post_install.py')

View File

@ -0,0 +1,9 @@
option(
'profile',
type: 'combo',
choices: [
'default',
'development'
],
value: 'default'
)

21
po/LINGUAS 100644
View File

@ -0,0 +1,21 @@
ca
ca_ES
cs
de
en_GB
es
eu
fr
hu
it
pl
pt
pt_BR
ru
si
sv
th
tr
vi
zh_CN
zh_TW

0
po/POTFILES.in 100644
View File

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +0,0 @@
find . -name \*.po -execdir sh -c 'msgfmt "$0" -o uberwriter.mo' '{}' \;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
po/meson.build 100644
View File

@ -0,0 +1,2 @@
i18n.gettext(gettext_package, preset: 'glib')

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.