--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/Sources/ptDefines.h
+++ photivo-rawspeed-1222reva6b1b46dd0fe/Sources/ptDefines.h
@@ -24,6 +24,7 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 #include <array>
+#include <cstdlib>
 #include <memory>
 #include <vector>
 
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/Sources/ptImage_DRC.cpp
+++ photivo-rawspeed-1222reva6b1b46dd0fe/Sources/ptImage_DRC.cpp
@@ -517,9 +517,9 @@
 //w and h are output width and height. Note that, for example, 1501 >> 1 is 750 but 750 << 1 is 1500.
 //By explicitly specifying output size the off by one issue is handled. In is assumed w >> 1 by h >> 1.
 void DoubleSize(float *Out, uint32_t w, uint32_t h, float *In){
-  uint32_t ws = w >> 1;
-  uint32_t we = w - (w & 1);
-  uint32_t he = h - (h & 1);
+  const std::uint32_t ws = w >> 1;
+  const std::uint32_t we = w - (w & 1);
+  const std::uint32_t he = h - (h & 1);
 
 #pragma omp parallel for schedule(static)
   for(uint32_t y = 0; y < he; y++){
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/Sources/ptPhotivo.cpp
+++ photivo-rawspeed-1222reva6b1b46dd0fe/Sources/ptPhotivo.cpp
@@ -2958,8 +2958,8 @@
         QString GimpExeCommand = Settings->GetString("GimpExecCommand");
         QStringList GimpArguments;
         GimpArguments << GimpFileName;
-        QProcess* GimpProcess = new QProcess();
-        GimpProcess->startDetached(GimpExeCommand, GimpArguments);
+        QProcess gimpProcess;
+        gimpProcess.startDetached(GimpExeCommand, GimpArguments);
 
         // clean up
         if (UsePipe == 1)
@@ -5355,8 +5355,8 @@
     QString ExportCommand = Settings->GetString("GimpExecCommand");
     QStringList ExportArguments;
     ExportArguments << ImageFileName;
-    QProcess* ExportProcess = new QProcess();
-    ExportProcess->startDetached(ExportCommand, ExportArguments);
+    QProcess exportProcess;
+    exportProcess.startDetached(ExportCommand, ExportArguments);
     BlockExport(false);
     }
 
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/Sources/ptProcessor.cpp
+++ photivo-rawspeed-1222reva6b1b46dd0fe/Sources/ptProcessor.cpp
@@ -47,6 +47,16 @@
     #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
 #endif
 
+/*
+The Lensfun API changed quite a bit over the versions. We distinguish 3 eras:
++ the big API overhaul introduced in 0.3.95
++ the older 0.3.x API
++ the 0.2.x API (very similar to the older 0.3.x API)
+*/
+#define PT_LENSFUN_VER_0_3_95 ((3 << 16) | (95 << 8))
+#define PT_LENSFUN_VER_0_3_0  (3 << 16)
+
+
 ptProcessor::ptProcessor(PReportProgressFunc AReportProgress)
     {
     // We work with a callback to avoid dependency on ptMainWindow
@@ -1525,9 +1535,10 @@
             {
             m_ReportProgress(tr("Lensfun corrections"));
             }
-        int modflags = 0;
 
-        lfLensCalibTCA TCAData;
+        int wantedModflags = 0;
+
+        lfLensCalibTCA TCAData{};
         TCAData.Model = (lfTCAModel)(Settings->GetInt("LfunCAModel"));
         TCAData.Focal = Settings->GetDouble("LfunFocal");
         switch (TCAData.Model)
@@ -1541,7 +1552,7 @@
                 TCAData.Terms[5] = 0.0;
                 break;
             case LF_TCA_MODEL_LINEAR:
-                modflags |= LF_MODIFY_TCA;
+                wantedModflags |= LF_MODIFY_TCA;
                 TCAData.Terms[0] = Settings->GetDouble("LfunCALinearKr");
                 TCAData.Terms[1] = Settings->GetDouble("LfunCALinearKb");
                 TCAData.Terms[2] = 0.0;
@@ -1550,7 +1561,7 @@
                 TCAData.Terms[5] = 0.0;
                 break;
             case LF_TCA_MODEL_POLY3:
-                modflags |= LF_MODIFY_TCA;
+                wantedModflags |= LF_MODIFY_TCA;
                 TCAData.Terms[0] = Settings->GetDouble("LfunCAPoly3Vr");
                 TCAData.Terms[1] = Settings->GetDouble("LfunCAPoly3Vb");
                 TCAData.Terms[2] = Settings->GetDouble("LfunCAPoly3Cr");
@@ -1561,7 +1572,7 @@
             default:
                 assert(0);
             }
-        lfLensCalibVignetting VignetteData;
+        lfLensCalibVignetting VignetteData{};
         VignetteData.Model = (lfVignettingModel)(Settings->GetInt("LfunVignetteModel"));
         VignetteData.Focal = Settings->GetDouble("LfunFocal");
         VignetteData.Aperture = Settings->GetDouble("LfunAperture");
@@ -1574,7 +1585,7 @@
                 VignetteData.Terms[2] = 0.0;
                 break;
             case LF_VIGNETTING_MODEL_PA:
-                modflags |= LF_MODIFY_VIGNETTING;
+                wantedModflags |= LF_MODIFY_VIGNETTING;
                 VignetteData.Terms[0] = Settings->GetDouble("LfunVignettePoly6K1");
                 VignetteData.Terms[1] = Settings->GetDouble("LfunVignettePoly6K2");
                 VignetteData.Terms[2] = Settings->GetDouble("LfunVignettePoly6K3");
@@ -1583,7 +1594,7 @@
                 assert(0);
             }
 
