From 83fd63995af5447a25ae79494b7ba29cd9ff0441 Mon Sep 17 00:00:00 2001 From: artuuge Date: Tue, 28 Jun 2016 08:41:24 +0200 Subject: cpp_ethereum: init at 1.2.9 jsoncpp: 1.6.5 -> 1.7.2 libjson_rpc_cpp: 0.2.1 -> 0.6.0 argtable: init at 3.0.1 libcpuid: init at 0.2.2 --- .../misc/webthree-umbrella/default.nix | 152 +++++++++++++++++++++ .../libraries/jsoncpp/1.6.5/default.nix | 48 +++++++ pkgs/development/libraries/jsoncpp/default.nix | 60 ++++---- .../libraries/libjson-rpc-cpp/0.2.1/default.nix | 30 ++++ .../libraries/libjson-rpc-cpp/default.nix | 77 ++++++++--- pkgs/tools/misc/argtable/default.nix | 41 ++++++ pkgs/tools/misc/libcpuid/default.nix | 65 +++++++++ pkgs/top-level/all-packages.nix | 19 +++ 8 files changed, 436 insertions(+), 56 deletions(-) create mode 100644 pkgs/applications/misc/webthree-umbrella/default.nix create mode 100644 pkgs/development/libraries/jsoncpp/1.6.5/default.nix create mode 100644 pkgs/development/libraries/libjson-rpc-cpp/0.2.1/default.nix create mode 100644 pkgs/tools/misc/argtable/default.nix create mode 100644 pkgs/tools/misc/libcpuid/default.nix (limited to 'pkgs') diff --git a/pkgs/applications/misc/webthree-umbrella/default.nix b/pkgs/applications/misc/webthree-umbrella/default.nix new file mode 100644 index 00000000000..bfdafc3ce39 --- /dev/null +++ b/pkgs/applications/misc/webthree-umbrella/default.nix @@ -0,0 +1,152 @@ +{ stdenv +, fetchgit +, cmake +, boost +, gmp +, jsoncpp +, leveldb +, cryptopp +, libcpuid +, miniupnpc +, libjson_rpc_cpp +, curl +, libmicrohttpd +, mesa + +, opencl-headers ? null + +, withAMD ? false +, amdappsdk ? null + +, withBeignet ? false +, beignet ? null + +, withCUDA ? false +, nvidia_x11 ? null + +, withGUI ? false +, qtwebengine ? null +, qtbase ? null +, qtdeclarative ? null + +, withProfiling ? false +, gperftools ? null + +, withEVMJIT ? false +, llvm ? null +, zlib ? null +, ncurses ? null + +, extraCmakeFlags ? [] +}: + +assert withAMD -> (amdappsdk != null); +assert withBeignet -> (beignet != null); +assert withCUDA -> (nvidia_x11 != null); +assert stdenv.lib.findSingle (x: x) true false [ withAMD withBeignet withCUDA ]; + +assert withGUI -> (qtwebengine != null) && (qtbase != null) && (qtdeclarative != null); +assert withProfiling -> (gperftools != null); +assert withEVMJIT -> (llvm != null) && (zlib != null) && (ncurses != null); + +let + withOpenCL = (stdenv.lib.any (x: x) [ withAMD withBeignet withCUDA ]); +in + +assert withOpenCL -> (opencl-headers != null); + +stdenv.mkDerivation rec { + name = "cpp-ethereum-${version}"; + version = "1.2.9"; + + src = fetchgit { + url = https://github.com/ethereum/webthree-umbrella.git; + rev = "850479b159a0bfa316fd261ab96b0a043acd766c"; + sha256 = "0k8w8gqzy71x77p0p85r38gfdnzrlzk2yvb3ablml9ppg4qb4ch5"; + }; + + patchPhase = stdenv.lib.optional withBeignet '' + sed -i -re 's#NAMES\ (OpenCL.*)#NAMES\ libcl.so\ \1#g' webthree-helpers/cmake/FindOpenCL.cmake + ''; + + cmakeFlags = with stdenv.lib; concatStringsSep " " (flatten [ + "-DCMAKE_BUILD_TYPE=Release" + "-DGUI=${toString withGUI}" + "-DETHASHCL=${toString withOpenCL}" + "-DPROFILING=${toString withProfiling}" + "-DEVMJIT=${toString withEVMJIT}" + (optional withOpenCL "-DCMAKE_INCLUDE_PATH=${opencl-headers}/include") + (optional withAMD "-DCMAKE_LIBRARY_PATH=${amdappsdk}/lib") + (optional withBeignet "-DCMAKE_LIBRARY_PATH=${beignet}/lib/beignet") + (optional withCUDA "-DCMAKE_LIBRARY_PATH=${nvidia_x11}/lib") + (optional withEVMJIT "-DCMAKE_PREFIX_PATH=${llvm}") + extraCmakeFlags + ]); + + configurePhase = '' + export BOOST_INCLUDEDIR=${boost}/include + export BOOST_LIBRARYDIR=${boost.out}/lib + + mkdir -p Build/Install + pushd Build + + cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/Install $cmakeFlags + ''; + + buildInputs = with stdenv.lib; [ + cmake + boost + gmp + jsoncpp + leveldb + cryptopp + libcpuid + miniupnpc + libjson_rpc_cpp + curl + libmicrohttpd + mesa + (optional withOpenCL opencl-headers) + (optional withAMD amdappsdk) + (optional withBeignet beignet) + (optional withCUDA nvidia_x11) + (optional withGUI [ + qtwebengine + qtbase + qtdeclarative + ]) + (optional withProfiling gperftools) + (optional withEVMJIT [ + llvm + zlib + ncurses + ]) + ]; + + runPath = with stdenv.lib; concatStringsSep ":" (flatten [ + (makeLibraryPath (flatten [ stdenv.cc.cc buildInputs ])) + (optional withBeignet "${beignet}/lib/beignet") + ]); + + installPhase = '' + make install + + mkdir -p $out + + for f in Install/lib/*.so* $(find Install/bin -executable -type f); do + patchelf --set-rpath $runPath:$out/lib $f + done + + cp -r Install/* $out + ''; + + dontStrip = true; + + meta = with stdenv.lib; { + decription = "Umbrella project for the Ethereum C++ implementation"; + homepage = https://github.com/ethereum/webthree-umbrella.git; + license = licenses.gpl3; + maintainers = with maintainers; [ artuuge ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/development/libraries/jsoncpp/1.6.5/default.nix b/pkgs/development/libraries/jsoncpp/1.6.5/default.nix new file mode 100644 index 00000000000..53df8d6e7cf --- /dev/null +++ b/pkgs/development/libraries/jsoncpp/1.6.5/default.nix @@ -0,0 +1,48 @@ +{ stdenv, fetchFromGitHub, cmake, python }: + +stdenv.mkDerivation rec { + name = "jsoncpp-${version}"; + version = "1.6.5"; + + src = fetchFromGitHub { + owner = "open-source-parsers"; + repo = "jsoncpp"; + rev = version; + sha256 = "08y54n4v3q18ik8iv8zyziava3x130ilzf1l3qli3vjwf6l42fm0"; + }; + + /* During darwin bootstrap, we have a cp that doesn't understand the + * --reflink=auto flag, which is used in the default unpackPhase for dirs + */ + unpackPhase = '' + cp -a ${src} ${src.name} + chmod -R +w ${src.name} + export sourceRoot=${src.name} + ''; + + # Hack to be able to run the test, broken because we use + # CMAKE_SKIP_BUILD_RPATH to avoid cmake resetting rpath on install + preBuild = '' + export LD_LIBRARY_PATH="`pwd`/src/lib_json:$LD_LIBRARY_PATH" + ''; + + nativeBuildInputs = [ cmake python ]; + + CXXFLAGS = "-Wno-shift-negative-value"; + + cmakeFlags = [ + "-DJSONCPP_LIB_BUILD_SHARED=ON" + "-DJSONCPP_LIB_BUILD_STATIC=OFF" + "-DJSONCPP_WITH_CMAKE_PACKAGE=ON" + ]; + + meta = { + inherit version; + homepage = https://github.com/open-source-parsers/jsoncpp; + description = "A simple API to manipulate JSON data in C++"; + maintainers = with stdenv.lib.maintainers; [ ttuegel page ]; + platforms = stdenv.lib.platforms.all; + license = stdenv.lib.licenses.mit; + branch = "1.6"; + }; +} diff --git a/pkgs/development/libraries/jsoncpp/default.nix b/pkgs/development/libraries/jsoncpp/default.nix index 53df8d6e7cf..5c4c4a693df 100644 --- a/pkgs/development/libraries/jsoncpp/default.nix +++ b/pkgs/development/libraries/jsoncpp/default.nix @@ -1,48 +1,34 @@ -{ stdenv, fetchFromGitHub, cmake, python }: - +{ stdenv +, fetchgit +, cmake +, python +}: stdenv.mkDerivation rec { name = "jsoncpp-${version}"; - version = "1.6.5"; + version = "1.7.2"; - src = fetchFromGitHub { - owner = "open-source-parsers"; - repo = "jsoncpp"; - rev = version; - sha256 = "08y54n4v3q18ik8iv8zyziava3x130ilzf1l3qli3vjwf6l42fm0"; + src = fetchgit { + url = https://github.com/open-source-parsers/jsoncpp.git; + sha256 = "04w4cfmvyv52rpqhc370ln8rhlsrr515778bixhgafqbp3p4x34k"; + rev = "c8054483f82afc3b4db7efe4e5dc034721649ec8"; }; - /* During darwin bootstrap, we have a cp that doesn't understand the - * --reflink=auto flag, which is used in the default unpackPhase for dirs - */ - unpackPhase = '' - cp -a ${src} ${src.name} - chmod -R +w ${src.name} - export sourceRoot=${src.name} - ''; - - # Hack to be able to run the test, broken because we use - # CMAKE_SKIP_BUILD_RPATH to avoid cmake resetting rpath on install - preBuild = '' - export LD_LIBRARY_PATH="`pwd`/src/lib_json:$LD_LIBRARY_PATH" - ''; - - nativeBuildInputs = [ cmake python ]; + configurePhase = '' + mkdir -p Build + pushd Build - CXXFLAGS = "-Wno-shift-negative-value"; + mkdir -p $out + cmake .. -DCMAKE_INSTALL_PREFIX=$out \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release + ''; - cmakeFlags = [ - "-DJSONCPP_LIB_BUILD_SHARED=ON" - "-DJSONCPP_LIB_BUILD_STATIC=OFF" - "-DJSONCPP_WITH_CMAKE_PACKAGE=ON" - ]; + buildInputs = [ cmake python ]; - meta = { - inherit version; + meta = with stdenv.lib; { homepage = https://github.com/open-source-parsers/jsoncpp; - description = "A simple API to manipulate JSON data in C++"; - maintainers = with stdenv.lib.maintainers; [ ttuegel page ]; - platforms = stdenv.lib.platforms.all; - license = stdenv.lib.licenses.mit; - branch = "1.6"; + description = "A C++ library for interacting with JSON."; + license = licenses.mit; + platforms = platforms.linux; }; } diff --git a/pkgs/development/libraries/libjson-rpc-cpp/0.2.1/default.nix b/pkgs/development/libraries/libjson-rpc-cpp/0.2.1/default.nix new file mode 100644 index 00000000000..5e0a8560110 --- /dev/null +++ b/pkgs/development/libraries/libjson-rpc-cpp/0.2.1/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchurl, cmake, curl }: + +let + basename = "libjson-rpc-cpp"; + version = "0.2.1"; +in + +stdenv.mkDerivation { + name = "${basename}-${version}"; + + src = fetchurl { + url = "https://github.com/cinemast/${basename}/archive/${version}.tar.gz"; + sha256 = "1pc9nn4968qkda8vr4f9dijn2fcldm8i0ymwmql29h4cl5ghdnpw"; + }; + + buildInputs = [ cmake curl ]; + + NIX_LDFLAGS = "-lpthread"; + enableParallelBuilding = true; + doCheck = true; + + checkPhase = "LD_LIBRARY_PATH=out/ ctest"; + + meta = { + description = "C++ framework for json-rpc (json remote procedure call)"; + homepage = https://github.com/cinemast/libjson-rpc-cpp; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/development/libraries/libjson-rpc-cpp/default.nix b/pkgs/development/libraries/libjson-rpc-cpp/default.nix index 5e0a8560110..2cfede1eb6e 100644 --- a/pkgs/development/libraries/libjson-rpc-cpp/default.nix +++ b/pkgs/development/libraries/libjson-rpc-cpp/default.nix @@ -1,30 +1,69 @@ -{ stdenv, fetchurl, cmake, curl }: +{ stdenv +, fetchgit +, cmake +, jsoncpp +, argtable +, curl +, libmicrohttpd +, doxygen +, catch +}: +stdenv.mkDerivation rec { + name = "libjson-rpc-cpp-${version}"; + version = "0.6.0"; -let - basename = "libjson-rpc-cpp"; - version = "0.2.1"; -in + src = fetchgit { + url = https://github.com/cinemast/libjson-rpc-cpp.git; + sha256 = "00fxxisg89zgg1wq047n8r8ws48jx35x3s6bbym4kg7dkxv9vv9f"; + rev = "c6e3d7195060774bf95afc6df9c9588922076d3e"; + }; -stdenv.mkDerivation { - name = "${basename}-${version}"; + patchPhase = '' + for f in cmake/FindArgtable.cmake \ + src/stubgenerator/stubgenerator.cpp \ + src/stubgenerator/stubgeneratorfactory.cpp + do + sed -i -re 's/argtable2/argtable3/g' $f + done - src = fetchurl { - url = "https://github.com/cinemast/${basename}/archive/${version}.tar.gz"; - sha256 = "1pc9nn4968qkda8vr4f9dijn2fcldm8i0ymwmql29h4cl5ghdnpw"; - }; + sed -i -re 's#MATCHES "jsoncpp"#MATCHES ".*/jsoncpp/json$"#g' cmake/FindJsoncpp.cmake + ''; + + configurePhase = '' + mkdir -p Build/Install + pushd Build + + cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/Install \ + -DCMAKE_BUILD_TYPE=Release + ''; + + installPhase = '' + mkdir -p $out + + function fixRunPath { + p=$(patchelf --print-rpath $1) + q="$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc jsoncpp argtable libmicrohttpd curl ]}:$out/lib" + patchelf --set-rpath $q $1 + } + + make install - buildInputs = [ cmake curl ]; + sed -i -re "s#-([LI]).*/Build/Install(.*)#-\1$out\2#g" Install/lib/pkgconfig/*.pc + for f in Install/lib/*.so* $(find Install/bin -executable -type f); do + fixRunPath $f + done + + cp -r Install/* $out + ''; - NIX_LDFLAGS = "-lpthread"; - enableParallelBuilding = true; - doCheck = true; + dontStrip = true; - checkPhase = "LD_LIBRARY_PATH=out/ ctest"; + buildInputs = [ cmake jsoncpp argtable curl libmicrohttpd doxygen catch ]; - meta = { + meta = with stdenv.lib; { description = "C++ framework for json-rpc (json remote procedure call)"; homepage = https://github.com/cinemast/libjson-rpc-cpp; - license = stdenv.lib.licenses.mit; - platforms = stdenv.lib.platforms.linux; + license = licenses.mit; + platforms = platforms.linux; }; } 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7225a4e65e0..739a70938be 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -412,6 +412,8 @@ in apitrace = qt55.callPackage ../applications/graphics/apitrace {}; + argtable = callPackage ../tools/misc/argtable {}; + argyllcms = callPackage ../tools/graphics/argyllcms {}; arp-scan = callPackage ../tools/misc/arp-scan { }; @@ -2156,6 +2158,8 @@ in less = callPackage ../tools/misc/less { }; + libcpuid = callPackage ../tools/misc/libcpuid { }; + lesspipe = callPackage ../tools/misc/lesspipe { }; liquidsoap = callPackage ../tools/audio/liquidsoap/full.nix { }; @@ -7550,6 +7554,8 @@ in jsoncpp = callPackage ../development/libraries/jsoncpp { }; + jsoncpp_1_6_5 = callPackage ../development/libraries/jsoncpp/1.6.5 { }; + jsonnet = callPackage ../development/compilers/jsonnet { }; libjson = callPackage ../development/libraries/libjson { }; @@ -8080,6 +8086,8 @@ in libjson_rpc_cpp = callPackage ../development/libraries/libjson-rpc-cpp { }; + libjson_rpc_cpp_0_2_1 = callPackage ../development/libraries/libjson-rpc-cpp/0.2.1 { }; + libkate = callPackage ../development/libraries/libkate { }; libksba = callPackage ../development/libraries/libksba { }; @@ -12242,6 +12250,17 @@ in conkeror-unwrapped = callPackage ../applications/networking/browsers/conkeror { }; conkeror = self.wrapFirefox conkeror-unwrapped { }; + cpp_ethereum = callPackage ../applications/misc/webthree-umbrella { + # withCUDA = true; + # inherit (linuxPackages) nvidia_x11; + + # withEVMJIT = true; + # inherit (pkgs.llvmPackages_38) llvm; + + # withGUI = true; + # inherit (pkgs.qt5) qtwebengine qtbase qtdeclarative; + }; + csdp = callPackage ../applications/science/math/csdp { liblapack = liblapackWithoutAtlas; }; -- cgit 1.4.1