libcpuid: clean up

This commit is contained in:
Orivej Desh 2018-06-22 13:16:01 +00:00
parent 75879177e8
commit 9af0ed346d
2 changed files with 16 additions and 49 deletions

View File

@ -1,10 +1,5 @@
{ stdenv { stdenv, fetchFromGitHub, autoreconfHook }:
, fetchFromGitHub
, libtool
, automake
, autoconf
, python2 # Needed for tests
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libcpuid-${version}"; name = "libcpuid-${version}";
version = "0.4.0"; version = "0.4.0";
@ -16,51 +11,18 @@ stdenv.mkDerivation rec {
sha256 = "136kv6m666f7s18mim0vdbzqvs4s0wvixa12brj9p3kmfbx48bw7"; sha256 = "136kv6m666f7s18mim0vdbzqvs4s0wvixa12brj9p3kmfbx48bw7";
}; };
patchPhase = '' patches = [
libtoolize # Work around https://github.com/anrieff/libcpuid/pull/102.
autoreconf --install ./stdint.patch
'';
configurePhase = ''
mkdir -p Install
./configure --prefix=$(pwd)/Install
substituteInPlace Makefile --replace "/usr/local" "$out"
'';
buildPhase = ''
make all
'';
postInstall = ''
pushd Install
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/lib ${python2.interpreter} ../tests/run_tests.py ./bin/cpuid_tool ../tests/
popd
function fixRunPath {
p0=$(patchelf --print-rpath $1)
p1=$(echo $p0 | sed -re 's#.*Install/lib:##g')
patchelf --set-rpath $p1 $1
}
fixRunPath Install/bin/cpuid_tool
mkdir -p $out
sed -i -re "s#(prefix=).*Install#\1$out#g" Install/lib/pkgconfig/libcpuid.pc
cp -r Install/* $out
cp -r tests $out
'';
nativeBuildInputs = [
libtool
automake
autoconf
]; ];
nativeBuildInputs = [ autoreconfHook ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://libcpuid.sourceforge.net/; homepage = http://libcpuid.sourceforge.net/;
description = "a small C library for x86 CPU detection and feature extraction"; description = "A small C library for x86 CPU detection and feature extraction";
license = licenses.bsd3; license = licenses.bsd2;
maintainers = with maintainers; [ artuuge ]; maintainers = with maintainers; [ orivej artuuge ];
platforms = platforms.all;
}; };
} }

View File

@ -0,0 +1,5 @@
--- a/libcpuid/libcpuid.h
+++ b/libcpuid/libcpuid.h
@@ -88 +88 @@
-#include "libcpuid_types.h"
+#include <stdint.h>