-        lfLensCalibDistortion DistortionData;
+        lfLensCalibDistortion DistortionData{};
         DistortionData.Model = (lfDistortionModel)(Settings->GetInt("LfunDistModel"));
         DistortionData.Focal = Settings->GetDouble("LfunFocal");
         switch (DistortionData.Model)
@@ -1594,27 +1605,27 @@
                 DistortionData.Terms[2] = 0.0;
                 break;
             case LF_DIST_MODEL_POLY3:
-                modflags |= LF_MODIFY_DISTORTION;
+                wantedModflags |= LF_MODIFY_DISTORTION;
                 DistortionData.Terms[0] = Settings->GetDouble("LfunDistPoly3K1");
                 DistortionData.Terms[1] = 0.0;
                 DistortionData.Terms[2] = 0.0;
                 break;
             case LF_DIST_MODEL_POLY5:
-                modflags |= LF_MODIFY_DISTORTION;
+                wantedModflags |= LF_MODIFY_DISTORTION;
                 DistortionData.Terms[0] = Settings->GetDouble("LfunDistPoly5K1");
                 DistortionData.Terms[1] = Settings->GetDouble("LfunDistPoly5K2");
                 DistortionData.Terms[2] = 0.0;
                 break;
-#ifdef LF_DIST_MODEL_FOV1
+#if LF_VERSION < PT_LENSFUN_VER_0_3_0
             case LF_DIST_MODEL_FOV1:
-                modflags |= LF_MODIFY_DISTORTION;
+                wantedModflags |= LF_MODIFY_DISTORTION;
                 DistortionData.Terms[0] = Settings->GetDouble("LfunDistFov1Omega");
                 DistortionData.Terms[1] = 0.0;
                 DistortionData.Terms[2] = 0.0;
                 break;
 #endif
             case LF_DIST_MODEL_PTLENS:
-                modflags |= LF_MODIFY_DISTORTION;
+                wantedModflags |= LF_MODIFY_DISTORTION;
                 DistortionData.Terms[0] = Settings->GetDouble("LfunDistPTLensA");
                 DistortionData.Terms[1] = Settings->GetDouble("LfunDistPTLensB");
                 DistortionData.Terms[2] = Settings->GetDouble("LfunDistPTLensC");
@@ -1623,60 +1634,106 @@
                 assert(0);
             }
 
-        lfLens LensData = lfLens();
-        LensData.Type = (lfLensType)(Settings->GetInt("LfunSrcGeo"));
-        LensData.SetMaker("Photivo Custom");
-        LensData.SetModel("Photivo Custom");
-        LensData.AddMount("Photivo Custom");
-        LensData.AddCalibTCA(&TCAData);
-        LensData.AddCalibVignetting(&VignetteData);
-        LensData.AddCalibDistortion(&DistortionData);
-
-#if LF_VERSION >= (3 << 16)
-        LensData.CropFactor = 1.0f;
-        LensData.AspectRatio =
-                static_cast<float>(m_Image_AfterGeometry->m_Width) / m_Image_AfterGeometry->m_Height;
-#endif
+        constexpr lfPixelFormat pixelFormat = LF_PF_U16;  // current image is uint16 data
+        constexpr float cropFactor = 1.0f;  // always already normalised to 35mm equiv
 
