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

Create a Flatpak Package For GTK App #29

Open
wants to merge 12 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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
*~

build
_build/
.flatpak-builder/
.ninja_*
build.ninja
data/writeas

# Files generated by gb
pkg/
bin/
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<li>Work on a single local draft, then publish or save as another file when you're finished</li>
<li>Choose from three different fonts: serif, sans-serif, or monospace</li>
<li>Dark mode on platforms that support it</li>
<li>Publish to Write.as and share your post (<a href="https://write.as/l23z7d6yb0dd5v4c.md">example</a>)</li>
<li>Publish to Write.as and share your posts</li>
<li>Manage published posts with the built-in command-line interface</li>
</ul>
</description>
Expand All @@ -28,7 +28,7 @@
<update_contact>[email protected]</update_contact>

<provides>
<binary>@app_id@</binary>
<binary>@exec@</binary>
</provides>

<screenshots>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Type=Application
Name=Write.as
Comment=Publish a thought in seconds.
Exec=@app_id@
Exec=@exec@
Icon=@app_id@
Terminal=false
MimeType=
Expand Down
20 changes: 16 additions & 4 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,35 @@ icon_sizes = ['16', '24', '32', '48', '64', '128']

foreach i : icon_sizes
install_data(
join_paths('icons', i, meson.project_name() + '.png'),
join_paths('icons', i, 'com.abunchtell.WriteAsDesktop.png'),
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps'),
rename: '@[email protected]'.format(app_id)
)
endforeach

data_conf = configuration_data()
data_conf.set('app_id', app_id)
data_conf.set('exec', executable)
configure_file(
input: 'writeas-gtk.desktop.in',
input: 'com.abunchtell.WriteAsDesktop.desktop.in',
output: '@[email protected]'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'applications')
)
configure_file(
input: 'writeas-gtk.appdata.xml.in',

appdata = configure_file(
input: 'com.abunchtell.WriteAsDesktop.appdata.xml.in',
output: '@[email protected]'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'metainfo')
)

appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test(
'validate-appdata', appstream_util,
args: [
'validate-relax', '--nonet', appdata
]
)
endif
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: com.github.writeas.writeas-gtk
Section: x11
Priority: extra
Maintainer: Write.as <[email protected]>
Build-Depends: meson,
Build-Depends: meson (>= 0.48),
debhelper (>= 9),
libgtk-3-dev,
libgtksourceview-3.0-dev,
Expand Down
6 changes: 2 additions & 4 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ override_dh_auto_clean:

override_dh_auto_configure:
mkdir -p debian/build
cd debian/build && meson --prefix=/usr ../.. -Dplatform=elementary
cd debian/build && meson --prefix=/usr ../.. -Dplatform=elementary -Dauto_build_cli=true

override_dh_auto_build:
cd debian/build && ninja -v && ninja build
cd debian/build && ninja -v

override_dh_auto_test:
cd debian/build && ninja test

override_dh_auto_install:
cd debian/build && DESTDIR=${CURDIR}/debian/com.github.writeas.writeas-gtk ninja install
mkdir -p debian/com.github.writeas.writeas-gtk/usr/bin
cp bin/writeas debian/com.github.writeas.writeas-gtk/usr/bin/
80 changes: 80 additions & 0 deletions flatpak/com.abunchtell.WriteAsDesktop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"app-id": "com.abunchtell.WriteAsDesktop",
"base": "io.elementary.BaseApp",
"base-version": "juno",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.golang"
],
"command": "writeas-gtk",
"finish-args": [
"--socket=wayland",
"--share=ipc",
"--socket=x11",
"--device=dri",
"--share=network",
"--filesystem=~/.writeas:rw"
],
"build-options": {
"append-path": "/usr/lib/sdk/golang/bin/",
"build-args" : [
"--share=network"
],
"env": {
"GOROOT": "/usr/lib/sdk/golang/"
}
},
"modules": [
{
"name": "wl-clipboard",
"buildsystem": "meson",
"config-opts": [
"-Dfishcompletiondir=no"
],
"sources": [
{
"type": "git",
"url": "https://github.com/bugaevc/wl-clipboard.git"
}
]
},
{
"name": "libXmu",
"config-opts": [
"--disable-static",
"--disable-docs"
],
"sources": [
{
"type": "archive",
"url": "https://www.x.org/releases/individual/lib/libXmu-1.1.2.tar.bz2",
"sha256": "756edc7c383254eef8b4e1b733c3bf1dc061b523c9f9833ac7058378b8349d0b"
}
]
},
{
"name": "xclip",
"sources": [
{
"type": "git",
"url": "https://github.com/astrand/xclip.git"
}
]
},
{
"name": "writeas-gtk",
"buildsystem": "meson",
"config-opts": [
"-Dauto_build_cli=true"
],
"sources": [
{
"type": "git",
"url": "https://github.com/writeas/writeas-gtk.git"
}
]
}
]
}
9 changes: 6 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
project('writeas-gtk', ['vala', 'c'],
version: '1.0.2',
license: 'GPL',
meson_version: '>=0.46.0')
meson_version: '>=0.48.0')

i18n = import('i18n')

build_platform = get_option('platform')
if build_platform == 'elementary'
app_id = 'com.github.writeas.writeas-gtk'
executable = 'com.github.writeas.writeas-gtk'
else
app_id = 'writeas-gtk'
app_id = 'com.abunchtell.WriteAsDesktop'
executable = 'writeas-gtk'
endif


conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', app_id)
conf.set_quoted('APP_ID', app_id)
conf.set_quoted('BUILD_PLATFORM', build_platform)
config_h = configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')

run_target('build', command: 'meson/build-cli.sh')
cli_build_script = find_program('meson/build-cli.sh')

subdir('data')
subdir('src')
Expand Down
7 changes: 6 additions & 1 deletion meson/build-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
exec_name=writeas

echo "Building $exec_name CLI..."
gb build github.com/writeas/writeas-cli/cmd/writeas &&
cd $1/src/github.com/writeas/writeas-cli/ && echo "$PWD"&&
go build --mod=vendor -o bin/writeas ./cmd/writeas &&
mv bin/writeas $3/$2 &&
# Cleanup
rm -rf bin/ &&
rm -rf pkg/ &&
echo "Success."
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option('platform', type: 'combo', choices: ['default', 'elementary'], value: 'default')
option('auto_build_cli', type: 'boolean', value: 'false')
2 changes: 1 addition & 1 deletion src/application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class WriteAs.Application : Gtk.Application {
Intl.setlocale(LocaleCategory.ALL, "");
Intl.textdomain("write.as");

application_id = APP_ID + ".desktop";
application_id = APP_ID;
}

public override void activate() {
Expand Down
1 change: 0 additions & 1 deletion src/code.as/core/socks
Submodule socks deleted from 5be269
3 changes: 0 additions & 3 deletions src/github.com/BurntSushi/toml/COMPATIBLE

This file was deleted.

21 changes: 0 additions & 21 deletions src/github.com/BurntSushi/toml/COPYING

This file was deleted.

19 changes: 0 additions & 19 deletions src/github.com/BurntSushi/toml/Makefile

This file was deleted.

Loading