nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, fetchgit
3, libtool
4, automake
5, autoconf
6, python
7}:
8stdenv.mkDerivation rec {
9 name = "libcpuid-${version}";
10 version = "0.2.2";
11
12 src = fetchgit {
13 url = https://github.com/anrieff/libcpuid.git;
14 rev = "535ec64dd9d8df4c5a8d34b985280b58a5396fcf";
15 sha256 = "1j9pg7fyvqhr859k5yh8ccl9jjx65c7rrsddji83qmqyg0vp1k1a";
16 };
17
18 patchPhase = ''
19 libtoolize
20 autoreconf --install
21 '';
22
23 configurePhase = ''
24 mkdir -p Install
25 ./configure --prefix=$(pwd)/Install
26 substituteInPlace Makefile --replace "/usr/local" "$out"
27 '';
28
29 buildPhase = ''
30 make all
31 '';
32
33 postInstall = ''
34 pushd Install
35 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/lib ${python.interpreter} ../tests/run_tests.py ./bin/cpuid_tool ../tests/
36 popd
37
38 function fixRunPath {
39 p0=$(patchelf --print-rpath $1)
40 p1=$(echo $p0 | sed -re 's#.*Install/lib:##g')
41 patchelf --set-rpath $p1 $1
42 }
43
44 fixRunPath Install/bin/cpuid_tool
45
46 mkdir -p $out
47 sed -i -re "s#(prefix=).*Install#\1$out#g" Install/lib/pkgconfig/libcpuid.pc
48
49 cp -r Install/* $out
50 cp -r tests $out
51 '';
52
53 buildInputs = [
54 libtool
55 automake
56 autoconf
57 ];
58
59 meta = with stdenv.lib; {
60 homepage = http://libcpuid.sourceforge.net/;
61 description = "a small C library for x86 CPU detection and feature extraction";
62 license = licenses.bsd3;
63 maintainers = with maintainers; [ artuuge ];
64 };
65}