[glib/wip/3v1n0/more-unix-oses: 1/4] meson: Define G_OS_LINUX when host system is Linux




commit 20201250bc1ee4569e49c55d73d0e8654a7ac532
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Oct 19 15:33:42 2022 +0200

    meson: Define G_OS_LINUX when host system is Linux
    
    We happen to have some linux-only code also in generic unix
    code, so expose it as an OS macro and unix-subtype.

 docs/reference/glib/glib-sections.txt.in |  1 +
 glib/docs.c                              | 11 +++++++++++
 meson.build                              |  4 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/docs/reference/glib/glib-sections.txt.in b/docs/reference/glib/glib-sections.txt.in
index 90b0f32585..5478c47951 100644
--- a/docs/reference/glib/glib-sections.txt.in
+++ b/docs/reference/glib/glib-sections.txt.in
@@ -141,6 +141,7 @@ GLIB_VERSION_PREV_STABLE
 <FILE>macros</FILE>
 <SUBSECTION>
 G_OS_DARWIN
+G_OS_LINUX
 G_OS_WIN32
 G_OS_UNIX
 
diff --git a/glib/docs.c b/glib/docs.c
index e2d164625b..0a671bb9ed 100644
--- a/glib/docs.c
+++ b/glib/docs.c
@@ -1658,6 +1658,17 @@
  * Since: 2.76
  */
 
+/**
+ * G_OS_LINUX:
+ *
+ * This macro is defined only on Linux operating systems. So you can bracket
+ * Linux-specific code in `\#ifdef G_OS_LINUX`.
+ *
+ * Note that %G_OS_UNIX is also set.
+ *
+ * Since: 2.76
+ */
+
 /**
  * G_OS_WIN32:
  *
diff --git a/meson.build b/meson.build
index cd9c88e4a4..d4f2610bff 100644
--- a/meson.build
+++ b/meson.build
@@ -237,7 +237,9 @@ if host_system == 'windows'
 else
   glib_os = ['G_OS_UNIX']
 
-  if host_system == 'cygwin'
+  if host_system == 'linux'
+    glib_os += 'G_OS_LINUX'
+  elif host_system == 'cygwin'
     glib_os += 'G_WITH_CYGWIN'
   elif host_system == 'darwin'
     glib_os += 'G_OS_DARWIN'


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