-        LensData.GuessParameters();
-        assert(LensData.Check());
-        lfModifier* LfunData = lfModifier::Create(&LensData,
-                               1.0f,  // focal length always normalised to 35mm equiv
-                               m_Image_AfterGeometry->m_Width,
-                               m_Image_AfterGeometry->m_Height);
-
-        // complete list of desired modify actions
-        lfLensType TargetGeo = (lfLensType)(Settings->GetInt("LfunTargetGeo"));
-        if (LensData.Type != TargetGeo)
+        float scaleFactor = 0.0f;   // 0.0 is lensfun's magic value for auto scaling
+        if (Settings->GetInt("LfunAutoScale") == 0)
             {
-            modflags |= LF_MODIFY_GEOMETRY;
+            scaleFactor = Settings->GetDouble("LfunScale");
             }
-
-        double LfunScaleFactor = 0.0;   // 0.0 is lensfun's magic value for auto scaling
-        if (Settings->GetInt("LfunAutoScale") == 0)
+        if (qAbs(scaleFactor - 1.0f) > 0.001f)
             {
-            LfunScaleFactor = Settings->GetDouble("LfunScale");
+            wantedModflags |= LF_MODIFY_SCALE;
             }
-        if (qAbs(LfunScaleFactor - 1.0) > 0.001)
+
+        const float imgFocalLength = Settings->GetDouble("LfunFocal");
+        const float aperture = Settings->GetDouble("LfunAperture");
+        const float distance = Settings->GetDouble("LfunDistance");
+
+        lfLens lensData{};
+        lensData.Type = static_cast<lfLensType>(Settings->GetInt("LfunSrcGeo"));
+        lensData.SetMaker("Photivo Custom");
+        lensData.SetModel("Photivo Custom");
+        lensData.AddMount("Photivo Custom");
+        lensData.AddCalibTCA(&TCAData);
+        lensData.AddCalibVignetting(&VignetteData);
+        lensData.AddCalibDistortion(&DistortionData);
+
+        const auto targetGeometry = static_cast<lfLensType>(Settings->GetInt("LfunTargetGeo"));
+        if (lensData.Type != targetGeometry)
             {
-            modflags |= LF_MODIFY_SCALE;
+            wantedModflags |= LF_MODIFY_GEOMETRY;
             }
 
+#if LF_VERSION < PT_LENSFUN_VER_0_3_95  // using pre-overhaul Lensfun API
+#if LF_VERSION >= PT_LENSFUN_VER_0_3_0  // but not the even older 0.2.x API
+        lensData.CropFactor = cropFactor;
+        lensData.AspectRatio = 1.0f;
+#endif
+
+        lensData.GuessParameters();
+        assert(lensData.Check());
+
+        lfModifier* modifier = lfModifier::Create(
+            &lensData, cropFactor, m_Image_AfterGeometry->m_Width, m_Image_AfterGeometry->m_Height);
+
         // Init modifier and get list of lensfun actions that actually get performed
-        modflags = LfunData->Initialize(&LensData,
-                                        LF_PF_U16,  //image is uint16 data
-                                        Settings->GetDouble("LfunFocal"),
-                                        Settings->GetDouble("LfunAperture"),
-                                        Settings->GetDouble("LfunDistance"),
-                                        LfunScaleFactor,
-                                        TargetGeo,
-                                        modflags,
-                                        false);  //distortion correction, not dist. simulation
+        const auto actualModflags = modifier->Initialize(
+            &lensData,
+            pixelFormat,
+            imgFocalLength,
+            aperture,
+            distance,
+            scaleFactor,
+            targetGeometry,
+            wantedModflags,
+            false);  //distortion correction, not dist. simulation
 
         // Execute lensfun corrections. For vignetting the image is changed in place.
         // For everything else new pixel coordinates are returned in TransformedCoords.
