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

Add gnome-app template #16

Merged
Merged
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
5 changes: 5 additions & 0 deletions templates/gnome/.gitignore.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/_build
/app
/.flatpak
/.flatpak-builder
/subprojects/**/
675 changes: 675 additions & 0 deletions templates/gnome/COPYING

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions templates/gnome/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ${APP_TITLE}

${APP_SUMMARY}
61 changes: 61 additions & 0 deletions templates/gnome/build-aux/flatpak/${APP_ID}.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
app-id: ${APP_ID}
runtime: org.gnome.Platform
runtime-version: master
sdk: org.gnome.Sdk

command: ${APP_NAME}
finish-args:
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --device=dri

cleanup:
- /include
- /lib/pkgconfig
- /share/pkgconfig
- /man
- /share/doc
- /share/vala
- /share/vala-*
- '*.la'
- '*.a'

modules:

# Libadwaita dependencies

- name: libsass
buildsystem: meson
sources:
- type: git
url: https://github.com/lazka/libsass.git
branch: meson

- name: sassc
buildsystem: meson
sources:
- type: git
url: https://github.com/lazka/sassc.git
branch: meson

# Biography dependencies

- name: libadwaita
buildsystem: meson
config-opts:
- -Dexamples=false
- -Dtests=false
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/libadwaita.git
branch: main

# Biography itself

- name: ${APP_NAME}
builddir: true
buildsystem: meson
sources:
- type: dir
path: ../..
10 changes: 10 additions & 0 deletions templates/gnome/build-aux/meson/build-and-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if [ ! -e _build ]
then
meson _build -Dprefix=$(pwd)/app
fi \
&& ninja -C _build \
&& ninja -C _build install \
&& env \
GSETTINGS_SCHEMA_DIR=./app/share/glib-2.0/schemas \
LD_LIBRARY_PATH=./app/lib64/${APP_NAME} \
./app/bin/${APP_NAME}
22 changes: 22 additions & 0 deletions templates/gnome/build-aux/meson/postinstall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3

from os import environ, path
from subprocess import call

prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = path.join(prefix, 'share')
destdir = environ.get('DESTDIR', '')

# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf',
path.join(datadir, 'icons', 'hicolor')])

print('Updating desktop database...')
call(['update-desktop-database', '-q',
path.join(datadir, 'applications')])

print('Compiling GSettings schemas...')
call(['glib-compile-schemas',
path.join(datadir, 'glib-2.0', 'schemas')])
20 changes: 20 additions & 0 deletions templates/gnome/data/${APP_ID}.appdata.xml.in.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>@APP_ID@</id>
<name>@APP_TITLE@</name>
<summary>@APP_SUMMARY@</summary>
<description>
<p>Some useful description</p>
</description>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<provides>
<binary>@APP_NAME@</binary>
</provides>
<developer_name>${AUTHOR}</developer_name>
<url type="homepage">https://link.to/your/project</url>
<url type="bugtracker">https://link.to/your/project/issues</url>
<content_rating type="oars-1.1"></content_rating>
<releases>
</releases>
</component>
8 changes: 8 additions & 0 deletions templates/gnome/data/${APP_ID}.desktop.in.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=@APP_TITLE@
Icon=@APP_ID@
Exec=@APP_NAME@
Terminal=false
Type=Application
Categories=Utility;GNOME;GTK;
StartupNotify=true
6 changes: 6 additions & 0 deletions templates/gnome/data/${APP_ID}.gschema.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="@APP_NAME@">
<schema id="@APP_ID@" path="@APP_PATH@">

</schema>
</schemalist>
130 changes: 130 additions & 0 deletions templates/gnome/data/icons/hicolor/scalable/apps/${APP_ID}.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions templates/gnome/data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
desktop_file = i18n.merge_file(
input: configure_file(
input: f'@app_id@.desktop.in.in',
output: f'@app_id@.desktop.in',
configuration: conf_data
),
output: f'@app_id@.desktop',
type: 'desktop',
po_dir: '..' / 'po',
install: true,
install_dir: get_option('datadir') / 'applications'
)

desktop_utils = find_program('desktop-file-validate', required: false)
if desktop_utils.found()
test('Validate desktop file', desktop_utils,
args: [desktop_file]
)
endif

appstream_file = i18n.merge_file(
input: configure_file(
input: f'@app_id@.appdata.xml.in.in',
output: f'@app_id@.appdata.xml.in',
configuration: conf_data
),
output: f'@app_id@.appdata.xml',
po_dir: '../po',
install: true,
install_dir: get_option('datadir') / 'appdata'
)

appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test('Validate appstream file', appstream_util,
args: ['validate', appstream_file]
)
endif

gschema_file = configure_file(
input: f'@app_id@.gschema.xml.in',
output: f'@app_id@.gschema.xml',
configuration: conf_data,
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas'
)

compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found()
test('Validate schema file', compile_schemas,
args: ['--strict', '--dry-run', meson.current_build_dir()]
)
endif

scalable_dir = 'icons' / 'hicolor' / 'scalable' / 'apps'
install_data(
scalable_dir / f'@app_id@.svg',
install_dir: get_option('datadir') / scalable_dir
)

symbolic_dir = 'icons' / 'hicolor' / 'symbolic' / 'apps'
install_data(
symbolic_dir / f'@app_id@-symbolic.svg',
install_dir: get_option('datadir') / symbolic_dir
)
Loading