+50
-20
pkgs/applications/misc/fbreader/default.nix
+50
-20
pkgs/applications/misc/fbreader/default.nix
···
1
-
{ stdenv, fetchurl, pkgconfig, bzip2, curl, expat, fribidi
2
-
, libunibreak, qt4, sqlite, zlib }:
1
+
{ stdenv, fetchFromGitHub, pkgconfig
2
+
, bzip2, curl, expat, fribidi, libunibreak, sqlite, zlib
3
+
, uiTarget ? if !stdenv.isDarwin then "desktop" else "macosx"
4
+
, uiType ? if !stdenv.isDarwin then "qt4" else "cocoa"
5
+
, qt4, gtk2
6
+
, AppKit, Cocoa
7
+
}:
8
+
9
+
with stdenv.lib;
10
+
11
+
assert elem uiTarget [ "desktop" "macosx" ];
12
+
assert elem uiType [ "qt4" "gtk" "cocoa" ];
13
+
assert uiTarget == "macosx" -> uiType == "cocoa";
14
+
15
+
# Note: "qt" uiType option mentioned in ${src}/README.build is qt3,
16
+
# which is way to old and no longer in nixpkgs.
3
17
4
18
stdenv.mkDerivation {
5
-
name = "fbreader-0.99.4";
19
+
name = "fbreader-${uiType}-0.99.6";
6
20
7
-
src = fetchurl {
8
-
url = https://fbreader.org/files/desktop/fbreader-sources-0.99.4.tgz;
9
-
sha256 = "1sdq3vvwkq4bkyrvh0p884d66gaddz8hlab3m798ji9ixbak2z1x";
21
+
src = fetchFromGitHub {
22
+
owner = "geometer";
23
+
repo = "FBReader";
24
+
rev = "9e608db14372ae580beae4976eec7241fa069e75";
25
+
sha256 = "0lzafk02mv0cf2l2a61q5y4743zi913byik4bw1ix0gr1drnsa7y";
10
26
};
11
27
28
+
patches = [ ./typecheck.patch ];
29
+
30
+
postPatch = ''
31
+
cat << EOF > makefiles/target.mk
32
+
TARGET_ARCH = ${uiTarget}
33
+
TARGET_STATUS = release
34
+
UI_TYPE = ${uiType}
35
+
EOF
36
+
37
+
substituteInPlace makefiles/arch/desktop.mk \
38
+
--replace ccache "" \
39
+
--replace moc-qt4 moc
40
+
41
+
# libunibreak supersedes liblinebreak
42
+
substituteInPlace zlibrary/text/Makefile \
43
+
--replace -llinebreak -lunibreak
44
+
'';
45
+
12
46
nativeBuildInputs = [ pkgconfig ];
47
+
13
48
buildInputs = [
14
-
bzip2 curl expat fribidi libunibreak
15
-
qt4 sqlite zlib
16
-
];
49
+
bzip2 curl expat fribidi libunibreak sqlite zlib
50
+
]
51
+
++ optional (uiType == "qt4") qt4
52
+
++ optional (uiType == "gtk") gtk2
53
+
++ optionals (uiType == "cocoa") [ AppKit Cocoa ];
17
54
18
55
makeFlags = "INSTALLDIR=$(out)";
19
56
20
57
NIX_CFLAGS_COMPILE = [ "-Wno-error=narrowing" ]; # since gcc-6
21
58
22
-
patchPhase = ''
23
-
# don't try to use ccache
24
-
substituteInPlace makefiles/arch/desktop.mk \
25
-
--replace "CCACHE = " "# CCACHE = "
26
-
27
-
substituteInPlace fbreader/desktop/Makefile \
28
-
--replace "/usr/share" "$out/share"
29
-
'';
30
-
31
59
meta = with stdenv.lib; {
32
60
description = "An e-book reader for Linux";
33
61
homepage = http://www.fbreader.org/;
34
62
license = licenses.gpl3;
35
-
platforms = platforms.linux; # possibly also on unix general
63
+
broken = stdenv.isDarwin # untested, might work
64
+
|| uiType == "gtk"; # builds, but the result is unusable, hangs a lot
65
+
platforms = platforms.unix;
36
66
maintainers = [ maintainers.coroa ];
37
-
};
67
+
};
38
68
}
+11
pkgs/applications/misc/fbreader/typecheck.patch
+11
pkgs/applications/misc/fbreader/typecheck.patch
···
1
+
diff --git a/fbreader/src/database/booksdb/BooksDB.cpp b/fbreader/src/database/booksdb/BooksDB.cpp
2
+
index e33a22e76..1b6092800 100644
3
+
--- a/fbreader/src/database/booksdb/BooksDB.cpp
4
+
+++ b/fbreader/src/database/booksdb/BooksDB.cpp
5
+
@@ -146,5 +146,5 @@ shared_ptr<Book> BooksDB::loadBook(const std::string &fileName) {
6
+
myFindFileId->setFileName(fileName);
7
+
if (!myFindFileId->run()) {
8
+
- return false;
9
+
+ return 0;
10
+
}
11
+
((DBIntValue&)*myLoadBook->parameter("@file_id").value()) = myFindFileId->fileId();
+3
-1
pkgs/top-level/all-packages.nix
+3
-1
pkgs/top-level/all-packages.nix
···
16269
16269
16270
16270
fbpanel = callPackage ../applications/window-managers/fbpanel { };
16271
16271
16272
-
fbreader = callPackage ../applications/misc/fbreader { };
16272
+
fbreader = callPackage ../applications/misc/fbreader {
16273
+
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
16274
+
};
16273
16275
16274
16276
fdr = libsForQt5.callPackage ../applications/science/programming/fdr { };
16275
16277