Last active
January 15, 2023 02:35
-
-
Save goldstar611/cb0037ee29ae315bb2f0211e69d95799 to your computer and use it in GitHub Desktop.
CHIRP flatpak (python2+gtk2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Resources to buid chirp flatpak locally |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"app-id": "com.danplanet.chirp", | |
"runtime": "org.freedesktop.Platform", | |
"runtime-version": "19.08", | |
"sdk": "org.freedesktop.Sdk", | |
"command": "chirpw", | |
"finish-args": [ | |
"--share=ipc", | |
"--socket=x11", | |
"--socket=wayland", | |
"--filesystem=home", | |
"--share=network", | |
"--device=all" | |
], | |
"modules": [ | |
{ | |
"upstream": "https://github.com/flathub/shared-modules/tree/master/intltool", | |
"name": "intltool", | |
"cleanup": [ | |
"*" | |
], | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz", | |
"sha256": "67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd" | |
} | |
] | |
}, | |
{ | |
"upstream": "https://github.com/flathub/shared-modules/tree/master/gtk2", | |
"name": "gtk2", | |
"cleanup": [ | |
"/bin", | |
"/share/gtk-2.0", | |
"/share/aclocal", | |
"/share/gtk-doc", | |
"/lib/pkgconfig", | |
"/lib/gtk-2.0/include", | |
"/include", | |
"*.la" | |
], | |
"x-cpe": { | |
"product": "gtk+" | |
}, | |
"config-opts": [ | |
"--disable-dependency-tracking", | |
"--disable-gtk-doc-html", | |
"--disable-introspection", | |
"--with-xinput=xfree" | |
], | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://download.gnome.org/sources/gtk+/2.24/gtk+-2.24.32.tar.xz", | |
"sha256": "b6c8a93ddda5eabe3bfee1eb39636c9a03d2a56c7b62828b359bf197943c582e" | |
}, | |
{ | |
"type": "patch", | |
"path": "gtk2-use-adwaita-theme.patch" | |
} | |
] | |
}, | |
{ | |
"upstream": "https://github.com/flathub/shared-modules/tree/master/gtk2", | |
"name": "gnome-themes-extra", | |
"rm-configure": true, | |
"config-opts": [ | |
"--disable-dependency-tracking", | |
"--disable-gtk3-engine" | |
], | |
"cleanup": [ | |
"/share/themes/Adwaita/gtk-3.0", | |
"/share/themes/Adwaita-dark/gtk-3.0", | |
"/share/themes/HighContrast/gtk-3.0", | |
"*.la" | |
], | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://download.gnome.org/sources/gnome-themes-extra/3.28/gnome-themes-extra-3.28.tar.xz", | |
"sha256": "7c4ba0bff001f06d8983cfc105adaac42df1d1267a2591798a780bac557a5819" | |
}, | |
{ | |
"type": "shell", | |
"//": "We want to avoid generating icons as its 99% of the build time and gnome runtime has it", | |
"commands": [ | |
"sed -i 's/icons//' themes/HighContrast/Makefile.am" | |
] | |
}, | |
{ | |
"type": "script", | |
"commands": [ | |
"autoreconf -fsi" | |
] | |
} | |
] | |
}, | |
{ | |
"name": "ensure-gtk2-installed-correctly", | |
"build-commands": [ | |
"pkg-config --print-errors --modversion \"gtk+-2.0\"", | |
"pkg-config --exists --print-errors \"gtk+-2.0 >= 2.8.0\"" | |
] | |
}, | |
{ | |
"upstream": "https://github.com/flathub/shared-modules/tree/master/python2.7", | |
"name": "python-2.7", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz", | |
"sha256": "b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43" | |
} | |
], | |
"config-opts": [ | |
"--enable-shared", | |
"--with-ensurepip=no", | |
"--with-system-expat", | |
"--with-system-ffi", | |
"--enable-loadable-sqlite-extensions=no", | |
"--with-dbmliborder=gdbm", | |
"--enable-unicode=ucs4" | |
], | |
"post-install": [ | |
"chmod 644 $FLATPAK_DEST/lib/libpython2.7.so.1.0" | |
], | |
"cleanup": [ | |
"/bin/2to3*", | |
"/bin/easy_install*", | |
"/bin/idle*", | |
"/bin/pydoc*", | |
"/bin/python*-config", | |
"/bin/pyvenv*", | |
"/include", | |
"/lib/pkgconfig", | |
"/lib/python*/config", | |
"/share", | |
"/lib/python*/test", | |
"/lib/python*#/test", | |
"/lib/python*#/tests", | |
"/lib/python*/lib-tk/test", | |
"/lib/python*/lib-dynload/_*_test.*.so", | |
"/lib/python*/lib-dynload/_test*.*.so", | |
"/lib/python*/idlelib", | |
"/lib/python*/tkinter*", | |
"/lib/python*/turtle*", | |
"/lib/python*/lib2to3*", | |
"/lib/python2.7/config/libpython2.7.a" | |
] | |
}, | |
{ | |
"name": "pycairo", | |
"buildsystem": "simple", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://github.com/pygobject/pycairo/releases/download/v1.13.1/pycairo-1.13.1.tar.gz", | |
"sha256": "d8f58de67ddd01eda9e5112de57599b7d0154d71c9474821e98866c228794641" | |
} | |
], | |
"build-commands": [ | |
"python2 setup.py install" | |
] | |
}, | |
{ | |
"name": "pygobject", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://download.gnome.org/sources/pygobject/2.28/pygobject-2.28.7.tar.xz", | |
"sha256": "bb9d25a3442ca7511385a7c01b057492095c263784ef31231ffe589d83a96a5a" | |
} | |
] | |
}, | |
{ | |
"why_is_this_here": "pygtk 2.24 does not compile with pango-1.44 so downgrade it. TODO See if CHIRP runs without pango.", | |
"name": "pango-1.42", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://download.gnome.org/sources/pango/1.42/pango-1.42.4.tar.xz", | |
"sha256": "1d2b74cd63e8bd41961f2f8d952355aa0f9be6002b52c8aa7699d9f5da597c9d" | |
} | |
] | |
}, | |
{ | |
"name": "pygtk", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://download.gnome.org/sources/pygtk/2.24/pygtk-2.24.0.tar.gz", | |
"sha256": "6e3e54fa6e65a69ac60bd58cb2e60a57f3346ac52efe995f3d10b6c38c972fd8" | |
} | |
] | |
}, | |
{ | |
"name": "libxml2", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "http://xmlsoft.org/sources/libxml2-2.9.9.tar.gz", | |
"sha256": "94fb70890143e3c6549f265cee93ec064c80a84c42ad0f23e85ee1fd6540a871" | |
} | |
] | |
}, | |
{ | |
"name": "pyserial", | |
"buildsystem": "simple", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://github.com/pyserial/pyserial/releases/download/v3.2.1/pyserial-3.2.1.tar.gz", | |
"sha256": "1eecfe4022240f2eab5af8d414f0504e072ee68377ba63d3b6fe6e66c26f66d1" | |
} | |
], | |
"build-commands": [ | |
"python2 setup.py install" | |
] | |
}, | |
{ | |
"name": "python-future", | |
"upstream": "https://github.com/PythonCharmers/python-future", | |
"buildsystem": "simple", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz", | |
"sha256": "b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d" | |
} | |
], | |
"build-commands": [ | |
"python2 setup.py install" | |
] | |
}, | |
{ | |
"name": "python-suds", | |
"buildsystem": "simple", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://github.com/suds-community/suds/archive/v0.8.4.tar.gz", | |
"sha256": "3fc1c6dc961e0c9b421e8355bff45104e8db7edb8764b33939c4a84afa98116e" | |
} | |
], | |
"build-commands": [ | |
"python2 setup.py install" | |
] | |
}, | |
{ | |
"name": "chirp", | |
"buildsystem": "simple", | |
"sources": [ | |
{ | |
"type": "archive", | |
"url": "https://trac.chirp.danplanet.com/chirp_daily/LATEST/chirp-daily-20200430.tar.gz", | |
"sha256": "aaed524cc8c991f9f9cacd4cea6b0569ba0befe95a2937b999d9ddfae8fd0e18" | |
} | |
], | |
"build-commands": [ | |
"python2 setup.py install" | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c | |
index 186a8f5cb2..f5c39b5afe 100644 | |
--- a/gdk/x11/gdkevents-x11.c | |
+++ b/gdk/x11/gdkevents-x11.c | |
@@ -3000,6 +3000,50 @@ check_transform (const gchar *xsettings_name, | |
return TRUE; | |
} | |
+static gchar * | |
+gtk_rc_get_theme_dir (void) | |
+{ | |
+ const gchar *var; | |
+ gchar *path; | |
+ | |
+ var = g_getenv ("GTK_DATA_PREFIX"); | |
+ | |
+ if (var) | |
+ path = g_build_filename (var, "share", "themes", NULL); | |
+ else | |
+ path = g_build_filename ("/usr", "share", "themes", NULL); | |
+ | |
+ return path; | |
+} | |
+ | |
+static gboolean | |
+theme_name_valid (XSettingsSetting *setting) | |
+{ | |
+ gboolean res = FALSE; | |
+ | |
+ if (setting->type == XSETTINGS_TYPE_STRING) | |
+ { | |
+ char *theme_name = setting->data.v_string; | |
+ gchar *theme_dir = gtk_rc_get_theme_dir (); | |
+ gchar *path = g_build_filename (theme_dir, theme_name, "gtk-2.0", "gtkrc", NULL); | |
+ | |
+ if (g_file_test (path, G_FILE_TEST_EXISTS)) | |
+ res = TRUE; | |
+ else if (g_str_has_suffix (theme_name, "-Dark") || | |
+ g_str_has_suffix (theme_name, "-dark")) | |
+ { | |
+ setting->data.v_string = g_strdup ("Adwaita-dark"); | |
+ g_free (theme_name); | |
+ res = TRUE; | |
+ } | |
+ | |
+ g_free (theme_dir); | |
+ g_free (path); | |
+ } | |
+ | |
+ return res; | |
+} | |
+ | |
/** | |
* gdk_screen_get_setting: | |
* @screen: the #GdkScreen where the setting is located | |
@@ -3050,6 +3094,11 @@ gdk_screen_get_setting (GdkScreen *screen, | |
if (result != XSETTINGS_SUCCESS) | |
goto out; | |
+ if (strcmp (name, "gtk-theme-name") == 0 && | |
+ (setting->type != XSETTINGS_TYPE_STRING || | |
+ !theme_name_valid (setting))) | |
+ goto out; | |
+ | |
switch (setting->type) | |
{ | |
case XSETTINGS_TYPE_INT: | |
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c | |
index 3fbbf00548..5c0a4b33d2 100644 | |
--- a/gtk/gtksettings.c | |
+++ b/gtk/gtksettings.c | |
@@ -312,7 +312,7 @@ gtk_settings_class_init (GtkSettingsClass *class) | |
#ifdef G_OS_WIN32 | |
"MS-Windows", | |
#else | |
- "Raleigh", | |
+ "Adwaita", | |
#endif | |
GTK_PARAM_READWRITE), | |
NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: all export run clean dist-clean get_sdk | |
# `make run` will start chirpw | |
# `make run python` will start the python interpreter inside the flatpak | |
# `make run bash` will start bash shell inside the flatpak | |
args = $(filter-out $@,$(MAKECMDGOALS)) | |
CMD ?= $(if $(args),$(args),chirpw) | |
all: | |
flatpak-builder --force-clean build-dir --repo repo/ com.danplanet.chirp.yml | tee build.txt | |
export: all | |
flatpak build-bundle repo/ chirp.flatpak com.danplanet.chirp | |
run: all | |
flatpak-builder --run build-dir com.danplanet.chirp.yml $(CMD) | |
clean: | |
rm -rf repo/ | |
dist-clean: | |
rm -rf repo/ | |
rm -rf build-dir/ | |
rm -rf .flatpak-builder/ | |
get_sdk: | |
flatpak install flathub org.freedesktop.Platform flatpak install org.freedesktop.Sdk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gnome 3.36 SDK doesn't include gtk-2.0. I have an issue open in their gitlab at https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/271