diff options
Diffstat (limited to 'pkgs/tools')
-rw-r--r-- | pkgs/tools/misc/argtable/default.nix | 41 | ||||
-rw-r--r-- | pkgs/tools/misc/libcpuid/default.nix | 65 |
2 files changed, 106 insertions, 0 deletions
diff --git a/pkgs/tools/misc/argtable/default.nix b/pkgs/tools/misc/argtable/default.nix new file mode 100644 index 00000000000..76f42b1976a --- /dev/null +++ b/pkgs/tools/misc/argtable/default.nix @@ -0,0 +1,41 @@ +{ stdenv +, fetchgit +}: +stdenv.mkDerivation rec { + name = "argtable-${version}"; + version = "3.0.1"; + + src = fetchgit { + url = https://github.com/argtable/argtable3.git; + rev = "de93cfd85f755250285b337cba053a709a270721"; + sha256 = "0fbvk78s3dwryrzgafdra0lb8w7lb873c6xgldl94ps9828x85i3"; + }; + + buildPhase = '' + gcc -shared -o libargtable3.so -fPIC argtable3.c + + pushd tests + make + popd + ''; + + installPhase = '' + mkdir -p $out/include + cp argtable3.h $out/include + + mkdir -p $out/lib + cp libargtable3.so $out/lib + + mkdir -p $out/src + cp argtable3.c $out/src + cp -r examples $out/src + ln -s $out/include/argtable3.h $out/src/argtable3.h + ''; + + meta = with stdenv.lib; { + homepage = http://www.argtable.org/; + description = "A Cross-Platform, Single-File, ANSI C Command-Line Parsing Library"; + license = licenses.bsd3; + maintainers = with maintainers; [ artuuge ]; + }; +} diff --git a/pkgs/tools/misc/libcpuid/default.nix b/pkgs/tools/misc/libcpuid/default.nix new file mode 100644 index 00000000000..8f258a38f7f --- /dev/null +++ b/pkgs/tools/misc/libcpuid/default.nix @@ -0,0 +1,65 @@ +{ stdenv +, fetchgit +, libtool +, automake +, autoconf +, python +}: +stdenv.mkDerivation rec { + name = "libcpuid-${version}"; + version = "0.2.2"; + + src = fetchgit { + url = https://github.com/anrieff/libcpuid.git; + rev = "535ec64dd9d8df4c5a8d34b985280b58a5396fcf"; + sha256 = "1j9pg7fyvqhr859k5yh8ccl9jjx65c7rrsddji83qmqyg0vp1k1a"; + }; + + patchPhase = '' + libtoolize + autoreconf --install + ''; + + 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 ${python.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 + ''; + + buildInputs = [ + libtool + automake + autoconf + ]; + + meta = with stdenv.lib; { + homepage = http://libcpuid.sourceforge.net/; + description = "a small C library for x86 CPU detection and feature extraction"; + license = licenses.bsd3; + maintainers = with maintainers; [ artuuge ]; + }; +} |