Skip to content

Commit

Permalink
Switch to using libhif as a git submodule
Browse files Browse the repository at this point in the history
So I was trying to hack on my host's copy of rpm-ostree inside a pet
docker container, but ran into a conflict with libhif since dnf uses
it.  I think we basically need to *always* build the bundled path,
rather than what I'm doing with CAHC and FADC where it's built as a
regular RPM.

It's not really sustainable right now for us to have both bundled and
not-bundled build paths - and we need to support co-installation with
dnf.

Another major issue is that we want to version lock with libhif -
right now our CI and both CAHC/FADC track libhif master, but that
means everything breaks if libhif breaks and we don't immediately
port.

git submodules solve all of these problems - the same as we're doing
with libglnx.

libglnx is *designed* for use as a git submodule, where as libhif
needs to support being both bundled and not-bundled.  So we end up
with some hacks on our side, but I think it's all not too bad.  I've
marked build rules with `# bundled libhif` so we know where to find
them later when libhif is stable.

Closes: #357
Approved by: jlebon
  • Loading branch information
cgwalters authored and rh-atomic-bot committed Jun 30, 2016
1 parent 4f68f73 commit 125c482
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 47 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "libglnx"]
path = libglnx
url = https://git.gnome.org/browse/libglnx
[submodule "libhif"]
path = libhif
url = https://github.com/rpm-software-management/libhif
30 changes: 30 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
Raw build instructions
----------------------

