audit: fix static linking

This commit is contained in:
Dmitry Bogatov
2021-01-13 00:00:00 +00:00
parent 5322c1f7d7
commit c938459ce0
2 changed files with 156 additions and 1 deletions
+9 -1
View File
@@ -36,7 +36,8 @@ stdenv.mkDerivation rec {
# TODO: Remove the musl patches when
# https://github.com/linux-audit/audit-userspace/pull/25
# is available with the next release.
patches = stdenv.lib.optional stdenv.hostPlatform.isMusl [
patches = [ ./patches/weak-symbols.patch ] ++
stdenv.lib.optional stdenv.hostPlatform.isMusl [
(
let patch = fetchpatch {
url = "https://github.com/linux-audit/audit-userspace/commit/d579a08bb1cde71f939c13ac6b2261052ae9f77e.patch";
@@ -55,6 +56,13 @@ stdenv.mkDerivation rec {
prePatch = ''
sed -i 's,#include <sys/poll.h>,#include <poll.h>\n#include <limits.h>,' audisp/audispd.c
''
# According to https://stackoverflow.com/questions/13089166
# --whole-archive linker flag is required to be sure that linker
# correctly chooses strong version of symbol regardless of order of
# object files at command line.
+ stdenv.lib.optionalString stdenv.targetPlatform.isStatic ''
export LDFLAGS=-Wl,--whole-archive
'';
meta = {
description = "Audit Library";