Skip to content

Commit

Permalink
Merge pull request #2905 from cgwalters/prepare-root-static-split
Browse files Browse the repository at this point in the history
Separate prepare-root static path + link to glib
  • Loading branch information
cgwalters authored Jul 4, 2023
2 parents 8ad8a79 + 875915f commit 9104c54
Show file tree
Hide file tree
Showing 3 changed files with 420 additions and 84 deletions.
26 changes: 15 additions & 11 deletions Makefile-switchroot.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <https://www.gnu.org/licenses/>.

ostree_prepare_root_SOURCES = \
src/switchroot/ostree-mount-util.h
ostree_prepare_root_CFLAGS =
ostree_prepare_root_CPPFLAGS = $(AM_CPPFLAGS)
ostree_prepare_root_LDADD =

if BUILDOPT_SYSTEMD
ostree_boot_PROGRAMS += ostree-remount
else
Expand All @@ -23,15 +29,9 @@ else
check_PROGRAMS += ostree-remount
endif

ostree_prepare_root_SOURCES = \
src/switchroot/ostree-mount-util.h \
src/switchroot/ostree-prepare-root.c \
$(NULL)
ostree_prepare_root_CFLAGS =
ostree_prepare_root_CPPFLAGS = $(AM_CPPFLAGS)
ostree_prepare_root_LDADD =

if BUILDOPT_USE_STATIC_COMPILER
ostree_prepare_root_SOURCES += src/switchroot/ostree-prepare-root-static.c

# ostree-prepare-root can be used as init in a system without a populated /lib.
# To support this use case we need to link statically as we will be unable to
# locate libc.so at run time if it's not installed in /lib.
Expand All @@ -45,12 +45,16 @@ if BUILDOPT_USE_STATIC_COMPILER
ostree_boot_SCRIPTS += ostree-prepare-root

ostree-prepare-root : $(ostree_prepare_root_SOURCES)
$(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) -DOSTREE_PREPARE_ROOT_STATIC=1
$(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root-static.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) -DOSTREE_PREPARE_ROOT_STATIC=1
CLEANFILES += ostree-prepare-root
else
ostree_boot_PROGRAMS += ostree-prepare-root
ostree_prepare_root_CFLAGS += $(AM_CFLAGS) -Isrc/switchroot -I$(srcdir)/composefs
endif
ostree_prepare_root_SOURCES += src/switchroot/ostree-prepare-root.c
ostree_prepare_root_CPPFLAGS += $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I $(srcdir)/libglnx
ostree_prepare_root_LDADD += $(AM_LDFLAGS) $(OT_INTERNAL_GIO_UNIX_LIBS) libglnx.la
endif # BUILDOPT_USE_STATIC_COMPILER


ostree_remount_SOURCES = \
src/switchroot/ostree-mount-util.h \
Expand All @@ -65,7 +69,7 @@ endif

if BUILDOPT_SYSTEMD
ostree_prepare_root_CPPFLAGS += -DHAVE_SYSTEMD=1
ostree_prepare_root_LDADD += $(AM_LDFLAGS) $(LIBSYSTEMD_LIBS)
ostree_prepare_root_LDADD += $(LIBSYSTEMD_LIBS)
endif

# This is the "new mode" of using a generator for /var; see
Expand Down
Loading

0 comments on commit 9104c54

Please sign in to comment.