From 3b5e1131a7e4bff57a6870f7065fd25826595a24 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Fri, 25 Aug 2017 08:39:03 -0500 Subject: [PATCH] libapparmor: Add musl patches from Alpine (update: drop patches no longer needed on updated version) --- pkgs/os-specific/linux/apparmor/default.nix | 27 ++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix index 29e1357d38a8..0bb5561e9572 100644 --- a/pkgs/os-specific/linux/apparmor/default.nix +++ b/pkgs/os-specific/linux/apparmor/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, makeWrapper, autoreconfHook +{ stdenv, fetchurl, fetchpatch, makeWrapper, autoreconfHook , pkgconfig, which , flex, bison , linuxHeaders ? stdenv.cc.libc.linuxHeaders @@ -35,6 +35,27 @@ let substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man" ''; + # use 'if c then x else null' to avoid rebuilding + # patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + patches = if stdenv.hostPlatform.isMusl then [ + (fetchpatch { + url = "https://git.alpinelinux.org/cgit/aports/plain/testing/apparmor/0002-Provide-missing-secure_getenv-and-scandirat-function.patch?id=74b8427cc21f04e32030d047ae92caa618105b53"; + name = "0002-Provide-missing-secure_getenv-and-scandirat-function.patch"; + sha256 = "0pj1bzifghxwxlc39j8hyy17dkjr9fk64kkj94ayymyprz4i4nac"; + }) + (fetchpatch { + url = "https://git.alpinelinux.org/cgit/aports/plain/testing/apparmor/0003-Added-missing-typedef-definitions-on-parser.patch?id=74b8427cc21f04e32030d047ae92caa618105b53"; + name = "0003-Added-missing-typedef-definitions-on-parser.patch"; + sha256 = "0yyaqz8jlmn1bm37arggprqz0njb4lhjni2d9c8qfqj0kll0bam0"; + }) + (fetchpatch { + url = "https://git.alpinelinux.org/cgit/aports/plain/testing/apparmor/0007-Do-not-build-install-vim-file-with-utils-package.patch?id=74b8427cc21f04e32030d047ae92caa618105b53"; + name = "0007-Do-not-build-install-vim-file-with-utils-package.patch"; + sha256 = "1m4dx901biqgnr4w4wz8a2z9r9dxyw7wv6m6mqglqwf2lxinqmp4"; + }) + # (alpine patches {1,4,5,6,8} are needed for apparmor 2.11, but not 2.12) + ] else null; + # FIXME: convert these to a single multiple-outputs package? libapparmor = stdenv.mkDerivation { @@ -63,6 +84,8 @@ let substituteInPlace ./libraries/libapparmor/src/Makefile.am --replace "/usr/include/netinet/in.h" "${stdenv.cc.libc.dev}/include/netinet/in.h" substituteInPlace ./libraries/libapparmor/src/Makefile.in --replace "/usr/include/netinet/in.h" "${stdenv.cc.libc.dev}/include/netinet/in.h" ''; + inherit patches; + postPatch = "cd ./libraries/libapparmor"; configureFlags = "--with-python --with-perl"; @@ -90,6 +113,7 @@ let ]; prePatch = prePatchCommon; + inherit patches; postPatch = "cd ./utils"; makeFlags = ''LANGS=''; installFlags = ''DESTDIR=$(out) BINDIR=$(out)/bin VIM_INSTALL_PATH=$(out)/share PYPREFIX=''; @@ -145,6 +169,7 @@ let ## techdoc.pdf still doesn't build ... substituteInPlace ./parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages" ''; + inherit patches; postPatch = "cd ./parser"; makeFlags = ''LANGS= USE_SYSTEM=1 INCLUDEDIR=${libapparmor}/include''; installFlags = ''DESTDIR=$(out) DISTRO=unknown'';