buildsys: Compile daemon code directly with binary
A long time ago we de-duplicated the daemon and binary into a single executable, but left the daemon code building as an internal static library. Let's take the next step and compile the sources directly as part of the executable build. For example, we can then de-duplicate the `CFLAGS/CXXFLAGS`. And in the future this will help us turn on LTO.
This commit is contained in:
parent
3e025d9b92
commit
ec5bdca9e5
@ -1,3 +1,7 @@
|
|||||||
|
# This file used to declare a separate libtool static library.
|
||||||
|
# Now that the daemon and binary are the same thing, we have
|
||||||
|
# Makefile-rpm-ostree.am reuse these variables.
|
||||||
|
|
||||||
dbus_built_sources = rpm-ostreed-generated.h rpm-ostreed-generated.c
|
dbus_built_sources = rpm-ostreed-generated.h rpm-ostreed-generated.c
|
||||||
|
|
||||||
# TODO: Add --c-generate-autocleanup=all once we depend on GLib 2.50+
|
# TODO: Add --c-generate-autocleanup=all once we depend on GLib 2.50+
|
||||||
@ -19,10 +23,7 @@ CLEANFILES += rpm-ostreed-generated-org.projectatomic.rpmostree1.OS.xml \
|
|||||||
rpm-ostreed-generated-org.projectatomic.rpmostree1.Transaction.xml \
|
rpm-ostreed-generated-org.projectatomic.rpmostree1.Transaction.xml \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
noinst_LTLIBRARIES += librpmostreed.la
|
librpmostreed_sources = \
|
||||||
nodist_librpmostreed_la_SOURCES = $(dbus_built_sources)
|
|
||||||
|
|
||||||
librpmostreed_la_SOURCES = \
|
|
||||||
src/daemon/rpmostreed-types.h \
|
src/daemon/rpmostreed-types.h \
|
||||||
src/daemon/rpmostreed-daemon.h \
|
src/daemon/rpmostreed-daemon.h \
|
||||||
src/daemon/rpmostreed-daemon.c \
|
src/daemon/rpmostreed-daemon.c \
|
||||||
@ -51,25 +52,6 @@ librpmostreed_la_SOURCES = \
|
|||||||
src/daemon/rpmostreed-os-experimental.c \
|
src/daemon/rpmostreed-os-experimental.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
rpmostreed_common_cflags = $(PKGDEP_RPMOSTREE_CFLAGS) \
|
|
||||||
-DG_LOG_DOMAIN=\"rpm-ostreed\" \
|
|
||||||
-fvisibility=hidden \
|
|
||||||
-D_RPMOSTREE_EXTERN= \
|
|
||||||
-I$(srcdir)/src/daemon \
|
|
||||||
-I$(srcdir)/src/lib \
|
|
||||||
-I$(srcdir)/src/libpriv \
|
|
||||||
-I$(libglnx_srcpath) \
|
|
||||||
$(NULL)
|
|
||||||
librpmostreed_la_CFLAGS = $(AM_CFLAGS) $(rpmostreed_common_cflags)
|
|
||||||
librpmostreed_la_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_common_cflags)
|
|
||||||
|
|
||||||
librpmostreed_la_LIBADD = \
|
|
||||||
$(PKGDEP_RPMOSTREE_LIBS) \
|
|
||||||
librpmostreepriv.la \
|
|
||||||
librpmostree-1.la \
|
|
||||||
$(CAP_LIBS)
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
dbusconf_DATA = $(srcdir)/src/daemon/org.projectatomic.rpmostree1.conf
|
dbusconf_DATA = $(srcdir)/src/daemon/org.projectatomic.rpmostree1.conf
|
||||||
dbusconfdir = $(datadir)/dbus-1/system.d
|
dbusconfdir = $(datadir)/dbus-1/system.d
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
bin_PROGRAMS += rpm-ostree
|
bin_PROGRAMS += rpm-ostree
|
||||||
|
|
||||||
rpm_ostree_SOURCES = src/app/main.cxx \
|
rpm_ostree_SOURCES = src/app/main.cxx \
|
||||||
rpm-ostreed-generated.h \
|
|
||||||
rpm-ostreed-generated.c \
|
|
||||||
src/app/rpmostree-builtins.h \
|
src/app/rpmostree-builtins.h \
|
||||||
src/app/rpmostree-db-builtins.h \
|
src/app/rpmostree-db-builtins.h \
|
||||||
src/app/rpmostree-compose-builtins.h \
|
src/app/rpmostree-compose-builtins.h \
|
||||||
@ -62,6 +60,7 @@ rpm_ostree_SOURCES = src/app/main.cxx \
|
|||||||
src/app/rpmostree-composeutil.cxx \
|
src/app/rpmostree-composeutil.cxx \
|
||||||
src/app/rpmostree-composeutil.h \
|
src/app/rpmostree-composeutil.h \
|
||||||
src/app/rpmostree-builtin-compose.c \
|
src/app/rpmostree-builtin-compose.c \
|
||||||
|
$(librpmostreed_sources) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if BUILDOPT_ROJIG
|
if BUILDOPT_ROJIG
|
||||||
@ -72,12 +71,18 @@ rpm_ostree_SOURCES += \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
nodist_rpm_ostree_SOURCES = $(dbus_built_sources)
|
||||||
|
|
||||||
rpmostree_common_cflags = -I$(srcdir)/src/app -I$(srcdir)/src/daemon \
|
rpmostree_common_cflags = -I$(srcdir)/src/app -I$(srcdir)/src/daemon \
|
||||||
-I$(srcdir)/src/lib -I$(srcdir)/src/libpriv -I$(libglnx_srcpath) \
|
-I$(srcdir)/src/lib -I$(srcdir)/src/libpriv -I$(libglnx_srcpath) \
|
||||||
-fvisibility=hidden -DPKGLIBDIR=\"$(pkglibdir)\" $(PKGDEP_RPMOSTREE_CFLAGS)
|
-fvisibility=hidden \
|
||||||
|
-DG_LOG_DOMAIN=\"rpm-ostreed\" \
|
||||||
|
-DLIBDIR=\"$(libdir)\" -DPKGLIBDIR=\"$(pkglibdir)\" \
|
||||||
|
$(PKGDEP_RPMOSTREE_CFLAGS)
|
||||||
rpm_ostree_CFLAGS = $(AM_CFLAGS) $(rpmostree_common_cflags)
|
rpm_ostree_CFLAGS = $(AM_CFLAGS) $(rpmostree_common_cflags)
|
||||||
rpm_ostree_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_common_cflags)
|
rpm_ostree_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_common_cflags)
|
||||||
rpm_ostree_LDADD = $(PKGDEP_RPMOSTREE_LIBS) librpmostreepriv.la librpmostree-1.la librpmostreed.la
|
rpm_ostree_LDADD = $(PKGDEP_RPMOSTREE_LIBS) $(CAP_LIBS) libglnx.la librpmostreepriv.la librpmostree-1.la
|
||||||
|
EXTRA_rpm_ostree_DEPENDENCIES = libdnf.so.2
|
||||||
|
|
||||||
privdatadir=$(pkglibdir)
|
privdatadir=$(pkglibdir)
|
||||||
privdata_DATA = src/app/rpm-ostree-0-integration.conf
|
privdata_DATA = src/app/rpm-ostree-0-integration.conf
|
||||||
|
@ -220,9 +220,6 @@ _rpm_ostree_package_list_for_commit (OstreeRepo *repo,
|
|||||||
* wants to link to this shared library too. So for now if we don't
|
* wants to link to this shared library too. So for now if we don't
|
||||||
* find the pkglist in the commit metadata, just return as if it's
|
* find the pkglist in the commit metadata, just return as if it's
|
||||||
* empty.
|
* empty.
|
||||||
*
|
|
||||||
* TODO: Rework this to run via the special shlib-ipc that is used
|
|
||||||
* in rpmostree.c.
|
|
||||||
*/
|
*/
|
||||||
g_autoptr(GVariant) pkglist_v = get_commit_rpmdb_pkglist (commit);
|
g_autoptr(GVariant) pkglist_v = get_commit_rpmdb_pkglist (commit);
|
||||||
if (!pkglist_v)
|
if (!pkglist_v)
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
* These APIs access generic global state.
|
* These APIs access generic global state.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define IPC_FD 3
|
|
||||||
|
|
||||||
GVariant *
|
GVariant *
|
||||||
_rpmostree_shlib_ipc_send (const char *variant_type, char **args, const char *wd, GError **error)
|
_rpmostree_shlib_ipc_send (const char *variant_type, char **args, const char *wd, GError **error)
|
||||||
{
|
{
|
||||||
@ -49,7 +47,7 @@ _rpmostree_shlib_ipc_send (const char *variant_type, char **args, const char *wd
|
|||||||
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, pair) < 0)
|
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, pair) < 0)
|
||||||
return (GVariant*)glnx_null_throw_errno_prefix (error, "couldn't create socket pair");
|
return (GVariant*)glnx_null_throw_errno_prefix (error, "couldn't create socket pair");
|
||||||
glnx_fd_close int my_sock_fd = glnx_steal_fd (&pair[0]);
|
glnx_fd_close int my_sock_fd = glnx_steal_fd (&pair[0]);
|
||||||
g_subprocess_launcher_take_fd (launcher, pair[1], IPC_FD);
|
g_subprocess_launcher_take_fd (launcher, pair[1], RPMOSTREE_SHLIB_IPC_FD);
|
||||||
|
|
||||||
if (wd != NULL)
|
if (wd != NULL)
|
||||||
g_subprocess_launcher_set_cwd (launcher, wd);
|
g_subprocess_launcher_set_cwd (launcher, wd);
|
||||||
@ -87,6 +85,7 @@ _rpmostree_shlib_ipc_send (const char *variant_type, char **args, const char *wd
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
g_assert_cmpint (r, ==, 1);
|
g_assert_cmpint (r, ==, 1);
|
||||||
|
g_assert_cmphex (buffer[0], ==, 0xFF);
|
||||||
|
|
||||||
if (nm != 1)
|
if (nm != 1)
|
||||||
return glnx_null_throw (error, "Got %d control messages, expected 1", nm);
|
return glnx_null_throw (error, "Got %d control messages, expected 1", nm);
|
||||||
|
Loading…
Reference in New Issue
Block a user