-        m_Image_AfterGeometry->Lensfun(modflags, LfunData);
-        LfunData->Destroy();
+        m_Image_AfterGeometry->Lensfun(actualModflags, modifier);
+
+        modifier->Destroy();
+
+#else  // using new Lensfun API
+        assert(lensData.Check());
+
+        lfModifier modifier(
+            cropFactor,
+            m_Image_AfterGeometry->m_Width,
+            m_Image_AfterGeometry->m_Height,
+            pixelFormat);
+
+        int actualModflags = 0;
+
+        if (wantedModflags & LF_MODIFY_TCA)
+            {
+            actualModflags |= modifier.EnableTCACorrection(&lensData, imgFocalLength);
+            }
+
+        if (wantedModflags & LF_MODIFY_VIGNETTING)
+            {
+            actualModflags |= modifier.EnableVignettingCorrection(&lensData, imgFocalLength, aperture, distance);
+            }
+
+        if (wantedModflags & LF_MODIFY_DISTORTION)
+            {
+            actualModflags |= modifier.EnableDistortionCorrection(&lensData, imgFocalLength);
+            }
+
+        if (wantedModflags & LF_MODIFY_SCALE)
+            {
+            actualModflags |= modifier.EnableScaling(scaleFactor);
+            }
+
+        if (wantedModflags &LF_MODIFY_GEOMETRY)
+            {
+            actualModflags |= modifier.EnableProjectionTransform(&lensData, imgFocalLength, targetGeometry);
+            }
+
+        m_Image_AfterGeometry->Lensfun(actualModflags, &modifier);
+#endif
 
         if (StopBefore == ptProcessorStopBefore::NoStop)
             {
@@ -1694,54 +1751,75 @@
             m_ReportProgress(tr("Defish correction"));
             }
 
-        lfLens LensData = lfLens();
-        LensData.Type = (lfLensType)LF_FISHEYE;
-        LensData.SetMaker("Photivo Custom");
-        LensData.SetModel("Photivo Custom");
-        LensData.AddMount("Photivo Custom");
-
-#if LF_VERSION >= (3 << 16)
-        LensData.CropFactor = 1.0f;
-        LensData.AspectRatio =
-                static_cast<float>(m_Image_AfterGeometry->m_Width) / m_Image_AfterGeometry->m_Height;
+        constexpr lfPixelFormat pixelFormat = LF_PF_U16;  // current image is uint16 data
+        constexpr float cropFactor = 1.0f;  // always already normalised to 35mm equiv
+        constexpr lfLensType targetGeometry = LF_RECTILINEAR;
+        const float imgFocalLength = Settings->GetDouble("DefishFocalLength");
+
+        float scaleFactor = 0.0f;   // 0.0 is lensfun's magic value for auto scaling
+        if (Settings->GetInt("DefishAutoScale") == 0) {
+          scaleFactor = Settings->GetDouble("DefishScale");
+        }
+        const bool isScaling = qAbs(scaleFactor - 1.0f) > 0.001f;
+
+        lfLens lensData{};
+        lensData.Type = LF_FISHEYE;
+        lensData.SetMaker("Photivo Custom");
+        lensData.SetModel("Photivo Custom");
+        lensData.AddMount("Photivo Custom");
+
+#if LF_VERSION < PT_LENSFUN_VER_0_3_95  // using pre-overhaul Lensfun API
+#if LF_VERSION >= PT_LENSFUN_VER_0_3_0  // but not the even older 0.2.x API
+        lensData.CropFactor = cropFactor;
+        lensData.AspectRatio = 1.0f;
 #endif
 
-        LensData.GuessParameters();
-        assert(LensData.Check());
-        lfModifier* LfunData = lfModifier::Create(&LensData,
-                               1.0f,  // focal length always normalised to 35mm equiv
-                               m_Image_AfterGeometry->m_Width,
-                               m_Image_AfterGeometry->m_Height);
+        lensData.GuessParameters();
+        assert(lensData.Check());
 
-        // complete list of desired modify actions
-        lfLensType TargetGeo = (lfLensType)LF_RECTILINEAR;
-        int modflags = LF_MODIFY_GEOMETRY;
+        lfModifier* modifier = lfModifier::Create(
+            &lensData, cropFactor, m_Image_AfterGeometry->m_Width, m_Image_AfterGeometry->m_Height);
 
