From 2e337fe969a55f66dcd41715b73f9c68acc38867 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 3 Jun 2017 19:36:59 -0400 Subject: [PATCH] libelf: Modernize and fix for cross --- .../development/libraries/libelf/cross-ar.patch | 11 +++++++++++ pkgs/development/libraries/libelf/default.nix | 17 ++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 pkgs/development/libraries/libelf/cross-ar.patch diff --git a/pkgs/development/libraries/libelf/cross-ar.patch b/pkgs/development/libraries/libelf/cross-ar.patch new file mode 100644 index 00000000000..e282d9005db --- /dev/null +++ b/pkgs/development/libraries/libelf/cross-ar.patch @@ -0,0 +1,11 @@ +--- a/lib/Makefile.in ++++ b/lib/Makefile.in +@@ -27,7 +27,7 @@ installdirs = $(libdir) $(includedir) $(includedir)/libelf + + CC = @CC@ + LD = @LD@ +-AR = ar ++AR ?= ar + MV = mv -f + RM = rm -f + LN_S = @LN_S@ diff --git a/pkgs/development/libraries/libelf/default.nix b/pkgs/development/libraries/libelf/default.nix index 5027afa397a..dcd5d1d7a93 100644 --- a/pkgs/development/libraries/libelf/default.nix +++ b/pkgs/development/libraries/libelf/default.nix @@ -1,4 +1,7 @@ -{ fetchurl, stdenv, gettext, glibc }: +{ stdenv, fetchurl +, gettext, glibc +, buildPlatform, hostPlatform +}: stdenv.mkDerivation rec { name = "libelf-0.8.13"; @@ -8,20 +11,20 @@ stdenv.mkDerivation rec { sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"; }; + # TODO(@Ericson2314) Make unconditional next hash break + patches = if hostPlatform == buildPlatform then null else [ + ./cross-ar.patch + ]; + doCheck = true; # FIXME needs gcc 4.9 in bootstrap tools hardeningDisable = [ "stackprotector" ]; - # For cross-compiling, native glibc is needed for the "gencat" program. - crossAttrs = { - nativeBuildInputs = [ gettext glibc ]; - }; - # Libelf's custom NLS macros fail to determine the catalog file extension on # Darwin, so disable NLS for now. # FIXME: Eventually make Gettext a build input on all platforms. - configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-nls"; + configureFlags = stdenv.lib.optional hostPlatform.isDarwin "--disable-nls"; nativeBuildInputs = [ gettext ];