[libgepub] build: Removed flags available as meson options



commit cb480cf394e53edf5e7f76d1de29fad227579fc6
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Jun 22 18:59:50 2017 +0200

    build: Removed flags available as meson options
    
    Removed CFLAGS and LDFLAGS that can be enabled by using meson
    options.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784097

 libgepub/meson.build |    1 -
 meson.build          |   93 ++++++++++++++++++++++---------------------------
 2 files changed, 42 insertions(+), 52 deletions(-)
---
diff --git a/libgepub/meson.build b/libgepub/meson.build
index e2bcf84..cf61d29 100644
--- a/libgepub/meson.build
+++ b/libgepub/meson.build
@@ -26,7 +26,6 @@ sources = files(
 symbol_map = 'gepub.map'
 
 ldflags = [
-  '-no-undefined',
   '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbol_map)
 ]
 
diff --git a/meson.build b/meson.build
index ec9e361..5848b8a 100644
--- a/meson.build
+++ b/meson.build
@@ -58,57 +58,48 @@ config_h.set('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h'))
 config_h.set('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h'))
 config_h.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
 
-# Compiler flags
-test_cflags = [
-  '-fno-strict-aliasing',
-  '-Wall',
-  '-Warray-bounds',
-  '-Wcast-align',
-  '-Wdeclaration-after-statement',
-  '-Wextra',
-  '-Wformat-nonliteral',
-  '-Wformat-security',
-  '-Wformat=2',
-  '-Wimplicit-function-declaration',
-  '-Winit-self',
-  '-Winline',
-  '-Wmissing-declarations',
-  '-Wmissing-format-attribute',
-  '-Wmissing-include-dirs',
-  '-Wmissing-noreturn',
-  '-Wmissing-prototypes',
-  '-Wnested-externs',
-  '-Wno-error=missing-field-initializers',
-  '-Wno-error=unused-parameter',
-  '-Wno-missing-field-initializers',
-  '-Wno-unused-parameter',
-  '-Wold-style-definition',
-  '-Wpacked',
-  '-Wpointer-arith',
-  '-Wredundant-decls',
-  '-Wreturn-type',
-  '-Wshadow',
-  '-Wsign-compare',
-  '-Wstrict-aliasing',
-  '-Wstrict-prototypes',
-  '-Wswitch-default',
-  '-Wswitch-enum',
-  '-Wundef',
-  '-Wunused-but-set-variable',
-  '-Wwrite-strings'
-]
-
-common_flags = [
-  '-DHAVE_CONFIG_H'
-]
-
-foreach cflag: test_cflags
-  if cc.has_argument(cflag)
-    common_flags += [cflag]
-  endif
-endforeach
-
-add_project_arguments(common_flags, language: 'c')
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+
+buildtype = get_option('buildtype')
+if buildtype == 'debug' or buildtype == 'debugoptimized'
+  test_cflags = [
+    '-fno-strict-aliasing',
+    '-Wcast-align',
+    '-Wdeclaration-after-statement',
+    '-Wformat-nonliteral',
+    '-Wformat=2',
+    '-Winit-self',
+    '-Winline',
+    '-Wmissing-declarations',
+    '-Wmissing-format-attribute',
+    '-Wmissing-include-dirs',
+    '-Wmissing-noreturn',
+    '-Wmissing-prototypes',
+    '-Wnested-externs',
+    '-Wno-error=missing-field-initializers',
+    '-Wno-error=unused-parameter',
+    '-Wno-missing-field-initializers',
+    '-Wno-unused-parameter',
+    '-Wold-style-definition',
+    '-Wpacked',
+    '-Wredundant-decls',
+    '-Wshadow',
+    '-Wstrict-prototypes',
+    '-Wswitch-enum',
+    '-Wundef',
+    '-Wunused-but-set-variable',
+    '-Wwrite-strings'
+  ]
+
+  foreach cflag: test_cflags
+    if cc.has_argument(cflag)
+      common_flags += [cflag]
+    endif
+  endforeach
+
+  add_project_arguments(common_flags, language: 'c')
+endif
 
 gepub_deps = [
   dependency('webkit2gtk-4.0'),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]