about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/halide
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/compilers/halide
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/halide')
-rw-r--r--nixpkgs/pkgs/development/compilers/halide/default.nix64
-rw-r--r--nixpkgs/pkgs/development/compilers/halide/nix.patch55
2 files changed, 119 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/halide/default.nix b/nixpkgs/pkgs/development/compilers/halide/default.nix
new file mode 100644
index 000000000000..1d3b13937fc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/halide/default.nix
@@ -0,0 +1,64 @@
+{ llvmPackages, lib, fetchFromGitHub, cmake
+, libpng, libjpeg, mesa_noglu, eigen, openblas
+}:
+
+let
+  version = "2018_02_15";
+
+in llvmPackages.stdenv.mkDerivation {
+
+  name = "halide-${builtins.replaceStrings ["_"] ["."] version}";
+
+  src = fetchFromGitHub {
+    owner = "halide";
+    repo = "Halide";
+    rev = "release_${version}";
+    sha256 = "14lmpbxydx7ii0pxds6rgq5vw4i6yfjsq0bai1l5wwpv1rnwmbxd";
+  };
+
+  patches = [ ./nix.patch ];
+
+  # clang fails to compile intermediate code because
+  # of unused "--gcc-toolchain" option
+  postPatch = ''
+    sed -i "s/-Werror//" src/CMakeLists.txt
+  '';
+
+  cmakeFlags = [ "-DWARNINGS_AS_ERRORS=OFF" ];
+
+  # To handle the lack of 'local' RPATH; required, as they call one of
+  # their built binaries requiring their libs, in the build process.
+  preBuild = ''
+    export LD_LIBRARY_PATH="$(pwd)/lib:$LD_LIBRARY_PATH"
+  '';
+
+  enableParallelBuilding = true;
+
+  # Note: only openblas and not atlas part of this Nix expression
+  # see pkgs/development/libraries/science/math/liblapack/3.5.0.nix
+  # to get a hint howto setup atlas instead of openblas
+  buildInputs = [ llvmPackages.llvm libpng libjpeg mesa_noglu eigen openblas ];
+
+  nativeBuildInputs = [ cmake ];
+
+  # No install target for cmake available.
+  # Calling install target in Makefile causes complete rebuild
+  # and the library rpath is broken, because libncursesw.so.6 is missing.
+  # Another way is using "make halide_archive", but the tarball is not easy
+  # to disassemble.
+  installPhase = ''
+    find
+    mkdir -p "$out/lib" "$out/bin"
+    cp bin/HalideTrace* "$out/bin"
+    cp lib/libHalide.so "$out/lib"
+    cp -r include "$out"
+  '';
+
+  meta = with lib; {
+    description = "C++ based language for image processing and computational photography";
+    homepage = "https://halide-lang.org";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.ck3d ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/halide/nix.patch b/nixpkgs/pkgs/development/compilers/halide/nix.patch
new file mode 100644
index 000000000000..2ab1e31adeb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/halide/nix.patch
@@ -0,0 +1,55 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 40a685b7e..c452efd09 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -49,10 +49,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+
+ set(LLVM_VERSION "${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}")
+
+-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-as${CMAKE_EXECUTABLE_SUFFIX}" LLVM_AS)
+-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-nm${CMAKE_EXECUTABLE_SUFFIX}" LLVM_NM)
+-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/clang${CMAKE_EXECUTABLE_SUFFIX}" CLANG)
+-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-config${CMAKE_EXECUTABLE_SUFFIX}" LLVM_CONFIG)
++find_program(LLVM_AS llvm-as HINTS ${LLVM_TOOLS_BINARY_DIR})
++find_program(LLVM_NM llvm-nm HINTS ${LLVM_TOOLS_BINARY_DIR})
++find_program(CLANG clang HINTS ${LLVM_TOOLS_BINARY_DIR})
++find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_TOOLS_BINARY_DIR})
+
+ # LLVM doesn't appear to expose --system-libs via its CMake interface,
+ # so we must shell out to llvm-config to find this info
+diff --git a/apps/linear_algebra/CMakeLists.txt b/apps/linear_algebra/CMakeLists.txt
+index 132c80e6a..36ce865f2 100644
+--- a/apps/linear_algebra/CMakeLists.txt
++++ b/apps/linear_algebra/CMakeLists.txt
+@@ -26,7 +26,7 @@ if (CBLAS_FOUND)
+   #  Atlas requires also linking against its provided libcblas for cblas symbols
+   set(ATLAS_EXTRA_LIBS cblas) # XXX fragile
+   set(OpenBLAS_EXTRA_LIBS)
+-  set(BLAS_VENDORS OpenBLAS ATLAS)
++  set(BLAS_VENDORS OpenBLAS)
+
+   # TODO
+   # there are more vendors we could add here that support the cblas interface
+@@ -41,6 +41,7 @@ if (CBLAS_FOUND)
+       message(STATUS " ${BLAS_VENDOR}: Missing")
+     else()
+       message(STATUS " ${BLAS_VENDOR}: Found")
++      set(BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE FILEPATH "BLAS library to use")
+       list(APPEND BLAS_VENDORS ${NAME})
+     endif()
+   endforeach()
+diff --git a/apps/linear_algebra/tests/CMakeLists.txt b/apps/linear_algebra/tests/CMakeLists.txt
+index 4b95eb3bb..1daa97437 100644
+--- a/apps/linear_algebra/tests/CMakeLists.txt
++++ b/apps/linear_algebra/tests/CMakeLists.txt
+@@ -19,6 +19,6 @@ target_compile_options(test_halide_blas PRIVATE -Wno-unused-variable)
+ target_link_libraries(test_halide_blas
+   PRIVATE
+    halide_blas
+-   cblas # XXX fragile
++   ${BLAS_LIBRARIES}
+    Halide
+ )
+--
+2.15.0
+