2018-12-09 09:27:22 +00:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig
|
2018-09-02 20:47:06 +01:00
|
|
|
, bzip2, curl, expat, fribidi, libunibreak, sqlite, zlib
|
|
|
|
, uiTarget ? if !stdenv.isDarwin then "desktop" else "macosx"
|
|
|
|
, uiType ? if !stdenv.isDarwin then "qt4" else "cocoa"
|
|
|
|
, qt4, gtk2
|
|
|
|
, AppKit, Cocoa
|
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
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 {
|
2018-09-02 20:47:06 +01:00
|
|
|
name = "fbreader-${uiType}-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
|
|
|
|
'';
|
|
|
|
|
2017-09-14 20:24:37 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2018-09-02 20:47:06 +01:00
|
|
|
|
2013-09-29 01:42:50 +01:00
|
|
|
buildInputs = [
|
2018-09-02 20:47:06 +01:00
|
|
|
bzip2 curl expat fribidi libunibreak sqlite zlib
|
|
|
|
]
|
|
|
|
++ 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
|
|
|
|
2013-11-09 16:47:43 +00:00
|
|
|
meta = with stdenv.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
|
|
|
|
|| uiType == "gtk"; # builds, but the result is unusable, hangs a lot
|
|
|
|
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
|
|
|
}
|