From bb04ef538ba21978a8e0eed1896aa6f6e4822b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Thu, 16 May 2019 02:07:36 +0200 Subject: [PATCH 1/2] audit: Fix build with pkgsMusl. The previous patches no longer applied to the current code. Also declare necessary autoconf, automake, libtool dependencies. Without them, the musl build gets: /build/audit-2.8.5/missing: line 81: aclocal-1.16: command not found configure.ac:16: warning: macro 'AM_PROG_LIBTOOL' not found in library sh: autom4te: not found --- pkgs/os-specific/linux/audit/default.nix | 33 +++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/pkgs/os-specific/linux/audit/default.nix b/pkgs/os-specific/linux/audit/default.nix index d05eaf4b84e7..c7d0a25d9fee 100644 --- a/pkgs/os-specific/linux/audit/default.nix +++ b/pkgs/os-specific/linux/audit/default.nix @@ -1,12 +1,14 @@ { stdenv, buildPackages, fetchurl, fetchpatch, + runCommand, + autoconf, automake, libtool, enablePython ? false, python ? null, }: assert enablePython -> python != null; stdenv.mkDerivation rec { - name = "audit-2.8.5"; + name = "audit-2.8.5"; # at the next release, remove the patches below! src = fetchurl { url = "https://people.redhat.com/sgrubb/audit/${name}.tar.gz"; @@ -15,7 +17,7 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "out" "man" ]; - depsBuildBuild = [ buildPackages.stdenv.cc ]; + depsBuildBuild = [ buildPackages.stdenv.cc autoconf automake libtool ]; buildInputs = stdenv.lib.optional enablePython python; configureFlags = [ @@ -29,17 +31,24 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + # 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 [ - (fetchpatch { - url = "https://git.alpinelinux.org/cgit/aports/plain/main/audit/0002-auparse-remove-use-of-rawmemchr.patch?id=3e57180fdf3f90c30a25aea44f57846efc93a696"; - name = "0002-auparse-remove-use-of-rawmemchr.patch"; - sha256 = "1caaqbfgb2rq3ria5bz4n8x30ihgihln6w9w9a46k62ba0wh9rkz"; - }) - (fetchpatch { - url = "https://git.alpinelinux.org/cgit/aports/plain/main/audit/0003-all-get-rid-of-strndupa.patch?id=3e57180fdf3f90c30a25aea44f57846efc93a696"; - name = "0003-all-get-rid-of-strndupa.patch"; - sha256 = "1ddrm6a0ijrf7caw1wpw2kkbjp2lkxkmc16v51j5j7dvdalc6591"; - }) + ( + let patch = fetchpatch { + url = "https://github.com/linux-audit/audit-userspace/commit/d579a08bb1cde71f939c13ac6b2261052ae9f77e.patch"; + name = "Add-substitue-functions-for-strndupa-rawmemchr.patch"; + sha256 = "015bvzflg1s1k5viap30nznlpjj44a66khyc8yq0waa68qwvdlsd"; + }; + in + runCommand "Add-substitue-functions-for-strndupa-rawmemchr.patch-fix-copyright-merge-conflict" {} '' + cp ${patch} $out + substituteInPlace $out --replace \ + '-* Copyright (c) 2007-09,2011-16,2018 Red Hat Inc., Durham, North Carolina.' \ + '-* Copyright (c) 2007-09,2011-16 Red Hat Inc., Durham, North Carolina.' + '' + ) ]; prePatch = '' From b73f382f25d98b068734ccbc4e7f71de8e736cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 9 Jun 2019 15:59:13 +0200 Subject: [PATCH 2/2] audit: reduce non-musl dependencies after parent commit Reduction of build-time closures, and avoiding a mass rebuild now. And I believe these belong into native inputs. --- pkgs/os-specific/linux/audit/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/audit/default.nix b/pkgs/os-specific/linux/audit/default.nix index c7d0a25d9fee..4a569e1e1c3d 100644 --- a/pkgs/os-specific/linux/audit/default.nix +++ b/pkgs/os-specific/linux/audit/default.nix @@ -17,7 +17,9 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "out" "man" ]; - depsBuildBuild = [ buildPackages.stdenv.cc autoconf automake libtool ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + nativeBuildInputs = stdenv.lib.optionals stdenv.hostPlatform.isMusl + [ autoconf automake libtool ]; buildInputs = stdenv.lib.optional enablePython python; configureFlags = [