about summary refs log tree commit diff
path: root/pkgs/applications/graphics
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2022-10-17 10:23:29 +0200
committerehmry <ehmry@posteo.net>2022-10-22 11:00:52 -0500
commit0c60d6c5d5ab9e5676726199ac6f4ec2a5134b75 (patch)
tree4efc5e317c298d14ddcd63a5539298996f03ef61 /pkgs/applications/graphics
parent91d1abf49fce066aa5a589dbe0c65621bfec64af (diff)
comical: add darwin support
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r--pkgs/applications/graphics/comical/default.nix24
-rw-r--r--pkgs/applications/graphics/comical/wxgtk-2.8.patch36
-rw-r--r--pkgs/applications/graphics/comical/wxgtk-3.2.patch139
3 files changed, 157 insertions, 42 deletions
diff --git a/pkgs/applications/graphics/comical/default.nix b/pkgs/applications/graphics/comical/default.nix
index 36da9d26410ed..095905ff06d8a 100644
--- a/pkgs/applications/graphics/comical/default.nix
+++ b/pkgs/applications/graphics/comical/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, wxGTK, util-linux, zlib }:
+{ lib, stdenv, fetchurl, wxGTK32, util-linux, zlib, Cocoa }:
 
 stdenv.mkDerivation rec {
   pname = "comical";
@@ -9,10 +9,21 @@ stdenv.mkDerivation rec {
     sha256 = "0b6527cc06b25a937041f1eb248d0fd881cf055362097036b939817f785ab85e";
   };
 
-  buildInputs = [ wxGTK util-linux zlib ];
-  makeFlags = [ "prefix=${placeholder "out"}" ];
+  patches = [ ./wxgtk-3.2.patch ];
 
-  patches = [ ./wxgtk-2.8.patch ];
+  buildInputs = [
+    wxGTK32
+    util-linux
+    zlib
+  ] ++ lib.optionals stdenv.isDarwin [
+    Cocoa
+  ];
+
+  makeFlags = [
+    "prefix=${placeholder "out"}"
+    "CC=${stdenv.cc.targetPrefix}cc"
+    "CXX=${stdenv.cc.targetPrefix}c++"
+  ];
 
   preInstall = "mkdir -pv $out/bin";
 
@@ -20,7 +31,8 @@ stdenv.mkDerivation rec {
     description = "Viewer of CBR and CBZ files, often used to store scanned comics";
     homepage = "http://comical.sourceforge.net/";
     license = lib.licenses.gpl2Plus;
-    maintainers = with lib.maintainers; [ viric ];
-    platforms = with lib.platforms; linux;
+    maintainers = with lib.maintainers; [ viric wegank ];
+    platforms = with lib.platforms; unix;
+    mainProgram = "comical";
   };
 }
