diff --git a/.gitmodules b/.gitmodules index e5084aff..0811f3fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/HACKING.md b/HACKING.md index 1a856007..bdd4914d 100644 --- a/HACKING.md +++ b/HACKING.md @@ -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. diff --git a/Makefile-daemon.am b/Makefile-daemon.am index 4cb34df6..26a3d6bb 100644 --- a/Makefile-daemon.am +++ b/Makefile-daemon.am @@ -59,7 +59,6 @@ librpmostreed_la_CFLAGS = \ $(NULL) librpmostreed_la_LIBADD = \ - $(AM_LDFLAGS) \ $(PKGDEP_RPMOSTREE_LIBS) \ librpmostreepriv.la \ librpmostree-1.la \ @@ -81,7 +80,6 @@ rpm_ostreed_CFLAGS = \ rpm_ostreed_LDADD = \ librpmostreed.la \ - $(AM_LDFLAGS) \ $(PKGDEP_RPMOSTREE_LIBS) \ $(NULL) diff --git a/Makefile-decls.am b/Makefile-decls.am index cd28ba24..d449d18b 100644 --- a/Makefile-decls.am +++ b/Makefile-decls.am @@ -19,6 +19,7 @@ ACLOCAL_AMFLAGS = AM_CPPFLAGS = AM_CFLAGS = +AM_LDFLAGS = DISTCHECK_CONFIGURE_FLAGS = SUBDIRS = NULL = diff --git a/Makefile-hif.am b/Makefile-hif.am new file mode 100644 index 00000000..2749dd6e --- /dev/null +++ b/Makefile-hif.am @@ -0,0 +1,29 @@ +# Makefile for C source code +# +# Copyright (C) 2016 Colin Walters +# +# 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 diff --git a/Makefile-lib.am b/Makefile-lib.am index e3621420..c74523d2 100644 --- a/Makefile-lib.am +++ b/Makefile-lib.am @@ -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 diff --git a/Makefile-libpriv.am b/Makefile-libpriv.am index dacd7d45..f7351e0f 100644 --- a/Makefile-libpriv.am +++ b/Makefile-libpriv.am @@ -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) diff --git a/Makefile-rpm-ostree.am b/Makefile-rpm-ostree.am index 36086283..02adcc9b 100644 --- a/Makefile-rpm-ostree.am +++ b/Makefile-rpm-ostree.am @@ -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 diff --git a/Makefile.am b/Makefile.am index e1ceb86b..cf2c0282 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 @@ -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 diff --git a/README.md b/README.md index b354bc8e..c301a614 100644 --- a/README.md +++ b/README.md @@ -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 ------- diff --git a/configure.ac b/configure.ac index 2e275f35..30572b74 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) @@ -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 diff --git a/libhif b/libhif new file mode 160000 index 00000000..07618db1 --- /dev/null +++ b/libhif @@ -0,0 +1 @@ +Subproject commit 07618db1c23ffeae7ce4475b060895547ac77f12