aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Makefile.am
blob: 499ebdaeba9bda9c8d82a86eb822a11eec34b5f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#
# Shown below is a simplified dependency graph of the OpenZFS provided
# libraries.  Administrative commands (`zfs`, `zpool`, etc) interface with
# the kernel modules using the `libzfs.so` and `libzfs_core.so` libraries.
# These libraries provide a stable ABI across OpenZFS point releases.
#
# The `libzpool.so` library is a user space build of the DMU and SPA layers
# used to implement debugging tools (zdb) and code validation tools (ztest).
# These library interfaces are subject to change at any time.
#
#
# CMDS:   zhack/ztest/zdb/            zfs/zpool/zed/
#        raidz_{test,bench}          zinject/zstream
#                |                          |
# LIBS:          |                          |              libzfsbootenv*
#                |                          |                    |
#                |                          |                    |
#             libzpool                   libzfs* ----------------+
#             | | |  \                  / | | |
#    libicp --/ | |   \                /  | | \------- libshare
#               | |    \              /   | |
#    libzstd ---/ |     \            /    | \--------- libuutil
#                 |      \          /     \              | |
#    libunicode --/       \        /       \             | |
#                          \      /         \            | |
#                          libzutil        libzfs_core*  | |
#                          | | | | \          |     |    | |
#                          | | | | |          |     |    | |
#                          | | | | |          |     |    | |
#    libtpool -------------/ | | | \---- libnvpair* |    | |
#                            | | |                  |    | |
#    libefi -----------------/ | \------ libavl* --------/ |
#                              |                    |      |
#                              \-------- libspl ----+------/
#
#
# NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries
# These nine libraries are intermediary build components.
#
# * - A stable ABI is provided for these libraries;
# when performing an ABI check the following options are applied:
#
# --no-unreferenced-symbols: Exclude symbols which are not referenced by
# any debug information.  Without this _init() and _fini() are incorrectly
# reported on CentOS7 for libuutil.so.
#
# --headers-dir1: Limit ABI checks to public OpenZFS headers, otherwise
# changes in public system headers are also reported.
#
# --suppressions: Honor a suppressions file for each library to provide
# a mechanism for suppressing harmless warnings.
#

noinst_LTLIBRARIES =
lib_LTLIBRARIES =
pkgconfig_DATA =
include $(srcdir)/%D%/libavl/Makefile.am
include $(srcdir)/%D%/libicp/Makefile.am
include $(srcdir)/%D%/libnvpair/Makefile.am
include $(srcdir)/%D%/libshare/Makefile.am
include $(srcdir)/%D%/libspl/Makefile.am
include $(srcdir)/%D%/libtpool/Makefile.am
include $(srcdir)/%D%/libunicode/Makefile.am
include $(srcdir)/%D%/libuutil/Makefile.am
include $(srcdir)/%D%/libzfs_core/Makefile.am
include $(srcdir)/%D%/libzfs/Makefile.am
include $(srcdir)/%D%/libzfsbootenv/Makefile.am
include $(srcdir)/%D%/libzpool/Makefile.am
include $(srcdir)/%D%/libzstd/Makefile.am
include $(srcdir)/%D%/libzutil/Makefile.am
if BUILD_LINUX
include $(srcdir)/%D%/libefi/Makefile.am
endif


PHONY += lib
lib: $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES)


PHONY += checkabi storeabi check_libabi_version allow_libabi_only_for_x86_64

check_libabi_version:
	if [ $$(abidw -v | $(SED) 's/[^0-9]//g') -lt 200 ]; then \
		printf '%s\n' "" \
		    "*** Please use libabigail 2.0.0 version or newer;" \
		    "*** otherwise results are not consistent!" \
		    "(or see https://github.com/openzfs/libabigail-docker)"; \
		exit 1; \
	fi

allow_libabi_only_for_x86_64:
	echo '*** ABI definitions provided apply only to x86_64:'
	echo '*** not checking or storing ABI and assuming success.'

if TARGET_CPU_X86_64
# These should depend on $(lib_LTLIBRARIES), but this breaks on CI when bound into Docker
checkabi: check_libabi_version
	err=0; \
	for lib in $(lib_LTLIBRARIES); do \
		lib=$${lib%.la}; \
		[ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \
		echo $$lib:; \
		abidiff --no-unreferenced-symbols \
		    --headers-dir1 include \
		    --suppressions $(srcdir)/lib/$$lib/$$lib.suppr \
		    $(srcdir)/lib/$$lib/$$lib.abi .libs/$$lib.so || err=$$((err + 1)); \
	done; \
	exit $$err

storeabi: check_libabi_version
	for lib in $(lib_LTLIBRARIES); do \
		lib=$${lib%.la}; \
		[ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \
		abidw --no-show-locs \
		    --no-corpus-path \
		    --no-comp-dir-path \
		    --type-id-style hash \
		    .libs/$$lib.so > $(srcdir)/lib/$$lib/$$lib.abi; \
	done
else
checkabi: allow_libabi_only_for_x86_64
storeabi: allow_libabi_only_for_x86_64
endif