2013-12-22 04:41:30 +04:00
# Copyright (C) 2011,2013 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.
2014-01-03 22:15:12 +04:00
i n c l u d e M a k e f i l e - d e c l s . a m
2018-11-13 18:57:50 +03:00
i n c l u d e M a k e f i l e - e x t r a . i n c
2014-01-03 22:15:12 +04:00
2016-10-19 21:24:40 +03:00
primaryname = rpm-ostree
2015-04-09 00:20:50 +03:00
SUBDIRS += .
i f E N A B L E _ G T K _ D O C
2016-03-09 19:20:06 +03:00
SUBDIRS += api-doc
2015-04-09 00:20:50 +03:00
e n d i f
2017-11-13 06:45:20 +03:00
RPM_OSTREE_GITREV = $( shell if command -v git >/dev/null 2>& 1 && test -e $( srcdir) /.git; then git describe --abbrev= 42 --tags --always HEAD; fi )
2017-01-19 20:38:40 +03:00
2014-01-03 22:15:12 +04:00
ACLOCAL_AMFLAGS += -I m4 ${ ACLOCAL_FLAGS }
AM_CPPFLAGS += -DDATADIR= '"$(datadir)"' \
2013-12-22 04:41:30 +04:00
-DLIBEXECDIR= '"$(libexecdir)"' \
-DLOCALEDIR= \" $( datadir) /locale\" \
2017-12-15 20:01:46 +03:00
-DSYSCONFDIR= '"$(sysconfdir)"' \
-DRPM_OSTREE_FEATURES= '"$(RPM_OSTREE_FEATURES)"' \
2017-01-19 20:38:40 +03:00
-DRPM_OSTREE_GITREV= '"$(RPM_OSTREE_GITREV)"' \
2019-03-22 18:14:51 +03:00
-DGLIB_VERSION_MIN_REQUIRED= GLIB_VERSION_2_56 -DGLIB_VERSION_MAX_ALLOWED= GLIB_VERSION_2_56
2021-02-08 21:22:34 +03:00
# Compiler warnings
warnings_skipped = sign-compare
warnings_error = empty-body format = 2 format-security format-nonliteral \
missing-declarations return -type switch overflow undef \
misleading-indentation missing-include-dirs unused-result \
$( NULL)
warning_flags = -Wall \
$( patsubst %,-Wno-%,$( warnings_skipped) ) \
$( patsubst %,-Werror= %,$( warnings_error) ) \
$( NULL)
i f B U I L D O P T _ W E R R O R
warning_flags += -Werror
e n d i f
2020-11-22 22:55:06 +03:00
# We make some C warnings always a hard error; these should never happen in our code.
# These flags are not valid for C++.
2021-02-08 21:22:34 +03:00
warnings_error_only_c = strict-prototypes missing-prototypes \
implicit-function-declaration int-conversion incompatible-pointer-types \
2020-11-22 22:55:06 +03:00
$( NULL)
Add --enable-sanitizers (not on by default yet)
This way we at least get unit test coverage (which...
our unit test coverage doesn't do much because our
main code paths require privileges or virt).
One main blocker to this is that rustc doesn't expose
first-class support for this yet:
https://github.com/rust-lang/rust/issues/39699
At a practical level this works when building in release
mode but fails with `cargo test` for some reason; linker
arguments being pruned? Not sure.
So I was able to use this when composing to find a bug,
but then for some other reason the client
side apparently infinite loops inside libsolv.
So we're not enabling this yet for those reasons, but
let's land the build infrastructure now.
```
(lldb) thread backtrace
* thread #4, name = 'pool-/usr/bin/r'
* frame #0: 0x00007fd61b97200f libc.so.6`__memcpy_sse2_unaligned_erms + 623
frame #1: 0x00007fd61cbc88e6 libasan.so.6`__asan::asan_realloc(void*, unsigned long, __sanitizer::BufferedStackTrace*) + 214
frame #2: 0x00007fd61cc4b725 libasan.so.6`__interceptor_realloc + 245
frame #3: 0x00007fd61baec43e libsolv.so.1`solv_realloc + 30
frame #4: 0x00007fd61baf0414 libsolv.so.1`repodata_add_dirstr + 276
frame #5: 0x00007fd61bb6f755 libsolvext.so.1`end_element + 53
frame #6: 0x00007fd61b05855d libxml2.so.2`xmlParseEndTag1.constprop.0 + 317
frame #7: 0x00007fd61b063548 libxml2.so.2`xmlParseTryOrFinish.isra.0 + 888
frame #8: 0x00007fd61af7ed20 libxml2.so.2`xmlParseChunk + 560
frame #9: 0x00007fd61bb727e7 libsolvext.so.1`solv_xmlparser_parse + 183
frame #10: 0x00007fd61bb5ea0e libsolvext.so.1`repo_add_rpmmd + 254
frame #11: 0x000055a4fce7a5f5 rpm-ostree`::load_filelists_cb(repo=<unavailable>, fp=<unavailable>) at dnf-sack.cpp:444:23
frame #12: 0x000055a4fce7cad6 rpm-ostree`load_ext(_DnfSack*, libdnf::Repo*, _hy_repo_repodata, char const*, char const*, int (*)(s_Repo*, _IO_FILE*), _GError**) at dnf-sack.cpp:430:13
frame #13: 0x000055a4fce7df60 rpm-ostree`dnf_sack_load_repo at dnf-sack.cpp:1789:26
frame #14: 0x000055a4fce7eee9 rpm-ostree`dnf_sack_add_repo at dnf-sack.cpp:2217:28
frame #15: 0x000055a4fce7f0fb rpm-ostree`dnf_sack_add_repos at dnf-sack.cpp:2271:32
frame #16: 0x000055a4fce870ee rpm-ostree`dnf_context_setup_sack_with_flags at dnf-context.cpp:1796:29
frame #17: 0x000055a4fcdf757f rpm-ostree`rpmostree_context_download_metadata at rpmostree-core.cxx:1206:44
frame #18: 0x000055a4fcdf95c3 rpm-ostree`rpmostree_context_prepare at rpmostree-core.cxx:2001:48
frame #19: 0x000055a4fce54ab7 rpm-ostree`rpmostree_sysroot_upgrader_prep_layering at rpmostree-sysroot-upgrader.cxx:1018:38
frame #20: 0x000055a4fcdcb143 rpm-ostree`deploy_transaction_execute(_RpmostreedTransaction*, _GCancellable*, _GError**) at rpmostreed-transaction-types.cxx:1445:49
frame #21: 0x000055a4fcdba4cd rpm-ostree`transaction_execute_thread(_GTask*, void*, void*, _GCancellable*) at rpmostreed-transaction.cxx:340:34
frame #22: 0x00007fd61c58f7e2 libgio-2.0.so.0`g_task_thread_pool_thread + 114
frame #23: 0x00007fd61c3d7e54 libglib-2.0.so.0`g_thread_pool_thread_proxy.lto_priv.0 + 116
frame #24: 0x00007fd61c3d52b2 libglib-2.0.so.0`g_thread_proxy + 82
frame #25: 0x00007fd61b8af3f9 libpthread.so.0`start_thread + 233
frame #26: 0x00007fd61b9c9903 libc.so.6`__clone + 67
(lldb)
```
2021-02-03 00:54:38 +03:00
sanitizer_flags =
i f B U I L D O P T _ A S A N
sanitizer_flags += -fsanitize= address -fsanitize= undefined -fsanitize-undefined-trap-on-error
e n d i f
2021-02-08 21:22:34 +03:00
# See the AM_CFLAGS in libostree for more information about -fno-strict-aliasing
AM_CFLAGS += -std= gnu11 -fno-strict-aliasing $( warning_flags) $( patsubst %,-Werror= %,$( warnings_error_only_c) )
2020-11-22 22:55:06 +03:00
# Our default CXX flags
Add --enable-sanitizers (not on by default yet)
This way we at least get unit test coverage (which...
our unit test coverage doesn't do much because our
main code paths require privileges or virt).
One main blocker to this is that rustc doesn't expose
first-class support for this yet:
https://github.com/rust-lang/rust/issues/39699
At a practical level this works when building in release
mode but fails with `cargo test` for some reason; linker
arguments being pruned? Not sure.
So I was able to use this when composing to find a bug,
but then for some other reason the client
side apparently infinite loops inside libsolv.
So we're not enabling this yet for those reasons, but
let's land the build infrastructure now.
```
(lldb) thread backtrace
* thread #4, name = 'pool-/usr/bin/r'
* frame #0: 0x00007fd61b97200f libc.so.6`__memcpy_sse2_unaligned_erms + 623
frame #1: 0x00007fd61cbc88e6 libasan.so.6`__asan::asan_realloc(void*, unsigned long, __sanitizer::BufferedStackTrace*) + 214
frame #2: 0x00007fd61cc4b725 libasan.so.6`__interceptor_realloc + 245
frame #3: 0x00007fd61baec43e libsolv.so.1`solv_realloc + 30
frame #4: 0x00007fd61baf0414 libsolv.so.1`repodata_add_dirstr + 276
frame #5: 0x00007fd61bb6f755 libsolvext.so.1`end_element + 53
frame #6: 0x00007fd61b05855d libxml2.so.2`xmlParseEndTag1.constprop.0 + 317
frame #7: 0x00007fd61b063548 libxml2.so.2`xmlParseTryOrFinish.isra.0 + 888
frame #8: 0x00007fd61af7ed20 libxml2.so.2`xmlParseChunk + 560
frame #9: 0x00007fd61bb727e7 libsolvext.so.1`solv_xmlparser_parse + 183
frame #10: 0x00007fd61bb5ea0e libsolvext.so.1`repo_add_rpmmd + 254
frame #11: 0x000055a4fce7a5f5 rpm-ostree`::load_filelists_cb(repo=<unavailable>, fp=<unavailable>) at dnf-sack.cpp:444:23
frame #12: 0x000055a4fce7cad6 rpm-ostree`load_ext(_DnfSack*, libdnf::Repo*, _hy_repo_repodata, char const*, char const*, int (*)(s_Repo*, _IO_FILE*), _GError**) at dnf-sack.cpp:430:13
frame #13: 0x000055a4fce7df60 rpm-ostree`dnf_sack_load_repo at dnf-sack.cpp:1789:26
frame #14: 0x000055a4fce7eee9 rpm-ostree`dnf_sack_add_repo at dnf-sack.cpp:2217:28
frame #15: 0x000055a4fce7f0fb rpm-ostree`dnf_sack_add_repos at dnf-sack.cpp:2271:32
frame #16: 0x000055a4fce870ee rpm-ostree`dnf_context_setup_sack_with_flags at dnf-context.cpp:1796:29
frame #17: 0x000055a4fcdf757f rpm-ostree`rpmostree_context_download_metadata at rpmostree-core.cxx:1206:44
frame #18: 0x000055a4fcdf95c3 rpm-ostree`rpmostree_context_prepare at rpmostree-core.cxx:2001:48
frame #19: 0x000055a4fce54ab7 rpm-ostree`rpmostree_sysroot_upgrader_prep_layering at rpmostree-sysroot-upgrader.cxx:1018:38
frame #20: 0x000055a4fcdcb143 rpm-ostree`deploy_transaction_execute(_RpmostreedTransaction*, _GCancellable*, _GError**) at rpmostreed-transaction-types.cxx:1445:49
frame #21: 0x000055a4fcdba4cd rpm-ostree`transaction_execute_thread(_GTask*, void*, void*, _GCancellable*) at rpmostreed-transaction.cxx:340:34
frame #22: 0x00007fd61c58f7e2 libgio-2.0.so.0`g_task_thread_pool_thread + 114
frame #23: 0x00007fd61c3d7e54 libglib-2.0.so.0`g_thread_pool_thread_proxy.lto_priv.0 + 116
frame #24: 0x00007fd61c3d52b2 libglib-2.0.so.0`g_thread_proxy + 82
frame #25: 0x00007fd61b8af3f9 libpthread.so.0`start_thread + 233
frame #26: 0x00007fd61b9c9903 libc.so.6`__clone + 67
(lldb)
```
2021-02-03 00:54:38 +03:00
AM_CXXFLAGS += -std= c++17 -fno-strict-aliasing $( warning_flags) $( sanitizer_flags)
2013-12-22 04:41:30 +04:00
EXTRA_DIST += autogen.sh COPYING
2017-02-12 07:25:53 +03:00
GITIGNOREFILES += build-aux/ gtk-doc.make config.h.in aclocal.m4 insttree/ rpm-ostreed
2016-03-10 22:36:44 +03:00
2015-04-28 04:22:58 +03:00
SED_SUBST = sed \
-e 's,[@]libexecdir[@],$(libexecdir),g' \
2016-10-19 21:24:40 +03:00
-e 's,[@]primaryname[@],$(primaryname),g' \
2016-05-27 21:46:46 +03:00
-e 's,[@]bindir[@],$(bindir),g' \
2015-04-28 04:22:58 +03:00
$( NULL)
2015-02-15 21:56:14 +03:00
libglnx_srcpath := $( srcdir) /libglnx
2015-04-14 04:25:05 +03:00
libglnx_cflags := $( PKGDEP_GIO_UNIX_CFLAGS) -I$( libglnx_srcpath) -fvisibility= hidden
2015-04-28 04:22:58 +03:00
libglnx_ldflags :=
2015-02-15 21:56:14 +03:00
libglnx_libs := $( PKGDEP_GIO_UNIX_LIBS)
2015-03-20 03:45:30 +03:00
i n c l u d e $( INTROSPECTION_MAKEFILE )
GIRS =
TYPELIBS = $( GIRS:.gir= .typelib)
2018-06-06 00:49:48 +03:00
# These bits were originally based on gnome:librsvg/Makefile.am
# but have been adapted to non-recursive Automake, and additionally
# the "cargo vendor" bits for us live in packaging/Makefile.dist-packaging.
.PHONY : check -local -cargo clean -local -cargo use -git -not -dist -hook
2018-05-31 23:31:22 +03:00
i f R U S T _ D E B U G
CARGO_RELEASE_ARGS =
e l s e
CARGO_RELEASE_ARGS = --release
e n d i f
2018-06-05 17:59:35 +03:00
check-local-cargo :
2021-02-04 23:14:20 +03:00
cargo test
2018-06-06 00:49:48 +03:00
CHECK_LOCAL_HOOKS += check-local-cargo
2018-05-31 23:31:22 +03:00
2018-06-05 17:59:35 +03:00
clean-local-cargo :
2021-02-04 23:14:20 +03:00
cargo clean
2018-06-06 00:49:48 +03:00
CLEAN_LOCAL_HOOKS += clean-local-cargo
2018-05-31 23:31:22 +03:00
2018-06-06 00:49:48 +03:00
use-git-not-dist-hook :
@echo
@echo 'ERROR: rpm-ostree does not use/support "make dist"; see packaging/Makefile.dist-packaging' 1>& 2
@echo
@exit 1
DIST_HOOKS += use-git-not-dist-hook
2018-06-09 15:10:17 +03:00
GITIGNOREFILES += target/
2018-05-31 23:31:22 +03:00
2020-04-29 20:52:23 +03:00
# From coreos-assembler
2021-02-16 22:45:59 +03:00
GITIGNOREFILES += .cosa/ "fastbuild*.qcow2" _kola_temp/
2020-04-29 20:52:23 +03:00
2015-09-11 16:33:46 +03:00
i n c l u d e l i b g l n x / M a k e f i l e - l i b g l n x . a m . i n c
2015-02-15 21:56:14 +03:00
noinst_LTLIBRARIES += libglnx.la
2015-04-17 21:03:24 +03:00
i n c l u d e M a k e f i l e - l i b p r i v . a m
2015-03-20 03:45:30 +03:00
i n c l u d e M a k e f i l e - l i b . a m
2015-04-28 04:22:58 +03:00
i n c l u d e M a k e f i l e - d a e m o n . a m
2013-12-22 04:41:30 +04:00
i n c l u d e M a k e f i l e - r p m - o s t r e e . a m
2014-07-16 17:02:45 +04:00
i n c l u d e M a k e f i l e - t e s t s . a m
2014-03-25 16:24:19 +04:00
i n c l u d e M a k e f i l e - m a n . a m
2019-03-06 20:31:36 +03:00
i n c l u d e M a k e f i l e - b a s h . a m
2016-03-10 22:36:44 +03:00
- i n c l u d e $( top_srcdir ) / g i t . m k