waifu2x-converter-cpp: Enable build on Darwin

+30 -6
+12 -5
pkgs/tools/graphics/waifu2x-converter-cpp/default.nix
··· 1 - { cmake, fetchFromGitHub, makeWrapper, opencv3, lib, stdenv, ocl-icd, opencl-headers 1 + { cmake, fetchFromGitHub, makeWrapper, opencv3, lib, stdenv, ocl-icd, opencl-headers, OpenCL 2 2 , cudaSupport ? false, cudatoolkit ? null 3 3 }: 4 4 ··· 13 13 sha256 = "0rv8bnyxz89za6gwk9gmdbaf3j7c1j52mip7h81rir288j35m84x"; 14 14 }; 15 15 16 + patches = [ 17 + # Remove the hard-coded compiler on Darwin and use the one in stdenv. 18 + ./waifu2x_darwin_build.diff 19 + ]; 20 + 16 21 buildInputs = [ 17 - ocl-icd opencv3 opencl-headers 18 - ] ++ lib.optional cudaSupport cudatoolkit; 22 + opencv3 23 + ] ++ lib.optional cudaSupport cudatoolkit 24 + ++ lib.optional stdenv.isDarwin OpenCL 25 + ++ lib.optionals stdenv.isLinux [ ocl-icd opencl-headers ]; 19 26 20 27 nativeBuildInputs = [ cmake makeWrapper ]; 21 28 22 - preFixup = '' 29 + preFixup = lib.optionalString stdenv.isLinux '' 23 30 wrapProgram $out/bin/waifu2x-converter-cpp --prefix LD_LIBRARY_PATH : "${ocl-icd}/lib" 24 31 ''; 25 32 ··· 28 35 homepage = "https://github.com/DeadSix27/waifu2x-converter-cpp"; 29 36 license = lib.licenses.mit; 30 37 maintainers = [ lib.maintainers.xzfc ]; 31 - platforms = lib.platforms.linux; 38 + platforms = lib.platforms.linux ++ lib.platforms.darwin; 32 39 }; 33 40 }
+15
pkgs/tools/graphics/waifu2x-converter-cpp/waifu2x_darwin_build.diff
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 8b728b5..dedf8b6 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -71,10 +71,6 @@ message(STATUS "System is: ${CMAKE_SYSTEM_NAME} (${LOCAL_SYS_TYPE})") 6 + 7 + ### Get binary paths for APPLE users 8 + if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$") 9 + - set(CMAKE_C_COMPILER "/usr/local/opt/llvm/bin/clang") 10 + - set(CMAKE_CXX_COMPILER "/usr/local/opt/llvm/bin/clang++") 11 + - set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib") 12 + - set(CMAKE_SHARED_LINKER_FLAGS "-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib") 13 + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) 14 + set(FILE_SYSTEM_LIB "c++fs") 15 + endif()
+3 -1
pkgs/top-level/all-packages.nix
··· 9923 9923 openssl = openssl_1_0_2; 9924 9924 }; 9925 9925 9926 - waifu2x-converter-cpp = callPackage ../tools/graphics/waifu2x-converter-cpp { }; 9926 + waifu2x-converter-cpp = callPackage ../tools/graphics/waifu2x-converter-cpp { 9927 + inherit (darwin.apple_sdk.frameworks) OpenCL; 9928 + }; 9927 9929 9928 9930 wakatime = pythonPackages.callPackage ../tools/misc/wakatime { }; 9929 9931