From 844c5c5186117e3bd4f51b555cf6f14e862b67f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sat, 10 Apr 2021 18:24:37 +0200 Subject: [PATCH] Add workaround_gcc_no_pie option to force non-PIE output Certain file managers need this figure out that the executable is actually executable. The problem is further complicated by meson being uncooperative and not implementing its own -Db_pie=false correctly. --- meson.build | 5 ++++- meson_options.txt | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 77bd8288c..ef89b56d1 100644 --- a/meson.build +++ b/meson.build @@ -208,10 +208,13 @@ else '-fomit-frame-pointer', ] endif - if copt_platform == 'mac' + if copt_platform == 'mac' and uopt_static == 'prebuilt' args_ccomp += [ '-mmacosx-version-min=10.9' ] project_link_args += [ '-mmacosx-version-min=10.9' ] endif + if copt_platform == 'lin' and not get_option('b_pie') and get_option('workaround_gcc_no_pie') # nice one, meson + project_link_args += [ '-no-pie' ] + endif project_c_args += args_ccomp project_cpp_args += args_ccomp + [ '-Wno-invalid-offsetof' ] endif diff --git a/meson_options.txt b/meson_options.txt index babfeb3cc..d7db98ee9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -165,3 +165,9 @@ option( value: '', description: 'Update server, only used by snapshots and mods, see \'snapshot_id\' and \'mod_id\'' ) +option( + 'workaround_gcc_no_pie', + type: 'boolean', + value: true, + description: 'Pass -no-pie to gcc manually to work around meson\'s -Db_pie=false doing nothing' +)