-        double DefishScaleFactor = 0.0;   // 0.0 is lensfun's magic value for auto scaling
-        if (Settings->GetInt("DefishAutoScale") == 0)
-            {
-            DefishScaleFactor = Settings->GetDouble("DefishScale");
-            }
-        if (qAbs(DefishScaleFactor - 1.0) > 0.001)
-            {
+        int modflags = LF_MODIFY_GEOMETRY;
+        if (isScaling) {
             modflags |= LF_MODIFY_SCALE;
             }
 
         // Init modifier and get list of lensfun actions that actually get performed
-        modflags = LfunData->Initialize(&LensData,
-                                        LF_PF_U16,  //image is uint16 data
-                                        Settings->GetDouble("DefishFocalLength"),
-                                        1.0, // doesn't matter for defish
-                                        1.0, // doesn't matter for defish
-                                        DefishScaleFactor,
-                                        TargetGeo,
-                                        modflags,
-                                        false);  //distortion correction, not dist. simulation
+        modflags = modifier->Initialize(
+            &lensData,
+            pixelFormat,
+            imgFocalLength,
+            1.0f, // doesn't matter for defish
+            1.0f, // doesn't matter for defish
+            scaleFactor,
+            targetGeometry,
+            modflags,
+            false);  //distortion correction, not dist. simulation
 
         // Execute lensfun corrections. For vignetting the image is changed in place.
         // For everything else new pixel coordinates are returned in TransformedCoords.
-        m_Image_AfterGeometry->Lensfun(modflags, LfunData);
-        LfunData->Destroy();
+        m_Image_AfterGeometry->Lensfun(modflags, modifier);
+
+        modifier->Destroy();
+
+#else  // using new Lensfun API
+        assert(lensData.Check());
+
+        lfModifier modifier(
+            cropFactor,
+            m_Image_AfterGeometry->m_Width,
+            m_Image_AfterGeometry->m_Height,
+            pixelFormat);
+
+        int modflags = modifier.EnableProjectionTransform(&lensData, imgFocalLength, targetGeometry);
+
+        if (isScaling) {
+          modflags |= modifier.EnableScaling(scaleFactor);
+        }
+
+        m_Image_AfterGeometry->Lensfun(modflags, &modifier);
+#endif
 
         if (StopBefore == ptProcessorStopBefore::NoStop)
             {
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/Sources/ptSettings.cpp
+++ photivo-rawspeed-1222reva6b1b46dd0fe/Sources/ptSettings.cpp
@@ -1026,8 +1026,8 @@
             1,
             1,
             1200,
-            200,
-            6000,
+            2,
+            90000,
             100,
             0,
             tr("Pixels"),
@@ -1041,8 +1041,8 @@
             1,
             1,
             800,
-            200,
-            6000,
+            2,
+            90000,
             100,
             0,
             tr("Height"),
@@ -1086,8 +1086,8 @@
             1,
             1,
             1200,
-            200,
-            2600,
+            2,
+            90000,
             100,
             0,
             tr("pixels"),
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/Sources/ptTheme.cpp
+++ photivo-rawspeed-1222reva6b1b46dd0fe/Sources/ptTheme.cpp
@@ -187,14 +187,14 @@
         //m_ThemePalette.setColor(QPalette::Window, QColor(255,0,0));
         m_ThemePalette.setColor(QPalette::Background, c_Base);
         //m_ThemePalette.setColor(QPalette::WindowText, QColor(255,0,0));
-        m_ThemePalette.setColor(QPalette::Foreground, c_AltBase); // QLabel QFrame
+        m_ThemePalette.setColor(QPalette::Foreground, c_Text); // QLabel QFrame
         m_ThemePalette.setColor(QPalette::Base, c_Base); // Menu
-        //m_ThemePalette.setColor(QPalette::AlternateBase, QColor(255,0,0));
+        m_ThemePalette.setColor(QPalette::AlternateBase, c_AltBase);
         //m_ThemePalette.setColor(QPalette::ToolTipBase, QColor(255,0,0));
         //m_ThemePalette.setColor(QPalette::ToolTipText, QColor(255,0,0));
         m_ThemePalette.setColor(QPalette::Text, c_Text);
         m_ThemePalette.setColor(QPalette::Button, c_Base); // Splitter
-        //m_ThemePalette.setColor(QPalette::ButtonText, c_Text); // Menu
+        m_ThemePalette.setColor(QPalette::ButtonText, c_Text); // Menu
         //m_ThemePalette.setColor(QPalette::BrightText, QColor(255,0,0));
         m_ThemePalette.setColor(QPalette::Light, c_AltBase); // Splitter
         //m_ThemePalette.setColor(QPalette::Midlight, QColor(255,0,0));
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/debian/changelog
+++ photivo-rawspeed-1222reva6b1b46dd0fe/debian/changelog
@@ -0,0 +1,54 @@
+photivo-rawspeed (1222reva6b1b46dd0fe-1) stable; urgency=low
+
+  * version number update by debtransform
+
+ -- debtransform <build@opensuse.org>  Sat, 26 Mar 2022 17:47:19 +0000
+
+photivo-rawspeed (1222reva6b1b46dd0fe) stable; urgency=low
+
+  * Ported several patches from original Photivo.
+  * Fixed compilation with GCC 10.
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Sun, 09 Aug 2020 19:40:39 +0700
+
+photivo-rawspeed (1222reva6b1b46dd0fe) stable; urgency=low
+
+  * Fixed batch processing (job mode).
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Wed, 16 Oct 2019 23:22:00 +0700
+
+photivo-rawspeed (1220reva6f575c11785) stable; urgency=low
+
+  * Fixed compilation with GCC 9.
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Thu, 29 Aug 2019 23:39:22 +0700
+
+photivo-rawspeed (1220reva1a5bc54bf0f) stable; urgency=low
+
+  * Fixed crashes with Lensfun 0.3.
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Sun, 25 Aug 2019 14:16:41 +0700
+
+photivo-rawspeed (1219rev4a90b149233a) stable; urgency=low
+
+  * Fixed compilation with Exiv2 0.27.
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Mon, 27 May 2019 03:05:41 +0700
+
+photivo-rawspeed (1208rev18d31e03b4e1) stable; urgency=low
+
+  * Fixed compilation with OpenCV 4.
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Mon, 31 Dec 2018 11:43:55 +0700
+
+photivo-rawspeed (1208rev18d31e03b4e1) stable; urgency=low
+
+  * Added support for X3F.
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Fri, 23 Mar 2018 04:20:39 +0700
+
+photivo-rawspeed (1193revbfbfd376f491) stable; urgency=low
+
+  * Initial build of rawspeed port.
+
+ -- Sergey Salnikov <salsergey@gmail.com>  Wed,  7 Mar 2018 03:41:36 +0700
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/debian/compat
+++ photivo-rawspeed-1222reva6b1b46dd0fe/debian/compat
@@ -0,0 +1 @@
+5
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/debian/control
+++ photivo-rawspeed-1222reva6b1b46dd0fe/debian/control
@@ -0,0 +1,21 @@
+Source: photivo-rawspeed
+Section: graphics
+Priority: extra
+Maintainer: Sergey Salnikov <salsergey@gmail.com>
+Build-Depends: debhelper (>= 4.1.16)
+Build-Depends-Indep: cmake, g++, graphicsmagick, lsb-release, mercurial, pkg-config, libglib2.0-dev, liblqr-1-0-dev, qtbase5-dev, libjpeg-dev, libexiv2-dev, liblensfun-dev, libfftw3-dev, libopencv-dev, libpng12-dev | libpng-dev, libtiff-dev | libtiff5-dev, liblcms2-dev, libgraphicsmagick++1-dev, libxml2-dev, libpugixml-dev, zlib1g-dev
+
+Package: photivo-rawspeed
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Photivo is a RAW file processor
+ Photivo is a free and open source (GPL3) photo processor.  It handles your
+ RAW files as well as your bitmap files (TIFF, JPEG, BMP, PNG and many more)
+ in a non-destructive 16 bit processing pipe with gimp workflow integration
+ and batch mode.
+ Photivo tries to provide the best algorithms available; even if this implies
+ some redundancy.  So, to my knowledge, it offers the most flexible and
+ powerful denoise, sharpen and local contrast (fake HDR) algorithms in the
+ open source world.  (If not, let's port them ;-)) Although, to get the
+ desired results, there may be a quite steep learning curve.
+ Ported to rawspeed.
--- photivo-rawspeed-1222reva6b1b46dd0fe.orig/debian/rules
+++ photivo-rawspeed-1222reva6b1b46dd0fe/debian/rules
@@ -0,0 +1,72 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany
+# This file and all modifications and additions to the pristine package
+# are under the same license as the package itself.
+#
+# Please submit bugfixes or commens via http://bugs.opensuse.org
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+SHELL=/bin/bash
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+
+	if [[ `lsb_release -si` == Debian && `lsb_release -sr` =~ 9 || `lsb_release -sr` == 16.04 ]]; then cmake -DWITH_X3F=OFF .; else cmake .; fi
+
+	touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+
+	make
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	make install DESTDIR=$(CURDIR)/debian/photivo-rawspeed
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_installexamples
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary-indep: build install
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
