From f167fb4c827efeeabe831c9d408e4a22cd8bca39 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:33:25 +0200 Subject: [PATCH] photoflow: fix build --- .../graphics/photoflow/default.nix | 31 +++++--- .../graphics/photoflow/fix-build.patch | 76 +++++++++++++++++++ 2 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 pkgs/applications/graphics/photoflow/fix-build.patch diff --git a/pkgs/applications/graphics/photoflow/default.nix b/pkgs/applications/graphics/photoflow/default.nix index 46e5ce420a7..43d47cb077c 100644 --- a/pkgs/applications/graphics/photoflow/default.nix +++ b/pkgs/applications/graphics/photoflow/default.nix @@ -3,6 +3,7 @@ , exiv2 , expat , fetchFromGitHub +, fetchpatch , fftw , fftwFloat , gettext @@ -22,9 +23,11 @@ , pcre , pkg-config , pugixml -, lib, stdenv +, lib +, stdenv , swig , vips +, gtk-mac-integration-gtk2 }: stdenv.mkDerivation rec { @@ -38,7 +41,15 @@ stdenv.mkDerivation rec { sha256 = "1bq4733hbh15nwpixpyhqfn3bwkg38amdj2xc0my0pii8l9ln793"; }; - patches = [ ./CMakeLists.patch ]; + patches = [ + (fetchpatch { + name = "fix-compiler-flags.patch"; + url = "https://sources.debian.org/data/main/p/photoflow/0.2.8%2Bgit20200114-3/debian/patches/ftbfs"; + sha256 = "sha256-DG5yG6M4FsKOykE9Eh5TGd7Z5QURGTTVbO1pIxMAlhc="; + }) + ./CMakeLists.patch + ./fix-build.patch + ]; nativeBuildInputs = [ automake @@ -57,8 +68,8 @@ stdenv.mkDerivation rec { expat fftw fftwFloat - gtkmm2 # Could be build with gtk3 but proper UI theme is missing and therefore not very usable with gtk3 - # See: https://discuss.pixls.us/t/help-needed-for-gtk3-theme/5803 + gtkmm2 # Could be build with gtk3 but proper UI theme is missing and therefore not very usable with gtk3 + # See: https://discuss.pixls.us/t/help-needed-for-gtk3-theme/5803 lcms2 lensfun libexif @@ -70,6 +81,8 @@ stdenv.mkDerivation rec { pcre pugixml vips + ] ++ lib.optionals stdenv.isDarwin [ + gtk-mac-integration-gtk2 ]; cmakeFlags = [ @@ -82,13 +95,7 @@ stdenv.mkDerivation rec { description = "A fully non-destructive photo retouching program providing a complete RAW image editing workflow"; homepage = "https://aferrero2707.github.io/PhotoFlow/"; license = licenses.gpl3Plus; - maintainers = [ maintainers.MtP ]; - platforms = platforms.linux; - # sse3 is not supported on aarch64 - badPlatforms = [ "aarch64-linux" ]; - # added 2021-09-30 - # upstream seems pretty dead - #/build/source/src/operations/denoise.cc:30:10: fatal error: vips/cimg_funcs.h: No such file or directory - broken = true; + maintainers = with maintainers; [ MtP wegank ]; + platforms = platforms.unix; }; } diff --git a/pkgs/applications/graphics/photoflow/fix-build.patch b/pkgs/applications/graphics/photoflow/fix-build.patch new file mode 100644 index 00000000000..ac0516b203f --- /dev/null +++ b/pkgs/applications/graphics/photoflow/fix-build.patch @@ -0,0 +1,76 @@ +diff --git a/src/external/librtprocess/src/include/librtprocess.h b/src/external/librtprocess/src/include/librtprocess.h +index 47691a09..b1c63dbd 100644 +--- a/src/external/librtprocess/src/include/librtprocess.h ++++ b/src/external/librtprocess/src/include/librtprocess.h +@@ -21,6 +21,7 @@ + #define _LIBRTPROCESS_ + + #include ++#include + + + enum rpError {RP_NO_ERROR, RP_MEMORY_ERROR, RP_WRONG_CFA, RP_CACORRECT_ERROR}; +diff --git a/src/operations/denoise.cc b/src/operations/denoise.cc +index 10050f70..16b340c1 100644 +--- a/src/operations/denoise.cc ++++ b/src/operations/denoise.cc +@@ -27,7 +27,7 @@ + + */ + +-#include ++//#include + + #include "../base/new_operation.hh" + #include "convert_colorspace.hh" +diff --git a/src/operations/gmic/gmic.cc b/src/operations/gmic/gmic.cc +index 876e7c20..fc6a8505 100644 +--- a/src/operations/gmic/gmic.cc ++++ b/src/operations/gmic/gmic.cc +@@ -28,13 +28,31 @@ + */ + + //#include ++#include + + #include "../../base/processor_imp.hh" + #include "../convertformat.hh" + #include "gmic.hh" + +-int vips_gmic(VipsImage **in, VipsImage** out, int n, int padding, double x_scale, double y_scale, const char* command, ...); +- ++int vips_gmic(VipsImage **in, VipsImage** out, int n, int padding, double x_scale, double y_scale, const char* command, ...) ++{ ++ VipsArrayImage *array; ++ va_list ap; ++ int result; ++ ++#ifndef NDEBUG ++ printf("vips_gmic(): padding=%d\n", padding); ++#endif ++ ++ array = vips_array_image_new( in, n ); ++ va_start( ap, command ); ++ result = vips_call_split( "gmic", ap, array, out, ++ padding, x_scale, y_scale, command ); ++ va_end( ap ); ++ vips_area_unref( VIPS_AREA( array ) ); ++ ++ return( result ); ++} + + PF::GMicPar::GMicPar(): + OpParBase(), +diff --git a/src/vips/gmic/gmic/src/CImg.h b/src/vips/gmic/gmic/src/CImg.h +index 268b9e62..5a79640c 100644 +--- a/src/vips/gmic/gmic/src/CImg.h ++++ b/src/vips/gmic/gmic/src/CImg.h +@@ -32843,7 +32843,7 @@ namespace cimg_library_suffixed { + \see deriche(), vanvliet(). + **/ + CImg& blur_box(const float boxsize, const bool boundary_conditions=true) { +- const float nboxsize = boxsize>=0?boxsize:-boxsize*std::max(_width,_height,_depth)/100; ++ const float nboxsize = boxsize>=0?boxsize:-boxsize*std::max({_width,_height,_depth})/100; + return blur_box(nboxsize,nboxsize,nboxsize,boundary_conditions); + } +