summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-05-23 09:16:27 -0400
committerXavier Claessens <xclaesse@gmail.com>2018-05-25 03:06:07 +0000
commitead46cdc7e70db6bd5c1535a0d2574e4b14803b8 (patch)
treebd1bd3d7f713b7a7942bc5352d478759bc1c58d7
parent534e939500706af0ea02b56cffa22202014f578e (diff)
downloadglib-ead46cdc7e70db6bd5c1535a0d2574e4b14803b8.tar.gz
Revert "Revert "Rename objective-c files from .c to .m""
This reverts commit 2e9f3a9afe4c5cb1ebdda5e33e6fd3552bf56d38.
-rw-r--r--gio/Makefile.am23
-rw-r--r--gio/gcocoanotificationbackend.m (renamed from gio/gcocoanotificationbackend.c)0
-rw-r--r--gio/gnextstepsettingsbackend.m (renamed from gio/gnextstepsettingsbackend.c)0
-rw-r--r--gio/gosxappinfo.m (renamed from gio/gosxappinfo.c)0
-rw-r--r--gio/gosxcontenttype.m (renamed from gio/gosxcontenttype.c)0
-rw-r--r--gio/meson.build12
6 files changed, 23 insertions, 12 deletions
diff --git a/gio/Makefile.am b/gio/Makefile.am
index df4f24014..bf2b40fd0 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -602,10 +602,25 @@ libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
-export-dynamic $(no_undefined)
if OS_COCOA
-# Let's avoid polluting the CFLAGS of libgio with -xobjective-c
-# We cannot simply rename the ObjC files to .m because it plays
-# tricks with Automake. For further reference, see:
-# https://bugzilla.gnome.org/show_bug.cgi?id=672777
+# We cannot build .m files because it would require adding AC_PROG_OBJC in
+# configure.ac, and it cannot be added conditionally. That means we would always
+# depend on an objective-c compiler even when not needed. To work around that
+# limitation we rename .m files to .c and compile them separately with
+# -xobjective-c into an intermediary library. Note that we cannot rename those
+# files to .c directly in the source tree because Meson needs the .m extension.
+# See https://bugzilla.gnome.org/show_bug.cgi?id=672777.
+OBJC_FILES = \
+ gnextstepsettingsbackend.m \
+ gosxcontenttype.m \
+ gosxappinfo.m \
+ gcocoanotificationbackend.m \
+ $(NULL)
+OBJC_C_FILES = $(OBJC_FILES:.m=.c)
+BUILT_SOURCES += $(OBJC_C_FILES)
+CLEANFILES += $(OBJC_C_FILES)
+$(OBJC_C_FILES): %.c: %.m Makefile
+ cp $< $@
+
libgio_objc_2_0_la_CFLAGS = $(libgio_2_0_la_CFLAGS) -xobjective-c
libgio_objc_2_0_la_CPPFLAGS = $(libgio_2_0_la_CPPFLAGS)
libgio_objc_2_0_la_LDFLAGS = $(libgio_2_0_la_LDFLAGS) -Wl,-framework,Foundation -Wl,-framework,AppKit
diff --git a/gio/gcocoanotificationbackend.c b/gio/gcocoanotificationbackend.m
index ae4ad8833..ae4ad8833 100644
--- a/gio/gcocoanotificationbackend.c
+++ b/gio/gcocoanotificationbackend.m
diff --git a/gio/gnextstepsettingsbackend.c b/gio/gnextstepsettingsbackend.m
index 44ea845d8..44ea845d8 100644
--- a/gio/gnextstepsettingsbackend.c
+++ b/gio/gnextstepsettingsbackend.m
diff --git a/gio/gosxappinfo.c b/gio/gosxappinfo.m
index 463b2da3c..463b2da3c 100644
--- a/gio/gosxappinfo.c
+++ b/gio/gosxappinfo.m
diff --git a/gio/gosxcontenttype.c b/gio/gosxcontenttype.m
index 52ba5763a..52ba5763a 100644
--- a/gio/gosxcontenttype.c
+++ b/gio/gosxcontenttype.m
diff --git a/gio/meson.build b/gio/meson.build
index 42f67715d..8d542bcfe 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -292,11 +292,6 @@ if host_system == 'windows'
settings_sources += files('gregistrysettingsbackend.c')
endif
-# FIXME:
-#if OS_COCOA
-#settings_sources += files('gnextstepsettingsbackend.c')
-#endif
-
application_headers = files(
'gapplication.h',
'gapplicationcommandline.h',
@@ -412,10 +407,11 @@ if host_system != 'windows'
)
if glib_have_cocoa
- contenttype_sources += files('gosxcontenttype.c')
- appinfo_sources += files('gosxappinfo.c')
+ settings_sources += files('gnextstepsettingsbackend.m')
+ contenttype_sources += files('gosxcontenttype.m')
+ appinfo_sources += files('gosxappinfo.m')
if glib_have_os_x_9_or_later
- unix_sources += files('gcocoanotificationbackend.c')
+ unix_sources += files('gcocoanotificationbackend.m')
endif
else
contenttype_sources += files('gcontenttype.c')