diff --git a/pkgs/applications/graphics/comical/wxgtk-2.8.patch b/pkgs/applications/graphics/comical/wxgtk-2.8.patch
deleted file mode 100644
index db7626074a0f4..0000000000000
--- a/pkgs/applications/graphics/comical/wxgtk-2.8.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-diff --git a/Makefile b/Makefile
-index a648e72..181c47f 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,5 +1,5 @@
- CC = `wx-config --cxx`
--LDFLAGS = `wx-config --libs` -Lunrar -lunrar -Lunzip -lminiunzip
-+LDFLAGS = `wx-config --libs` -Lunrar -lunrar -Lunzip -lminiunzip -lz
- INSTALL = install
- INSTALL_PROGRAM = $(INSTALL)
- prefix = /usr/local
-diff --git a/src/ComicalApp.cpp b/src/ComicalApp.cpp
-index 0c004cd..667e75e 100644
---- a/src/ComicalApp.cpp
-+++ b/src/ComicalApp.cpp
-@@ -28,6 +28,7 @@
- #include "ComicalApp.h"
- #include "ComicalFrame.h"
- #include <wx/log.h>
-+#include <wx/icon.h>
- 
- #if !defined(__WXMAC__) && !defined(__WXCOCOA__) && !defined(__WXMSW__) && !defined(__WXPM__)
- #include "../Comical Icons/comical.xpm"
-diff --git a/unzip/unzip.h b/unzip/unzip.h
-index b247937..5bb6a69 100644
---- a/unzip/unzip.h
-+++ b/unzip/unzip.h
-@@ -50,7 +50,7 @@ extern "C" {
- #endif
- 
- #ifndef _ZLIB_H
--#include "zlib.h"
-+#include <zlib.h>
- #endif
- 
- #ifndef _ZLIBIOAPI_H
diff --git a/pkgs/applications/graphics/comical/wxgtk-3.2.patch b/pkgs/applications/graphics/comical/wxgtk-3.2.patch
new file mode 100644
index 0000000000000..72bafd733ce33
--- /dev/null
+++ b/pkgs/applications/graphics/comical/wxgtk-3.2.patch
@@ -0,0 +1,139 @@
+diff --git a/Makefile b/Makefile
+index a648e72..0387ac1 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+-CC = `wx-config --cxx`
+-LDFLAGS = `wx-config --libs` -Lunrar -lunrar -Lunzip -lminiunzip
++WX_CC = `wx-config --cxx`
++LDFLAGS = `wx-config --libs` -Lunrar -lunrar -Lunzip -lminiunzip -lz
+ INSTALL = install
+ INSTALL_PROGRAM = $(INSTALL)
+ prefix = /usr/local
+@@ -13,7 +13,7 @@ OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+ all: comical
+ 
+ comical: $(OBJS) unrar/libunrar.a unzip/libminiunzip.a
+-	$(CC) -o $@ $(OBJS) $(LDFLAGS)
++	$(WX_CC) -o $@ $(OBJS) $(LDFLAGS)
+ 
+ $(OBJS):
+ 	$(MAKE) -C src
+diff --git a/src/ComicalApp.cpp b/src/ComicalApp.cpp
+index 0c004cd..667e75e 100644
+--- a/src/ComicalApp.cpp
++++ b/src/ComicalApp.cpp
+@@ -28,6 +28,7 @@
+ #include "ComicalApp.h"
+ #include "ComicalFrame.h"
+ #include <wx/log.h>
++#include <wx/icon.h>
+ 
+ #if !defined(__WXMAC__) && !defined(__WXCOCOA__) && !defined(__WXMSW__) && !defined(__WXPM__)
+ #include "../Comical Icons/comical.xpm"
+diff --git a/src/ComicalCanvas.cpp b/src/ComicalCanvas.cpp
+index 75da72f..febce50 100644
+--- a/src/ComicalCanvas.cpp
++++ b/src/ComicalCanvas.cpp
+@@ -792,11 +792,11 @@ void ComicalCanvas::OnKeyDown(wxKeyEvent& event)
+ 	
+ 	switch(event.GetKeyCode()) {
+ 
+-	case WXK_PRIOR:
++	case WXK_PAGEUP:
+ 		PrevPageTurn();
+ 		break;
+ 
+-	case WXK_NEXT:
++	case WXK_PAGEDOWN:
+ 		NextPageTurn();
+ 		break;
+ 
+diff --git a/src/ComicalFrame.cpp b/src/ComicalFrame.cpp
+index 2256be8..154fd6d 100644
+--- a/src/ComicalFrame.cpp
++++ b/src/ComicalFrame.cpp
+@@ -240,7 +240,7 @@ ComicalFrame::ComicalFrame(const wxString& title, const wxPoint& pos, const wxSi
+ 	toolbarSizer->AddSpacer(10);
+ 	toolbarSizer->Add(toolBarNav, 0, wxALIGN_CENTER, 0);
+ 	toolbarSizer->AddSpacer(10);
+-	toolbarSizer->Add(labelRight, 1, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 0);
++	toolbarSizer->Add(labelRight, 1, wxALIGN_CENTER_VERTICAL, 0);
+ 	toolbarSizer->Layout();
+ 	bookPanelSizer->Add(toolbarSizer, 0, wxEXPAND, 0);
+ 	frameSizer->Add(bookPanelSizer, 1, wxEXPAND);
+@@ -279,12 +279,12 @@ void ComicalFrame::OnClose(wxCloseEvent& event)
+ 
+ 	wxRect frameDim = GetRect();
+ 	config->Write(wxT("CacheLength"), (int) cacheLen);
+-	config->Write(wxT("Zoom"), zoom);
++	config->Write(wxT("Zoom"), (int) zoom);
+ 	config->Write(wxT("ZoomLevel"), zoomLevel);
+ 	config->Write(wxT("FitOnlyOversize"), fitOnlyOversize);
+-	config->Write(wxT("Filter"), filter);
+-	config->Write(wxT("Mode"), mode);
+-	config->Write(wxT("Direction"), direction);
++	config->Write(wxT("Filter"), (int) filter);
++	config->Write(wxT("Mode"), (int) mode);
++	config->Write(wxT("Direction"), (int) direction);
+ 	config->Write(wxT("FrameWidth"), frameDim.width);
+ 	config->Write(wxT("FrameHeight"), frameDim.height);
+ 	config->Write(wxT("FrameX"), frameDim.x);
+@@ -309,7 +309,7 @@ void ComicalFrame::OnOpen(wxCommandEvent& event)
+ {
+ 	wxString cwd;
+ 	config->Read(wxT("CWD"), &cwd);
+-	wxString filename = wxFileSelector(wxT("Open a Comic Book"), cwd, wxT(""), wxT(""), wxT("Comic Books (*.cbr,*.cbz,*.rar,*.zip)|*.cbr;*.CBR;*.cbz;*.CBZ;*.rar;*.RAR;*.zip;*.ZIP"), wxOPEN | wxCHANGE_DIR | wxFILE_MUST_EXIST, this);
++	wxString filename = wxFileSelector(wxT("Open a Comic Book"), cwd, wxT(""), wxT(""), wxT("Comic Books (*.cbr,*.cbz,*.rar,*.zip)|*.cbr;*.CBR;*.cbz;*.CBZ;*.rar;*.RAR;*.zip;*.ZIP"), wxFD_OPEN | wxFD_CHANGE_DIR | wxFD_FILE_MUST_EXIST, this);
+ 
+ 	if (!filename.empty())
+ 		OpenFile(filename);
+diff --git a/src/ComicalManager.cpp b/src/ComicalManager.cpp
+index 12d8334..b10d8fa 100644
+--- a/src/ComicalManager.cpp
++++ b/src/ComicalManager.cpp
+@@ -27,7 +27,7 @@
+ 
+ #include "ComicalManager.h"
+ 
+-ComicalManager::ComicalManager(ComicalFrame *_frame) : wxDocManager(wxDEFAULT_DOCMAN_FLAGS, false), frame(_frame)
++ComicalManager::ComicalManager(ComicalFrame *_frame) : wxDocManager(0, false), frame(_frame)
+ {
+ }
+ 
+diff --git a/src/Makefile b/src/Makefile
+index 2a7dc3b..e0a9874 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -1,3 +1,4 @@
++WX_CC = `wx-config --cxx`
+ INCLUDE = -I../unrar -I../unzip
+ CFLAGS = -O2 -Wall -pipe
+ CPPFLAGS = `wx-config --cxxflags` $(CFLAGS) -D_UNIX $(INCLUDE)
+@@ -21,11 +22,11 @@ all: $(OBJS)
+ 	@echo -e "};\n\n#endif" >> $@
+ 
+ %.o : %.cpp
+-	$(CC) $(CPPFLAGS) -c -o $*.o $<
++	$(WX_CC) $(CPPFLAGS) -c -o $*.o $<
+ 
+ %.d : %.cpp
+ 	@set -e; rm -f $@; \
+-	 $(CC) -MM -MG $(CPPFLAGS) -MT '$*.o' $< > $@.$$$$; \
++	 $(WX_CC) -MM -MG $(CPPFLAGS) -MT '$*.o' $< > $@.$$$$; \
+ 	 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ 	 rm -f $@.$$$$
+ 
+diff --git a/unzip/unzip.h b/unzip/unzip.h
+index b247937..5bb6a69 100644
+--- a/unzip/unzip.h
++++ b/unzip/unzip.h
+@@ -50,7 +50,7 @@ extern "C" {
+ #endif
+ 
+ #ifndef _ZLIB_H
+-#include "zlib.h"
++#include <zlib.h>
+ #endif
+ 
+ #ifndef _ZLIBIOAPI_H