@@ -1,10 +1,5 @@
1−{ stdenv
2−, fetchFromGitHub
3−, libtool
4−, automake
5−, autoconf
6−, python2 # Needed for tests
7−}:
1+{ stdenv, fetchFromGitHub, autoreconfHook }:
2+
83stdenv.mkDerivation rec {
94 name = "libcpuid-${version}";
105 version = "0.4.0";
@@ -16,51 +11,18 @@ stdenv.mkDerivation rec {
1611 sha256 = "136kv6m666f7s18mim0vdbzqvs4s0wvixa12brj9p3kmfbx48bw7";
1712 };
1813
19− patchPhase = ''
20− libtoolize
21− autoreconf --install
22− '';
23−
24− configurePhase = ''
25− mkdir -p Install
26− ./configure --prefix=$(pwd)/Install
27− substituteInPlace Makefile --replace "/usr/local" "$out"
28− '';
29−
30− buildPhase = ''
31− make all
32− '';
33−
34− postInstall = ''
35− pushd Install
36− LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/lib ${python2.interpreter} ../tests/run_tests.py ./bin/cpuid_tool ../tests/
37− popd
38−
39− function fixRunPath {
40− p0=$(patchelf --print-rpath $1)
41− p1=$(echo $p0 | sed -re 's#.*Install/lib:##g')
42− patchelf --set-rpath $p1 $1
43− }
44−
45− fixRunPath Install/bin/cpuid_tool
46−
47− mkdir -p $out
48− sed -i -re "s#(prefix=).*Install#\1$out#g" Install/lib/pkgconfig/libcpuid.pc
49−
50− cp -r Install/* $out
51− cp -r tests $out
52− '';
53−
54− nativeBuildInputs = [
55− libtool
56− automake
57− autoconf
14+ patches = [
15+ # Work around https://github.com/anrieff/libcpuid/pull/102.
16+ ./stdint.patch
5817 ];
5918
19+ nativeBuildInputs = [ autoreconfHook ];
20+
6021 meta = with stdenv.lib; {
6122 homepage = http://libcpuid.sourceforge.net/;
62− description = "a small C library for x86 CPU detection and feature extraction";
63− license = licenses.bsd3;
64− maintainers = with maintainers; [ artuuge ];
23+ description = "A small C library for x86 CPU detection and feature extraction";
24+ license = licenses.bsd2;
25+ maintainers = with maintainers; [ orivej artuuge ];
26+ platforms = platforms.all;
6527 };
6628}