Skip to content

Commit de69cf4

Browse files
committed
add -Dflatpak build option
1 parent 791164f commit de69cf4

5 files changed

Lines changed: 27 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
master
22

3+
- set VIPS_UNLIMITED to disable DoS limits on file load for libvips 8.18+
4+
- unset VIPSHOME in flatpak builds
5+
36
## 4.1.3 17/12/25
47

58
- fix load cancel [keyboqrd]

meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ application_id = 'org.libvips.vipsdisp'
1717
pkg = import('pkgconfig')
1818
gnome = import('gnome')
1919

20+
if get_option('flatpak')
21+
add_project_arguments('-DFLATPAK', language: ['cpp', 'c'])
22+
endif
23+
2024
cc = meson.get_compiler('c')
2125
config_h = configuration_data()
2226

meson_options.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
option('flatpak',
2+
type: 'boolean',
3+
value: false,
4+
description: 'Build for flatpak')
5+
6+

org.libvips.vipsdisp.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@
423423
"name" : "vipsdisp",
424424
"builddir" : true,
425425
"buildsystem" : "meson",
426+
"config-opts" : [
427+
"-Dflatpak=true"
428+
],
426429
"sources" : [
427430
{
428431
"type" : "git",

src/main.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@
77
int
88
main(int argc, char **argv)
99
{
10-
VipsdispApp *app;
11-
int status;
10+
#ifdef FLATPAK
11+
/* In flatpak builds, don't pick up VIPSHOME from the environ, we want the
12+
* value detected for this install.
13+
*/
14+
g_unsetenv("VIPSHOME");
15+
#endif /*FLATPAK*/
16+
17+
// disable DoS limits on libvips 8.19+
18+
g_setenv("VIPS_UNLIMITED", "1", TRUE);
1219

1320
if (VIPS_INIT(argv[0]))
1421
vips_error_exit("unable to start libvips");
@@ -28,9 +35,9 @@ main(int argc, char **argv)
2835
g_setenv("G_DEBUG", "fatal-warnings", FALSE);
2936
#endif /*DEBUG*/
3037

31-
app = vipsdisp_app_new();
38+
VipsdispApp *app = vipsdisp_app_new();
3239

33-
status = g_application_run(G_APPLICATION(app), argc, argv);
40+
int status = g_application_run(G_APPLICATION(app), argc, argv);
3441

3542
vips_shutdown();
3643

0 commit comments

Comments
 (0)