Dmitrijs Ledkovs has proposed merging lp:~xnox/upstart/no-multibuild into 
lp:upstart.

Requested reviews:
  Upstart Reviewers (upstart-reviewers)

For more details, see:
https://code.launchpad.net/~xnox/upstart/no-multibuild/+merge/195471

At the moment xdg.c is compiled twice:

init/Makefile.am compiles init/xdg.c -> init/xdg.o
 - used by init/init and some init/test_* binaries

util/Makefile.am compiles init/xdg.c -> util/xdg.o
 - used by util/initctl and some util/test_* binaries

When subdir-objects option to automake is enabled (which will be the default in 
automake 2.0),
both init/Makefile.am and util/Makefile.am will compile init/xdg.c into 
init/xdg.o.

That's going to be a problem, because at the moment there is conditional 
compilation in xdg.c, and the two xdg.o are different. With subdir-objects, it 
will then fail to compile either one of init/* or util/*

So, I propose to remove the conditional compilation from xdg.c, and move the 
definition of the two variables (user_mode and session_file) from xdg.c into 
conf.c. Those two variables are declared as extern in other places in init/* 
and have a conflicting definition in util/*.

I'm not sure what's the best practice to managing defitions of extern 
variables. I guess we can split them into init/init_externs.c where all externs 
definitions are stored, instead of being scattered around various init/*.c 
files. In practice, xdg.c is the only one that is common across multiple 
subdirs so far.
-- 
https://code.launchpad.net/~xnox/upstart/no-multibuild/+merge/195471
Your team Upstart Reviewers is requested to review the proposed merge of 
lp:~xnox/upstart/no-multibuild into lp:upstart.
=== modified file 'ChangeLog'
--- ChangeLog	2013-11-14 14:28:26 +0000
+++ ChangeLog	2013-11-16 13:03:00 +0000
@@ -1,3 +1,11 @@
+2013-11-16  Dmitrijs Ledkovs  <[email protected]>
+
+	* init/xdg.c, util/Makefile.am, test/Makefile.am, init/conf.c:
+	  - juggle user_mode & session_file from xdg.c to conf.c
+	  - remove INITCTL_BUILD conditional compilation
+	  - make it possible to use the same xdg.o in both init & initctl
+	  - this is in preparation to handle subdir-objects automake option
+
 2013-11-14  James Hunt  <[email protected]>
 
 	* NEWS: Release 1.11

=== modified file 'init/conf.c'
--- init/conf.c	2013-07-16 15:47:12 +0000
+++ init/conf.c	2013-11-16 13:03:00 +0000
@@ -96,6 +96,23 @@
 	__attribute__ ((warn_unused_result));
 
 /**
+ * user_mode:
+ *
+ * If TRUE, upstart runs in user session mode.
+ **/
+int user_mode = FALSE;
+
+/**
+ * session_file:
+ *
+ * Full path to file containing UPSTART_SESSION details (only set when
+ * user_mode in operation).
+ *
+ * File is created on startup and removed on clean shutdown.
+ **/
+const char *session_file = NULL;
+
+/**
  * conf_sources:
  *
  * This list holds the list of known sources of configuration; each item

=== modified file 'init/xdg.c'
--- init/xdg.c	2013-05-30 13:14:49 +0000
+++ init/xdg.c	2013-11-16 13:03:00 +0000
@@ -34,26 +34,6 @@
 #include "paths.h"
 #include "xdg.h"
 
-#ifndef INITCTL_BUILD
-
-/**
- * user_mode:
- *
- * If TRUE, upstart runs in user session mode.
- **/
-int user_mode = FALSE;
-
-/**
- * session_file:
- *
- * Full path to file containing UPSTART_SESSION details (only set when
- * user_mode in operation).
- *
- * File is created on startup and removed on clean shutdown.
- **/
-const char *session_file = NULL;
-
-#endif /* INITCTL_BUILD */
 
 /**
  * get_subdir:

=== modified file 'test/Makefile.am'
--- test/Makefile.am	2013-11-11 16:15:52 +0000
+++ test/Makefile.am	2013-11-16 13:03:00 +0000
@@ -10,7 +10,6 @@
 
 AM_CPPFLAGS = \
 	-DLOCALEDIR="\"$(localedir)\"" \
-	-DINITCTL_BUILD \
 	-DSBINDIR="\"$(sbindir)\"" \
 	-DUPSTART_BINARY="\"$(UPSTART_BINARY)\"" \
 	-DINITCTL_BINARY="\"$(INITCTL_BINARY)\"" \

=== modified file 'util/Makefile.am'
--- util/Makefile.am	2013-11-12 14:00:36 +0000
+++ util/Makefile.am	2013-11-16 13:03:00 +0000
@@ -7,7 +7,6 @@
 
 AM_CPPFLAGS = \
 	-DLOCALEDIR="\"$(localedir)\"" \
-	-DINITCTL_BUILD \
 	-DSBINDIR="\"$(sbindir)\"" \
 	-I$(top_builddir) -I$(top_srcdir) -iquote$(builddir) -iquote$(srcdir) \
 	-I$(top_srcdir)/intl \

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to