diff --git a/pkgs/applications/misc/cgminer/default.nix b/pkgs/applications/misc/cgminer/default.nix new file mode 100644 index 00000000000..4ae404a002f --- /dev/null +++ b/pkgs/applications/misc/cgminer/default.nix @@ -0,0 +1,44 @@ +{ fetchgit, stdenv, pkgconfig, libtool, autoconf, automake, + curl, ncurses, amdappsdk, amdadlsdk, xorg }: + +stdenv.mkDerivation rec { + version = "2.11.4"; + name = "cgminer-${version}"; + + src = fetchgit { + url = "https://github.com/ckolivas/cgminer.git"; + rev = "96c8ff5f10f2d8f0cf4d1bd889e8eeac2e4aa715"; + sha256 = "1vf9agy4vw50cap03qig2y65hdrsdy7cknkzyagv89w5xb230r9a"; + }; + + buildInputs = [ autoconf automake pkgconfig libtool curl ncurses amdappsdk amdadlsdk xorg.libX11 xorg.libXext xorg.libXinerama ]; + configureScript = "./autogen.sh"; + configureFlags = "--enable-scrypt"; + NIX_LDFLAGS = "-lgcc_s -lX11 -lXext -lXinerama"; + + preConfigure = '' + ln -s ${amdadlsdk}/include/* ADL_SDK/ + ''; + + postBuild = '' + gcc api-example.c -I compat/jansson -o cgminer-api + ''; + + postInstall = '' + cp cgminer-api $out/bin/ + chmod 444 $out/bin/*.cl + ''; + + meta = with stdenv.lib; { + description = "CPU/GPU miner in c for bitcoin"; + longDescription= '' + This is a multi-threaded multi-pool GPU, FPGA and ASIC miner with ATI GPU + monitoring, (over)clocking and fanspeed support for bitcoin and derivative + coins. Do not use on multiple block chains at the same time! + ''; + homepage = "https://github.com/ckolivas/cgminer"; + license = licenses.gpl3; + maintainers = [ maintainers.offline ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; +} diff --git a/pkgs/development/misc/amdadl-sdk/default.nix b/pkgs/development/misc/amdadl-sdk/default.nix new file mode 100644 index 00000000000..d311b6b722a --- /dev/null +++ b/pkgs/development/misc/amdadl-sdk/default.nix @@ -0,0 +1,44 @@ +{ fetchurl, stdenv, unzip }: + +stdenv.mkDerivation rec { + version = "4.0"; + name = "amdadl-sdk-${version}"; + + src = fetchurl { + url = "http://download2-developer.amd.com/amd/GPU/zip/ADL_SDK_${version}.zip"; + sha256 = "4265ee2f265b69cc39b61e10f79741c1d799f4edb71dce14a7d88509fbec0efa"; + }; + + buildInputs = [ unzip ]; + + doCheck = false; + + unpackPhase = '' + unzip $src + ''; + + buildPhase = '' + #Build adlutil + cd adlutil + gcc main.c -o adlutil -DLINUX -ldl -I ../include/ + cd .. + ''; + + installPhase = '' + #Install SDK + mkdir -p $out/bin + cp -r include "$out/" + cp "adlutil/adlutil" "$out/bin/adlutil" + + #Fix modes + chmod -R 755 "$out/bin/" + ''; + + meta = with stdenv.lib; { + description = "API to access display driver functionality for ATI graphics cards"; + homepage = http://developer.amd.com/tools/graphics-development/display-library-adl-sdk/; + license = licenses.amdadl; + maintainers = [ maintainers.offline ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; +} diff --git a/pkgs/development/misc/amdapp-sdk/01-remove-aparapi-samples.patch b/pkgs/development/misc/amdapp-sdk/01-remove-aparapi-samples.patch new file mode 100644 index 00000000000..f474f76f01e --- /dev/null +++ b/pkgs/development/misc/amdapp-sdk/01-remove-aparapi-samples.patch @@ -0,0 +1,10 @@ +--- samples/Makefile 2012-11-29 05:58:48.000000000 +0100 ++++ samples/Makefile 2012-12-30 20:13:30.926576277 +0100 +@@ -3,7 +3,6 @@ + include $(DEPTH)/make/openclsdkdefs.mk + + SUBDIRS = opencl +-SUBDIRS += aparapi + ifneq ($(OS), lnx) + SUBDIRS += C++Amp + ifeq ($(BITS), 64) diff --git a/pkgs/development/misc/amdapp-sdk/default.nix b/pkgs/development/misc/amdapp-sdk/default.nix new file mode 100644 index 00000000000..355afb9587b --- /dev/null +++ b/pkgs/development/misc/amdapp-sdk/default.nix @@ -0,0 +1,105 @@ +{ stdenv, fetchurl, makeWrapper, perl, mesa, xorg, + version? "2.8", # What version + samples? false # Should samples be installed +}: + +let + + src_hashes = { + "2.6" = { + x86 = "99610737f21b2f035e0eac4c9e776446cc4378a614c7667de03a82904ab2d356"; + x86_64 = "1fj55358s4blxq9bp77k07gqi22n5nfkzwjkbdc62gmy1zxxlhih"; + }; + + "2.7" = { + x86 = "99610737f21b2f035e0eac4c9e776446cc4378a614c7667de03a82904ab2d356"; + x86_64 = "08bi43bgnsxb47vbirh09qy02w7zxymqlqr8iikk9aavfxjlmch1"; + }; + + "2.8" = { + x86 = "99610737f21b2f035e0eac4c9e776446cc4378a614c7667de03a82904ab2d356"; + x86_64 = "d9c120367225bb1cd21abbcf77cb0a69cfb4bb6932d0572990104c566aab9681"; + }; + }; + + bits = if stdenv.system == "x86_64-linux" then "64" + else "32"; + + arch = if stdenv.system == "x86_64-linux" then "x86_64" + else "x86"; + +in stdenv.mkDerivation rec { + name = "amdapp-sdk-${version}"; + + src = if stdenv.system == "x86_64-linux" then fetchurl { + url = "http://developer.amd.com/wordpress/media/2012/11/AMD-APP-SDK-v${version}-lnx64.tgz"; + sha256 = (builtins.getAttr version src_hashes).x86_64; + } else if stdenv.system == "i686-linux" then fetchurl { + url = "http://developer.amd.com/wordpress/media/2012/11/AMD-APP-SDK-v${version}-lnx32.tgz"; + sha256 = (builtins.getAttr version src_hashes).x86; + } else + throw "System not supported"; + + # TODO: Add support for aparapi, java parallel api + patches = [ ./01-remove-aparapi-samples.patch ]; + + patchFlags = "-p0"; + buildInputs = [ makeWrapper perl mesa xorg.libX11 xorg.libXext xorg.libXaw xorg.libXi xorg.libXxf86vm ]; + propagatedBuildInputs = [ stdenv.gcc ]; + NIX_LDFLAGS = "-lX11 -lXext -lXmu -lXi -lXxf86vm"; + doCheck = false; + + unpackPhase = '' + tar xvzf $src + tar xf AMD-APP-SDK-v${version}-RC-lnx${bits}.tgz + cd AMD-APP-SDK-v${version}-RC-lnx${bits} + ''; + + buildPhase = if !samples then ''echo "nothing to build"'' else null; + + installPhase = '' + # Install SDK + mkdir -p $out + cp -r {docs,include} "$out/" + mkdir -p "$out/"{bin,lib,samples/opencl/bin} + cp -r "./bin/${arch}/clinfo" "$out/bin/clinfo" + cp -r "./lib/${arch}/"* "$out/lib/" + + # Register ICD + mkdir -p "$out/etc/OpenCL/vendors" + echo "$out/lib/libamdocl${bits}.so" > "$out/etc/OpenCL/vendors/amd.icd" + # The OpenCL ICD specifications: http://www.khronos.org/registry/cl/extensions/khr/cl_khr_icd.txt + + # Install includes + mkdir -p "$out/usr/include/"{CAL,OpenVideo} + install -m644 './include/OpenVideo/'{OVDecode.h,OVDecodeTypes.h} "$out/usr/include/OpenVideo/" + + ${ if samples then '' + # Install samples + find ./samples/opencl/ -mindepth 1 -maxdepth 1 -type d -not -name bin -exec cp -r {} "$out/samples/opencl" \; + cp -r "./samples/opencl/bin/${arch}/"* "$out/samples/opencl/bin" + for f in $(find "$out/samples/opencl/bin/" -type f -not -name "*.*"); + do + wrapProgram "$f" --prefix PATH ":" "${stdenv.gcc}/bin" + done'' else "" + } + + # Create wrappers + patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" $out/bin/clinfo + patchelf --set-rpath ${stdenv.gcc.gcc}/lib64:${stdenv.gcc.gcc}/lib $out/bin/clinfo + + # Fix modes + find "$out/" -type f -exec chmod 644 {} \; + chmod -R 755 "$out/bin/" + find "$out/samples/opencl/bin/" -type f -name ".*" -exec chmod 755 {} \; + find "$out/samples/opencl/bin/" -type f -not -name "*.*" -exec chmod 755 {} \; + ''; + + meta = with stdenv.lib; { + description = "AMD Accelerated Parallel Processing (APP) SDK, with OpenCL 1.2 support"; + homepage = http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/; + license = licenses.amd; + maintainers = [ maintainers.offline ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; +} diff --git a/pkgs/lib/licenses.nix b/pkgs/lib/licenses.nix index 89edcd738f4..0669bc3f5c3 100644 --- a/pkgs/lib/licenses.nix +++ b/pkgs/lib/licenses.nix @@ -16,6 +16,18 @@ url = https://www.gnu.org/licenses/agpl.html; }; + amd = { + shortName = "amd"; + fullName = "AMD License Agreement"; + url = "http://developer.amd.com/amd-license-agreement/"; + }; + + amdadl = { + shortName = "amd-adl"; + fullName = "amd-adl license"; + url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/licenses/AMD-ADL?revision=1.1"; + }; + asl20 = { shortName = "ASL2.0"; fullName = "Apache Software License 2.0"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 60e18a4847a..9ba1d251563 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3094,6 +3094,27 @@ let ### DEVELOPMENT / MISC + amdadlsdk = callPackage ../development/misc/amdadl-sdk { }; + + amdappsdk26 = callPackage ../development/misc/amdapp-sdk { + version = "2.6"; + }; + + amdappsdk27 = callPackage ../development/misc/amdapp-sdk { + version = "2.7"; + }; + + amdappsdk28 = callPackage ../development/misc/amdapp-sdk { + version = "2.8"; + }; + + amdappsdk = amdappsdk28; + + amdappsdkFull = callPackage ../development/misc/amdapp-sdk { + version = "2.8"; + samples = true; + }; + avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc {}; avr8burnomat = callPackage ../development/misc/avr8-burn-omat { }; @@ -6920,6 +6941,10 @@ let cgit = callPackage ../applications/version-management/git-and-tools/cgit { }; + cgminer = callPackage ../applications/misc/cgminer { + amdappsdk = amdappsdk28; + }; + chatzilla = callPackage ../applications/networking/irc/chatzilla { xulrunner = firefox36Pkgs.xulrunner; };