2021-11-07 20:29:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, pkg-config
|
|
|
|
, bzip2
|
|
|
|
, curl
|
|
|
|
, expat
|
|
|
|
, fribidi
|
|
|
|
, libunibreak
|
|
|
|
, sqlite
|
|
|
|
, zlib
|
2018-09-02 20:47:06 +01:00
|
|
|
, uiTarget ? if !stdenv.isDarwin then "desktop" else "macosx"
|
|
|
|
, uiType ? if !stdenv.isDarwin then "qt4" else "cocoa"
|
2021-11-07 20:29:51 +00:00
|
|
|
, qt4
|
|
|
|
, gtk2
|
|
|
|
, AppKit
|
|
|
|
, Cocoa
|
2018-09-02 20:47:06 +01:00
|
|
|
}:
|
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
with lib;
|
2018-09-02 20:47:06 +01:00
|
|
|
|
|
|
|
assert elem uiTarget [ "desktop" "macosx" ];
|
|
|
|
assert elem uiType [ "qt4" "gtk" "cocoa" ];
|
|
|
|
assert uiTarget == "macosx" -> uiType == "cocoa";
|
|
|
|
|
|
|
|
# Note: "qt" uiType option mentioned in ${src}/README.build is qt3,
|
|
|
|
# which is way to old and no longer in nixpkgs.
|
2013-09-29 01:42:50 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2021-11-07 20:29:51 +00:00
|
|
|
pname = "fbreader-${uiType}";
|
|
|
|
version = "0.99.6";
|
2013-09-29 01:42:50 +01:00
|
|
|
|
2018-09-02 20:47:06 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "geometer";
|
|
|
|
repo = "FBReader";
|
|
|
|
rev = "9e608db14372ae580beae4976eec7241fa069e75";
|
|
|
|
sha256 = "0lzafk02mv0cf2l2a61q5y4743zi913byik4bw1ix0gr1drnsa7y";
|
2013-09-29 01:42:50 +01:00
|
|
|
};
|
|
|
|
|
2018-12-09 09:27:22 +00:00
|
|
|
patches = [
|
|
|
|
./typecheck.patch
|
|
|
|
(fetchpatch {
|
|
|
|
name = "curl-7_62.diff"; # see https://github.com/geometer/FBReader/pull/311
|
|
|
|
url = "https://github.com/geometer/FBReader/commit/b7c78e965d06f780.diff";
|
|
|
|
sha256 = "1dgnx9wps7hcf8fkidc7037vcf92fr3ccnjx7bgxm9x02j0hngjg";
|
|
|
|
})
|
|
|
|
];
|
2018-09-02 20:47:06 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cat << EOF > makefiles/target.mk
|
|
|
|
TARGET_ARCH = ${uiTarget}
|
|
|
|
TARGET_STATUS = release
|
|
|
|
UI_TYPE = ${uiType}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
substituteInPlace makefiles/arch/desktop.mk \
|
|
|
|
--replace ccache "" \
|
|
|
|
--replace moc-qt4 moc
|
|
|
|
|
|
|
|
# libunibreak supersedes liblinebreak
|
|
|
|
substituteInPlace zlibrary/text/Makefile \
|
|
|
|
--replace -llinebreak -lunibreak
|
|
|
|
'';
|
|
|
|
|
2021-01-17 02:09:27 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2018-09-02 20:47:06 +01:00
|
|
|
|
2013-09-29 01:42:50 +01:00
|
|
|
buildInputs = [
|
2021-11-07 20:29:51 +00:00
|
|
|
bzip2
|
|
|
|
curl
|
|
|
|
expat
|
|
|
|
fribidi
|
|
|
|
libunibreak
|
|
|
|
sqlite
|
|
|
|
zlib
|
2018-09-02 20:47:06 +01:00
|
|
|
]
|
|
|
|
++ optional (uiType == "qt4") qt4
|
|
|
|
++ optional (uiType == "gtk") gtk2
|
|
|
|
++ optionals (uiType == "cocoa") [ AppKit Cocoa ];
|
2013-09-29 01:42:50 +01:00
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
makeFlags = [ "INSTALLDIR=$(out)" ];
|
2013-09-29 01:42:50 +01:00
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error=narrowing";
|
2017-08-26 09:35:05 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2013-09-29 01:42:50 +01:00
|
|
|
description = "An e-book reader for Linux";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.fbreader.org/";
|
2013-11-09 16:47:43 +00:00
|
|
|
license = licenses.gpl3;
|
2018-09-02 20:47:06 +01:00
|
|
|
broken = stdenv.isDarwin # untested, might work
|
2021-11-07 20:29:51 +00:00
|
|
|
|| uiType == "gtk"; # builds, but the result is unusable, hangs a lot
|
2018-09-02 20:47:06 +01:00
|
|
|
platforms = platforms.unix;
|
2014-04-23 13:26:16 +01:00
|
|
|
maintainers = [ maintainers.coroa ];
|
2018-09-02 20:47:06 +01:00
|
|
|
};
|
2013-09-29 01:42:50 +01:00
|
|
|
}
|