Build AppImage with gtk3

This also fixes #92, fixes the opening of the PDF manual under AppImage,
the default path of images and ecc files under AppImage, and a couple
other minor fixes.

We also now get Continuous Build binaries for all supported OSes when
a PR is merged to the main branch, and a Dev series of binaries in a
draft release when the dev branch is updated.
This commit is contained in:
Stéphane Lesimple
2025-04-14 21:18:11 +02:00
parent 3a37673b3f
commit e5bc7faa73
4 changed files with 287 additions and 36 deletions

View File

@@ -386,6 +386,15 @@ static void update_dotfile()
static void get_base_dirs()
{
/* If specified in environment (for example in AppImage), use it */
if (g_getenv("DVDISASTER_APPIMAGE") && atoi(g_getenv("DVDISASTER_APPIMAGE")) && g_getenv("DOCDIR") && g_getenv("BINDIR"))
{ Closure->binDir = g_strdup(g_getenv("BINDIR"));
Closure->docDir = g_strdup(g_getenv("DOCDIR"));
Verbose("Using paths from environment\n");
goto find_dotfile;
}
/*** Unless completely disabled through a configure option, the
source directory is supposed to hold the most recent files,
so try this first. */
@@ -442,9 +451,7 @@ static void get_base_dirs()
/*** The location of the dotfile depends on the operating system.
Under Unix the users home directory is used. */
#if defined(WITH_EMBEDDED_SRC_PATH_YES) && !defined(SYS_MINGW)
find_dotfile:
#endif /* WITH_EMBEDDED_SRC_PATH_YES */
#ifndef SYS_MINGW
Closure->homeDir = g_strdup(g_getenv("HOME"));
@@ -608,10 +615,16 @@ void InitClosure()
void LocalizedFileDefaults()
{
/* Storing the files in the cwd appears to be a sane default. */
Closure->imageName = g_strdup(_("medium.iso"));
Closure->eccName = g_strdup(_("medium.ecc"));
if (g_getenv("DVDISASTER_APPIMAGE") && atoi(g_getenv("DVDISASTER_APPIMAGE")) && g_getenv("ORIGINAL_PWD"))
{ /* Under AppImage mode, use the ORIGINAL_PWD as the cwd is non-writable. */
Closure->imageName = g_strdup_printf("%s/%s", g_getenv("ORIGINAL_PWD"), _("medium.iso"));
Closure->eccName = g_strdup_printf("%s/%s", g_getenv("ORIGINAL_PWD"), _("medium.ecc"));
}
else
{ /* Storing the files in the cwd appears to be a sane default. */
Closure->imageName = g_strdup(_("medium.iso"));
Closure->eccName = g_strdup(_("medium.ecc"));
}
Closure->dDumpPrefix = g_strdup(_("sector-"));
}

View File

@@ -141,6 +141,35 @@ void GuiShowURL(char *target)
/* close reading end of error pipe */
close(err_pipe[0]);
/* cleanup env if we're called from AppImage */
if (g_getenv("DVDISASTER_APPIMAGE") && atoi(g_getenv("DVDISASTER_APPIMAGE")))
{
const char *namelist[] = {
"GDK_BACKEND",
"GDK_PIXBUF_MODULE_FILE",
"GIO_EXTRA_MODULES",
"GTK_IM_MODULE",
"GTK_IM_MODULE_FILE",
"GTK_MODULES",
"GTK_PATH",
"LD_LIBRARY_PATH",
"NO_AT_BRIDGE",
NULL,
};
for (int i = 0; namelist[i]; i++) {
gchar *original_name = g_strdup_printf("%s_ORIGINAL", namelist[i]);
if (g_getenv(original_name)) {
g_setenv(namelist[i], g_getenv(original_name), 1);
g_unsetenv(original_name);
}
else {
g_unsetenv(namelist[i]);
}
g_free(original_name);
}
g_unsetenv("DVDISASTER_APPIMAGE");
}
/* prepare args and try to exec xdg-open */
argv[argc++] = "xdg-open";