]> git.mdlowis.com Git - proto/labwc.git/commitdiff
build: add 'sections' option to show unused functions
authorJohan Malm <jgm323@gmail.com>
Fri, 26 Sep 2025 16:47:47 +0000 (17:47 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 29 Sep 2025 19:22:46 +0000 (20:22 +0100)
meson.build
meson_options.txt

index 5f4cfe9b4bbc79fabe9ef093322beaeb41640c34..0ac5cea1804744aa3a0f16c151578a7e44ad6fb1 100644 (file)
@@ -134,6 +134,15 @@ if get_option('static_analyzer').enabled()
   add_project_arguments(['-fanalyzer'], language: 'c')
 endif
 
+link_args = []
+if get_option('sections').enabled()
+  add_project_arguments(['-ffunction-sections'], language: 'c')
+  link_args += [
+    '-Wl,--gc-sections',
+    '-Wl,--print-gc-sections',
+  ]
+endif
+
 msgfmt = find_program('msgfmt', required: get_option('nls'))
 if msgfmt.found()
   source_root = meson.current_source_dir()
@@ -193,6 +202,7 @@ executable(
   include_directories: [labwc_inc],
   dependencies: labwc_deps,
   install: true,
+  link_args: link_args,
 )
 
 install_data('data/labwc.desktop', install_dir: get_option('datadir') / 'wayland-sessions')
index ec3fe85d9805c608628097aaa78ef07b50087f0c..a3da65a8be63ef0d1ee2b5ebb2c32d4a48cc5eba 100644 (file)
@@ -5,3 +5,4 @@ option('icon', type: 'feature', value: 'enabled', description: 'Enable window ic
 option('nls', type: 'feature', value: 'auto', description: 'Enable native language support')
 option('static_analyzer', type: 'feature', value: 'disabled', description: 'Run gcc static analyzer')
 option('test', type: 'feature', value: 'disabled', description: 'Run tests')
+option('sections', type: 'feature', value: 'disabled', description: 'Show unused functions')