First, releases are available as GPG signed git tags, and most recent
versions support extended validation using
[git-evtag](https://github.com/cgwalters/git-evtag).

You'll need to get the submodules too: `git submodule update --init`

rpm-ostree has a hard requirement on a bleeding edge version of
[libhif](https://github.com/rpm-software-management/libhif/) - we now
consume this as a git submodule automatically.

We also require a few other libraries like
[librepo](https://github.com/rpm-software-management/librepo).

So the build process now looks like any other autotools program:

```
env NOCONFIGURE=1 ./autogen.sh
./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc
make
```

At this point you can run some of the unit tests with `make check`.
For more information on this, see `CONTRIBUTING.md`.

Using the Vagrant box
=====================

The easiest way to get started hacking on `rpm-ostree` is to
use the vagrant machine. This is also the set up used for
our integration tests.
Expand Down
2 changes: 0 additions & 2 deletions Makefile-daemon.am
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ librpmostreed_la_CFLAGS = \
$(NULL)

librpmostreed_la_LIBADD = \
$(AM_LDFLAGS) \
$(PKGDEP_RPMOSTREE_LIBS) \
librpmostreepriv.la \
librpmostree-1.la \
Expand All @@ -81,7 +80,6 @@ rpm_ostreed_CFLAGS = \

rpm_ostreed_LDADD = \
librpmostreed.la \
$(AM_LDFLAGS) \
$(PKGDEP_RPMOSTREE_LIBS) \
$(NULL)

Expand Down
1 change: 1 addition & 0 deletions Makefile-decls.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ACLOCAL_AMFLAGS =
AM_CPPFLAGS =
AM_CFLAGS =
AM_LDFLAGS =
DISTCHECK_CONFIGURE_FLAGS =
SUBDIRS =
NULL =
Expand Down
29 changes: 29 additions & 0 deletions Makefile-hif.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Makefile for C source code
#
# Copyright (C) 2016 Colin Walters <walters@verbum.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

libhif.so.3:
cd libhif-build && $(MAKE)
ln -s libhif-build/libhif/libhif.so.3 .
CLEANFILES += libhif.so.3
GITIGNOREFILES += libhif-build/

install-libhif-hook:
install -d -m 0755 $(DESTDIR)$(libdir)/rpm-ostree
install -m 0755 $$(readlink libhif.so.3) $(DESTDIR)$(libdir)/rpm-ostree
INSTALL_DATA_HOOKS += install-libhif-hook
5 changes: 4 additions & 1 deletion Makefile-lib.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ librpmostree_1_la_SOURCES = \
librpmostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libglnx -I$(srcdir)/src/libpriv -I$(srcdir)/src/lib \
-fvisibility=hidden '-D_RPMOSTREE_EXTERN=__attribute((visibility("default"))) extern' \
$(PKGDEP_RPMOSTREE_CFLAGS)
librpmostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions
librpmostree_1_la_LDFLAGS = $(AM_LDFLAGS) -version-number 1:0:0 -Bsymbolic-functions
librpmostree_1_la_LIBADD = $(PKGDEP_RPMOSTREE_LIBS) librpmostreepriv.la

# bundled libhif
INTROSPECTION_SCANNER_ENV = env LD_LIBRARY_PATH=$(top_builddir)/libhif-build/libhif

if BUILDOPT_INTROSPECTION
RpmOstree-1.0.gir: librpmostree-1.la Makefile
RpmOstree_1_0_gir_EXPORT_PACKAGES = rpm-ostree-1
Expand Down
4 changes: 3 additions & 1 deletion Makefile-libpriv.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ librpmostreepriv_la_CFLAGS = \
$(NULL)

librpmostreepriv_la_LIBADD = \
$(AM_LDFLAGS) \
$(PKGDEP_RPMOSTREE_LIBS) \
libglnx.la \
$(CAP_LIBS) \
$(NULL)

# bundled libhif
EXTRA_librpmostreepriv_la_DEPENDENCIES = libhif.so.3

gperf_gperf_sources = src/libpriv/rpmostree-script-gperf.gperf
BUILT_SOURCES += $(gperf_gperf_sources:-gperf.gperf=-gperf.c)
CLEANFILES += $(gperf_gperf_sources:-gperf.gperf=-gperf.c)
Expand Down
2 changes: 1 addition & 1 deletion Makefile-rpm-ostree.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ rpm_ostree_SOURCES += \
endif

rpm_ostree_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/app -I$(srcdir)/src/lib -I$(srcdir)/src/libpriv -I$(libglnx_srcpath) -DPKGLIBDIR=\"$(pkglibdir)\" $(PKGDEP_RPMOSTREE_CFLAGS)
rpm_ostree_LDADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS) librpmostreepriv.la librpmostree-1.la
rpm_ostree_LDADD = $(PKGDEP_RPMOSTREE_LIBS) librpmostreepriv.la librpmostree-1.la

privdatadir=$(pkglibdir)
privdata_DATA = src/app/rpm-ostree-0-integration.conf
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ AM_CPPFLAGS += -DDATADIR='"$(datadir)"' \
-DRPM_OSTREE_FEATURES='"$(RPM_OSTREE_FEATURES)"' \
-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40_
AM_CFLAGS += -std=gnu99 $(WARN_CFLAGS)
# bundled libhif
AM_LDFLAGS += "-Wl,-rpath=$(libdir)/rpm-ostree"

EXTRA_DIST += autogen.sh COPYING

Expand All @@ -51,6 +53,7 @@ TYPELIBS = $(GIRS:.gir=.typelib)
include libglnx/Makefile-libglnx.am.inc
noinst_LTLIBRARIES += libglnx.la
include Makefile-libpriv.am
include Makefile-hif.am
include Makefile-lib.am
include Makefile-daemon.am
include Makefile-rpm-ostree.am
Expand Down
37 changes: 0 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,6 @@ Using rpm-ostree to build OS images/trees

See [Compose Server](docs/manual/compose-server.md).

Building
--------

Releases are available as GPG signed git tags, and most recent
versions support extended validation using
[git-evtag](https://github.com/cgwalters/git-evtag).

However, in order to build from a git clone, you must update the
submodules. If you're packaging and want a tarball, I recommend using
a "recursive git archive" script. There are several available online;
[this code](https://git.gnome.org/browse/ostree/tree/packaging/Makefile.dist-packaging#n11)
in OSTree is an example.

Once you have a git clone or recursive archive, the next step is to
install the build dependencies. At the moment, rpm-ostree has a hard
requirement on a bleeding edge version of
[libhif](https://github.com/rpm-software-management/libhif/). It also
requires a few other libraries like
[librepo](https://github.com/rpm-software-management/librepo).

Once you have the dependencies, building is the same as every
autotools project:

```
env NOCONFIGURE=1 ./autogen.sh
./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc
make
```

At this point you can run some of the unit tests with `make check`.
For more information on this, see `CONTRIBUTING.md`.

More documentation
------------------

New! See the docs online at [Read The Docs (rpm-ostree)](https://rpm-ostree.readthedocs.org/en/latest/ )

Hacking
-------

Expand Down
33 changes: 28 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ PKG_CHECK_MODULES(PKGDEP_GIO_UNIX, [gio-unix-2.0])
PKG_CHECK_MODULES(PKGDEP_RPMOSTREE, [gio-unix-2.0 >= 2.40.0 json-glib-1.0
ostree-1 >= 2015.1 libgsystem >= 2015.1
libsystemd
rpm libhif librepo
rpm librepo
libarchive])
save_LIBS=$LIBS
LIBS=$PKGDEP_RPMOSTREE_LIBS
AC_CHECK_FUNCS(hif_source_set_required)
LIBS=$save_LIBS
dnl bundled libhif
PKGDEP_RPMOSTREE_CFLAGS="-I $(pwd)/libhif -I $(pwd)/libhif-build $PKGDEP_RPMOSTREE_CFLAGS"
PKGDEP_RPMOSTREE_LIBS="-L$(pwd)/libhif-build/libhif -lhif $PKGDEP_RPMOSTREE_LIBS"

AC_PATH_PROG([XSLTPROC], [xsltproc])

Expand Down Expand Up @@ -109,6 +108,30 @@ AS_IF([test x$enable_compose_tooling = xyes], [
])
if test x$enable_compose_tooling != xno; then RPM_OSTREE_FEATURES="$RPM_OSTREE_FEATURES +compose"; fi

dnl Try to automatically determine cmake type from CFLAGS
if $(echo $CFLAGS |grep -q -e "-O0"); then
cmake_args="-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS_DEBUG:STRING='-ggdb -O0' \
-DCMAKE_CXX_FLAGS_DEBUG:STRING=-ggdb -O0'"
export cmake_args
else
cmake_args=-DCMAKE_BUILD_TYPE=RelWithDebugInfo
export cmake_args
fi

dnl I picked /usr/libexec/rpm-ostree just because we need an
dnl arbitrary path - we don't actually install there.
(set -euo pipefail; mkdir -p libhif-build && cd libhif-build &&
set -x &&
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=/usr/libexec/rpm-ostree \
-DINCLUDE_INSTALL_DIR:PATH=/usr/libexec/rpm-ostree/include \
-DLIB_INSTALL_DIR:PATH=/usr/libexec/rpm-ostree \
-DSYSCONF_INSTALL_DIR:PATH=/usr/libexec/rpm-ostree/etc \
-DSHARE_INSTALL_PREFIX:PATH=/usr/libexec/rpm-ostree/share \
-DBUILD_SHARED_LIBS:BOOL=ON \
${cmake_args} ../libhif)

AC_CONFIG_FILES([
Makefile
api-doc/Makefile
Expand Down
1 change: 1 addition & 0 deletions libhif
Submodule libhif added at 07618d

0 comments on commit 125c482

Please sign in to comment.