# Tanım: QT Resim Gösterici
# URL: https://nomacs.org/
# Paketçi: Cihan_Alkan
# Gerekler: cmake qt5 exiv2 libraw opencv
# Grup: tasarım

isim=nomacs
surum=3.8.0
devir=1

kaynak=(https://github.com/${isim}/${isim}/archive/${surum}.tar.gz::${isim}-${surum}.tar.gz
        https://github.com/${isim}/${isim}-plugins/archive/${surum}.tar.gz::${isim}-plugins-${surum}.tar.gz)

derle() {

# Yama Dosyası 
cat > $SRC/${isim}-no-coverage.patch << "EOF" &&
--- nomacs-3.8.0/ImageLounge/CMakeLists.txt.orig	2017-11-14 08:43:20.157769041 +0000
+++ nomacs-3.8.0/ImageLounge/CMakeLists.txt	2017-11-14 08:43:49.094497479 +0000
@@ -22,12 +22,6 @@
 set(NOMACS_VERSION ${NOMACS_VERSION_MAJOR}.${NOMACS_VERSION_MINOR})
 set(NOMACS_FULL_VERSION ${NOMACS_VERSION}.${NOMACS_VERSION_PATCH})
 
-# Codecov
-if(CMAKE_COMPILER_IS_GNUCXX)
-    include("cmake/CodeCoverage.cmake")
-    setup_target_for_coverage(${PROJECT_NAME}_coverage tests coverage)
-endif()
-
 if(CMAKE_CL_64)
 	SET(NMC_ARCHITECTURE "x64")
 else()
EOF

  cd "${isim}-${surum}"

  # move plugins
  mv "${SRC}/${isim}-plugins-${surum}" "ImageLounge/plugins"

  # disable code coverage:
  # https://github.com/nomacs/nomacs/issues/170
  patch -p1 -i "../${isim}-no-coverage.patch"

  cmake ./ImageLounge -DCMAKE_INSTALL_PREFIX=/usr
  make

  make DESTDIR="${PKG}" install

}