Author: viric
Date: Fri Jan  6 16:45:14 2012
New Revision: 31353
URL: https://nixos.org/websvn/nix/?rev=31353&sc=1

Log:
Updating elfutils/perf to cross-build. I tested this for the nanonote.

I add newt, checking that it cross-builds too.

I update perf to have newt support, and now it's also finding python, whatever
that means. I've not tested if 'python' as buildInputs is enough.

Added:
   nixpkgs/trunk/pkgs/development/libraries/newt/
   nixpkgs/trunk/pkgs/development/libraries/newt/default.nix
Modified:
   nixpkgs/trunk/pkgs/development/tools/misc/elfutils/default.nix
   nixpkgs/trunk/pkgs/os-specific/linux/kernel/perf.nix
   nixpkgs/trunk/pkgs/top-level/all-packages.nix

Added: nixpkgs/trunk/pkgs/development/libraries/newt/default.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixpkgs/trunk/pkgs/development/libraries/newt/default.nix   Fri Jan  6 
16:45:14 2012        (r31353)
@@ -0,0 +1,29 @@
+{ fetchurl, stdenv, slang, popt }:
+
+stdenv.mkDerivation rec {
+  name = "newt-0.52.14";
+
+  src = fetchurl {
+    url = "https://fedorahosted.org/releases/n/e/newt/${name}.tar.gz";;
+    sha256 = "13lp815zwldbw917wxmjy90gp608n3zlk4p3ybfqh0x6p9c4y3zp";
+  };
+
+  patchPhase = ''
+    sed -i -e s,/usr/bin/install,install, -e s,-I/usr/include/slang,, 
Makefile.in po/Makefile
+  '';
+
+  buildInputs = [ slang popt ];
+
+  crossAttrs = {
+    makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-";
+  };
+
+  meta = {
+    homepage = https://fedorahosted.org/newt/;
+    description = "Library for color text mode, widget based user interfaces";
+
+    license = "LGPLv2";
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.viric ];
+  };
+}

Modified: nixpkgs/trunk/pkgs/development/tools/misc/elfutils/default.nix
==============================================================================
--- nixpkgs/trunk/pkgs/development/tools/misc/elfutils/default.nix      Fri Jan 
 6 16:14:02 2012        (r31352)
+++ nixpkgs/trunk/pkgs/development/tools/misc/elfutils/default.nix      Fri Jan 
 6 16:45:14 2012        (r31353)
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib, bzip2, xz, m4}:
+{stdenv, fetchurl, m4, zlib, bzip2, xz, bison, flex, gettext}:
 
 # TODO: Look at the hardcoded paths to kernel, modules etc.
 stdenv.mkDerivation rec {
@@ -13,9 +13,54 @@
     sha256 = "19mlgxyzcwiv64ynj2cibgkiw4qkm3n37kizvy6555dsmlaqfybq";
   };
 
-  buildInputs = [ zlib bzip2 xz ];
+  patches = [
+    (fetchurl {
+      url = 
https://fedorahosted.org/releases/e/l/elfutils/0.152/elfutils-portability.patch;
+      sha256 = "0q318w4cvvqv9ps4xcwphapj1gl31isgjyya4y9sm72qj68n61p0";
+    }) ];
 
-  buildNativeInputs = [m4];
+  # We need bzip2 in NativeInputs because otherwise we can't unpack the src,
+  # as the host-bzip2 will be in the path.
+  buildNativeInputs = [m4 bison flex gettext bzip2];
+  buildInputs = [zlib bzip2 xz];
+
+  crossAttrs = {
+
+    /* Having bzip2 will harm, because anything using elfutils 
+       as buildInput cross-building, will not be able to run 'bzip2' */
+    propagatedBuildInputs = [ zlib.hostDrv ];
+
+    # This program does not cross-build fine. So I only cross-build some parts
+    # I need for the linux perf tool.
+    # On the awful cross-building:
+    # http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2005
+    #
+    # I wrote this testing for the nanonote.
+    buildPhase = ''
+      pushd libebl
+      make
+      popd
+      pushd libelf
+      make
+      popd
+      pushd libdwfl
+      make
+      popd
+      pushd libdw
+      make
+      popd
+    '';
+
+    installPhase = ''
+      pushd libelf
+      make install
+      popd
+      pushd libdw
+      make install
+      popd
+      cp version.h $out/include
+    '';
+  };
   
   dontAddDisableDepTrack = true;
 

Modified: nixpkgs/trunk/pkgs/os-specific/linux/kernel/perf.nix
==============================================================================
--- nixpkgs/trunk/pkgs/os-specific/linux/kernel/perf.nix        Fri Jan  6 
16:14:02 2012        (r31352)
+++ nixpkgs/trunk/pkgs/os-specific/linux/kernel/perf.nix        Fri Jan  6 
16:45:14 2012        (r31353)
@@ -1,4 +1,4 @@
-{ stdenv, kernel, elfutils }:
+{ stdenv, kernel, elfutils, python, perl, newt }:
 
 stdenv.mkDerivation {
   name = "perf-linux-${kernel.version}";
@@ -7,10 +7,21 @@
 
   preConfigure = ''
     cd tools/perf
-    export makeFlags="DESTDIR=$out"
+    sed -i s,/usr/include/elfutils,$elfutils/include/elfutils, Makefile
+    export makeFlags="DESTDIR=$out $makeFlags"
   '';
 
-  buildInputs = [ elfutils ];
+  buildInputs = [ elfutils python perl newt ];
+
+  inherit elfutils;
+
+  crossAttrs = {
+    /* I don't want cross-python or cross-perl -
+       I don't know if cross-python even works */
+    propagatedBuildInputs = [ elfutils.hostDrv newt.hostDrv ];
+    makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-";
+    elfutils = elfutils.hostDrv;
+  };
 
   meta = {
     homepage = https://perf.wiki.kernel.org/;

Modified: nixpkgs/trunk/pkgs/top-level/all-packages.nix
==============================================================================
--- nixpkgs/trunk/pkgs/top-level/all-packages.nix       Fri Jan  6 16:14:02 
2012        (r31352)
+++ nixpkgs/trunk/pkgs/top-level/all-packages.nix       Fri Jan  6 16:45:14 
2012        (r31353)
@@ -4318,6 +4318,8 @@
 
   nettle = callPackage ../development/libraries/nettle { };
 
+  newt = callPackage ../development/libraries/newt { };
+
   nspr = callPackage ../development/libraries/nspr { };
 
   nss = callPackage ../development/libraries/nss { };
_______________________________________________
nix-commits mailing list
nix-comm...@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to