2023-10-20 00:44:03 +00:00
# to update:
2023-11-19 23:04:39 +00:00
# - first, figure the rev for `koreader-base`:
# - inside `koreader` repo:
# - `git submodule status base`
# - or `git log base`
2023-10-20 00:44:03 +00:00
# - inside `koreader-base` repo:
2023-11-19 23:04:39 +00:00
# - `git diff old-rev..new-rev thirdparty`
2023-10-20 00:44:03 +00:00
# - update `source.rev` everywhere here that changed upstream
# - zero the hashes here and correct them based on build errors
# - tweak ./vendor-external-projects.patch until it applies
# - usually just upstream changed a URL or something minor
#
# a full rebuild takes approximately 10 minutes on a mid-range desktop
#
# the following build output may look like an error, but is safe to ignore:
# - "awk: fatal: cannot open file `3.9' for reading: No such file or directory"
# - this number comes from the luarocks version
2023-11-19 23:04:39 +00:00
#
# how to automate koreader updates?
# - it may be that koreader-base is more strongly decoupled from `koreader` than first appears:
# - most `koreader` commits which update base simply bump its rev and nothing more.
# - then, `koreader-base` could be its own package, updated independently from the main koreader.
2024-02-03 23:58:41 +00:00
{ lib
, symlinkJoin
, curl
, czmq
, djvulibre
, freetype
, fribidi
, giflib
, glib
, harfbuzz
, k2pdfopt
, leptonica
, libjpeg_turbo
, libpng
, libunibreak
, libwebp
, luajit
, minizip
, mupdf
2024-02-04 02:51:27 +00:00
, mupdf_1_17
2024-02-03 23:58:41 +00:00
, nanosvg
, openssh
2024-02-04 02:51:27 +00:00
, openssl_1_1
, sdcv
2024-02-03 23:58:41 +00:00
, tesseract
, turbo
, utf8proc
2024-02-04 02:51:27 +00:00
, zeromq4
2024-02-03 23:58:41 +00:00
, zstd
, zsync
} :
let
libAndDev = pkg : symlinkJoin {
inherit ( pkg ) name ;
paths = [
( lib . getLib pkg )
( lib . getDev pkg )
] ;
} ;
in
2023-07-19 10:15:07 +00:00
{
2023-07-19 10:44:00 +00:00
thirdparty = {
2024-02-03 23:58:41 +00:00
# providing `package` is just a way to optimize builds, by getting KOReader to use the built nixpkg instead of building it itself from source.
# if it fails during an update, it should always be safe to delete the package key.
2024-02-04 19:39:32 +00:00
# curl = {
# source.url = "https://github.com/curl/curl.git";
# source.rev = "tags/curl-7_80_0";
# source.hash = "sha256-kzozc0Io+1f4UMivSV2IhzJDQXmad4wNhXN/Y2Lsg3Q=";
# package = curl;
# };
# czmq = {
# source.url = "https://github.com/zeromq/czmq.git";
# source.rev = "2a0ddbc4b2dde623220d7f4980ddd60e910cfa78";
# source.hash = "sha256-p4Cl2PLVgRQ0S4qr3VClJXjvAd2LUBU9oRUvOCfVnyw=";
# # package = czmq; # koreader wants v1, nixpkgs has v4
# };
# djvulibre = {
# source.url = "https://gitlab.com/koreader/djvulibre.git";
# source.rev = "6a1e5ba1c9ef81c205a4b270c3f121a1e106f4fc";
# source.hash = "sha256-OWSbxdr93FH3ed0D+NSFWIah7VDTcL3LIGOciY+f4dk=";
# # package = djvulibre; # "cp -fL /build/koreader/base/thirdparty/djvulibre/build/aarch64-unknown-linux-gnu/djvulibre-prefix/src/djvulibre/libdjvu/.libs/libdjvulibre.so.21 ..."
# };
2024-03-22 18:21:26 +00:00
# fbink = {
# source.url = "https://github.com/NiLuJe/FBInk.git";
# source.rev = "1a989b30a195ca240a3cf37f9de61b4b3c7e891c";
# source.hash = "sha256-O3bZzvuj/BRVV+UoutaaZZgGZws2J/i5ArfBHbz6omI=";
# # package: not packaged for nix
# };
2024-02-04 19:39:32 +00:00
# freetype2 = {
# source.url = "https://gitlab.com/koreader/freetype2.git";
# source.rev = "VER-2-13-2";
# source.hash = "sha256-yylSmVM3D5xnbFx9qEEHFIP/K0x/WDXZr0MA4C7ng7k=";
# package = libAndDev freetype;
# };
# fribidi = {
# source.url = "https://github.com/fribidi/fribidi.git";
# source.rev = "tags/v1.0.12";
# source.hash = "sha256-L4m/F9rs8fiv9rSf8oy7P6cthhupc6R/lCv30PLiQ4M=";
# package = libAndDev fribidi;
# };
# giflib = {
# source.url = "https://gitlab.com/koreader/giflib.git";
# source.rev = "5.1.4";
# source.hash = "sha256-znbY4tliXHXVLBd8sTKrbglOdCUb7xhcCQsDDWcQfhw=";
# package = giflib;
# };
# glib = {
# source.url = "https://github.com/GNOME/glib.git";
# source.rev = "2.58.3";
# source.hash = "sha256-KmJXCJ6h2QhPyK1axk+Y9+yJzO0wnCczcogopxGShJc=";
# # package = libAndDev glib; # breaks sdcv build
# };
# harfbuzz = {
# source.url = "https://github.com/harfbuzz/harfbuzz.git";
# source.rev = "8.3.0";
# source.hash = "sha256-sO0Kd2wAbMm+Auf7tXsDNal7hqND8iwkb0M/9WWt9sI=";
# # package = harfbuzz;
# package = libAndDev harfbuzz;
# };
2024-03-22 18:28:19 +00:00
# kobo-usbms = {
# source.url = "https://github.com/koreader/KoboUSBMS.git";
# source.rev = "v1.3.9";
# source.hash = "sha256-/yYpagekWlfTrXu/1DNTmBmdd3IkCDjRtslRv13mtCg=";
# # package: not in nixpkgs
# };
2024-03-22 17:16:19 +00:00
# leptonica = {
# source.url = "https://github.com/DanBloomberg/leptonica.git";
# source.rev = "1.74.1";
# source.hash = "sha256-SDXKam768xvZZvTbXe3sssvZyeLEEiY97Vrzx8hoc6g=";
# # k2pdf needs leptonica src, because it actually patches it and builds it itself
# # `cp -f $(LEPTONICA_MOD)/dewarp2.c $(LEPTONICA_DIR)/src/dewarp2.c`
# # i.e. cp -f /build/koreader/base/thirdparty/libk2pdfopt/build/aarch64-unknown-linux-gnu/libk2pdfopt-prefix/src/libk2pdfopt/leptonica_mod/dewarp2.c ...
# # k2pdf uses an old leptonica -- like 2015-2017-ish.
# # seems it can be at least partially updated, by replacing `numaGetMedianVariation` with `numaGetMedianDevFromMedian` (drop-in replacement)
# # and replacing references to `liblept.so` with `libleptonica.so`,
# # but eventually this requires patching the tesseract Makefiles. could get intense, idk.
# # package = leptonica;
# };
2024-02-04 19:39:32 +00:00
# libjpeg-turbo = {
# source.url = "https://github.com/libjpeg-turbo/libjpeg-turbo.git";
# source.rev = "3.0.1";
# source.hash = "sha256-ofdecix4m0FA9gdyQh7zYn99SYBbH2+a7jfoZlsadoA=";
# # package = libAndDev libjpeg_turbo;
# };
2023-07-19 11:12:08 +00:00
libk2pdfopt = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / k o r e a d e r / l i b k 2 p d f o p t . g i t " ;
2024-02-04 02:51:27 +00:00
source . rev = " 0 9 f 1 e 0 1 1 a 6 1 8 c 8 e c 0 6 b 4 c a a 6 7 0 7 9 6 8 2 1 1 9 d 2 a a a 7 " ;
source . hash = " s h a 2 5 6 - 3 7 s Z 4 6 d G 6 Z 1 W k 7 N r h K A K l 5 j 9 r 1 b N 6 g 0 1 c d 5 I y t / 2 c o M = " ;
# package = k2pdfopt; # nixpkgs k2pdfopt does not compile (broken deps). also, uses old insecure mupdf 1.17 (oh well, koreader is even older)
2023-07-19 11:12:08 +00:00
} ;
2024-02-04 19:39:32 +00:00
# libpng = {
# source.url = "https://github.com/glennrp/libpng.git";
# source.rev = "v1.6.40";
# source.hash = "sha256-Rad7Y5Z9PUCipBTQcB7LEP8fIVTG3JsnMeknUkZ/rRg=";
# # package = libAndDev libpng; # "/build/koreader/base/thirdparty/libpng/build/aarch64-unknown-linux-gnu/libpng-prefix/src/libpng-build/.libs/libpng16.so.16"
# };
# libunibreak = {
# source.url = "https://github.com/adah1972/libunibreak.git";
# source.rev = "tags/libunibreak_5_1";
# source.hash = "sha256-hjgT5DCQ6KFXKlxk9LLzxGHz6B71X/3Ot7ipK3KY85A=";
# # package = libAndDev libunibreak; # nixpkgs version is incompatible (kpvcrlib/crengine #includes libunibreak and then fails, calling into undefined functions)
# };
# libwebp = {
# source.url = "https://github.com/webmproject/libwebp.git";
# source.rev = "v1.3.2";
# source.hash = "sha256-gfwUlJ44biO1lB/3SKfMkM/YBiYcz6RqeMOw+0o6Z/Q=";
# package = libAndDev libwebp;
# };
# libzmq = {
# source.url = "https://github.com/zeromq/libzmq";
# source.rev = "883e95b22e0bffffa72312ea1fec76199afbe458";
# source.hash = "sha256-R76EREtHsqcoKxKrgT8gfEf9pIWdLTBXvF9cDvjEf3E=";
# # package = zeromq4; # despite the name, it's libzmq.so.5 instead of libzmq.so.4
# };
2024-03-22 13:40:09 +00:00
# lj-wpaclient = {
# # only needed for select targets (e.g. kobo)
# source.url = "https://github.com/koreader/lj-wpaclient.git";
# source.rev = "2f93beb3071e6ebb57c783bd5b92f83aa5ebb757";
# source.hash = "sha256-ilJviGZTvL2i1TN5lHQ4eA9pFiM7NlXD+v9ofv520b8=";
# machineAgnostic = true;
# # package: not in nixpkgs; not even a non-luajit `wpaclient`
# };
2023-07-19 23:49:11 +00:00
lodepng = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / l v a n d e v e / l o d e p n g . g i t " ;
2024-03-04 08:19:41 +00:00
source . rev = " d 3 9 8 e 0 f 1 0 d 1 5 2 a 5 d 1 7 f a 3 0 4 6 3 4 7 4 d c 9 f 5 6 5 2 3 f 9 c " ;
source . hash = " s h a 2 5 6 - A p O H U g U 6 X 1 r H w y j A H A / 0 N t + b u D F q Y 2 t t X E n E v d r R l 3 A = " ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs, except in source-only form (mujoco.pin.lodepng)
2023-07-19 23:49:11 +00:00
} ;
2024-03-22 02:28:37 +00:00
# lua-htmlparser = {
# source.url = "https://github.com/msva/lua-htmlparser";
# source.rev = "5ce9a775a345cf458c0388d7288e246bb1b82bff";
# source.hash = "sha256-aSTLSfqz/MIDFVRwtBlDNBUhPb7KqOl32/Y62Hdec1s=";
# # package: not in nixpkgs
# };
2024-02-04 19:39:32 +00:00
# luajit = {
# source.url = "https://github.com/LuaJIT/LuaJIT";
# source.rev = "29b0b282f59ac533313199f4f7be79490b7eee51";
# source.hash = "sha256-S57/NR+0hF1KTdn+cbVkJh3MTfklSwtZua1CYKduVlk=";
# # package = luajit; #< could be fixed; follows a different install structure
# };
2024-02-04 20:45:33 +00:00
# lua-rapidjson = {
# source.url = "https://github.com/xpol/lua-rapidjson";
# source.rev = "242b40c8eaceb0cc43bcab88309736461cac1234";
# source.hash = "sha256-y/czEVPtCt4uN1n49Qi7BrgZmkG+SDXlM5D2GvvO2qg=";
# # package: TODO: packaged in nix as a luarocks package
# };
2024-02-04 21:05:36 +00:00
# luasec = {
# source.url = "https://github.com/brunoos/luasec";
# source.rev = "tags/v1.3.1";
# source.hash = "sha256-3iYRNQoVk5HFjDSqRRmg1taSqeT2cHFil36vxjrEofo=";
# # package: TODO: packaged in nix as a luarocks package
# };
# luasocket = {
# source.url = "https://github.com/lunarmodules/luasocket";
# source.rev = "8c2ff7217e2a205eb107a6f48b04ff1b2b3090a1";
# source.hash = "sha256-Y35QYNLznQmErr6rIjxLzw0/6Y7y8TbzD4yaEdgEljA=";
# # package: TODO: packaged in nix as a luarocks package
# };
2024-03-22 02:28:37 +00:00
# lua-Spore = {
# # Complete... ish?
# # this originally failed like so:
# # Missing dependencies for lua-spore 0.3.1-1:
# # luajson >= 1.3 (not installed)
# # it passes now only because we patch out its build-time check for luajson (which we DO provide at runtime)
# source.url = "https://framagit.org/fperrad/lua-Spore";
# source.rev = "tags/0.3.3";
# source.hash = "sha256-wb7ykJsndoq0DazHpfXieUcBBptowYqD/eTTN/EK/6g=";
# # package: not in nixpkgs
# };
2023-07-20 10:45:44 +00:00
lunasvg = {
source . url = " h t t p s : / / g i t h u b . c o m / s a m m y c a g e / l u n a s v g . g i t " ;
source . rev = " 5 9 d 6 f 6 b a 8 3 5 c 1 b 7 c 7 a 0 f 9 d 4 e a 5 4 0 e c 3 9 8 1 7 7 7 8 8 5 " ;
source . hash = " s h a 2 5 6 - g W 2 i k a k S 6 O m z 5 u p m y 2 6 n A o / j k G H Y O 2 k j l B 3 U m K J B h 1 k = " ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs
2023-07-20 10:45:44 +00:00
} ;
minizip = {
source . url = " h t t p s : / / g i t h u b . c o m / n m o i n v a z / m i n i z i p " ;
source . rev = " 0 b 4 6 a 2 b 4 c a 3 1 7 b 8 0 b c 5 3 5 9 4 6 8 8 8 8 3 f 7 1 8 8 a c 4 d 0 8 " ;
source . hash = " s h a 2 5 6 - P / 3 M M M G Y D q D 9 N m k Y v w / t h K p U N a 3 w N O S l B B j A N H S o n A g = " ;
2024-03-22 13:40:09 +00:00
# package = libAndDev minizip; # weird #include incompatibilities... maybe resolvable (looks like this is actually minizip-ng! but from 2015 and slightly patched; used as a lib for mupdf).
2023-07-20 10:45:44 +00:00
} ;
mupdf = {
source . url = " h t t p s : / / g i t h u b . c o m / A r t i f e x S o f t w a r e / m u p d f . g i t " ;
source . rev = " t a g s / 1 . 1 3 . 0 " ;
source . hash = " s h a 2 5 6 - p Q e j R o n 9 f O 9 A 1 m h z 3 o L j B r 1 j 4 H v e D L c Q I W j R 1 / R p y 5 Q = " ;
2024-02-03 23:58:41 +00:00
# package = libAndDev mupdf; # nixpkgs' mupdf is incompatible with koreader's `libwrap-mupdf`
2024-02-04 02:51:27 +00:00
# package = libAndDev mupdf_1_17; # does not compile
2023-07-20 10:45:44 +00:00
} ;
2024-03-22 14:29:23 +00:00
# nanosvg = {
# source.url = "https://github.com/memononen/nanosvg.git";
# source.rev = "93ce879dc4c04a3ef1758428ec80083c38610b1f";
# source.hash = "sha256-ZtenaXJqMZr2+BxYENG1zUoQ+Qoxlxy0m/1YfJBKAFk=";
# machineAgnostic = true;
# package = nanosvg.src; # KOReader only wants the .h files, but decides to do that without even building it.
# };
2024-02-04 19:39:32 +00:00
# openssh = {
# source.url = "https://github.com/openssh/openssh-portable.git";
# source.rev = "V_8_6_P1";
# source.hash = "sha256-yjIpSbe5pt9sEV2MZYGztxejg/aBFfKO8ieRvoLN2KA=";
# package = openssh;
# };
# openssl = {
# source.url = "https://github.com/openssl/openssl.git";
# source.rev = "OpenSSL_1_1_1u";
# source.hash = "sha256-JOcUj4ovA6621+1k2HUsvhGX1B9BjvaMbCaSx680nSs=";
# # TODO: i think we can use nixpkgs openssl, just lift lib/* up to the root of the package directory
# # package = lib.getLib openssl_1_1; # N.B.: requires building with `NIXPKGS_ALLOW_INSECURE=1 nix build --impure ...`
# };
2023-07-20 10:45:44 +00:00
popen-noshell = {
source . url = " h t t p s : / / g i t h u b . c o m / f a m z a h / p o p e n - n o s h e l l . g i t " ;
source . rev = " e 7 1 5 3 9 6 a 4 9 5 1 e e 9 1 c 4 0 a 9 8 d 2 8 2 4 a 1 3 0 f 1 5 8 2 6 8 b b " ;
source . hash = " s h a 2 5 6 - J e B Z M s g 6 Z U G S n y Z 4 e d s 4 w 6 3 g M / L 7 3 E s A n L a H O P p L 6 i M = " ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs
2023-07-20 10:45:44 +00:00
} ;
2024-02-04 19:39:32 +00:00
# sdcv = {
# # upstream is (temporarily?) acquiring this via `download_project` machinery
# source.url = "https://github.com/Dushistov/sdcv.git";
# source.rev = "v0.5.5";
# source.hash = "sha256-EyvljVXhOsdxIYOGTzD+T16nvW7/RNx3DuQ2OdhjXJ4=";
# package = sdcv;
# };
2024-03-22 17:58:41 +00:00
# tesseract = {
# source.url = "https://github.com/tesseract-ocr/tesseract.git";
# source.rev = "60176fc5ae5e7f6bdef60c926a4b5ea03de2bfa7";
# source.hash = "sha256-FQvlrJ+Uy7+wtUxBuS5NdoToUwNRhYw2ju8Ya8MLyQw=";
# # package = tesseract; # i guess koreader's k2pdf also builds tessearct??
# };
2023-07-20 10:45:44 +00:00
turbo = {
source . url = " h t t p s : / / g i t h u b . c o m / k e r n e l s a u c e / t u r b o " ;
source . rev = " t a g s / v 2 . 1 . 3 " ;
source . hash = " s h a 2 5 6 - v B R k F d c 5 a 0 F I t 1 5 H B z 3 T n q M Z + G G s q j E e f n f J E p u V T B s = " ;
2024-02-03 23:58:41 +00:00
# package = turbo; # nixpkgs' turbo is a totally different thing
2023-07-20 10:45:44 +00:00
} ;
2024-02-04 19:39:32 +00:00
# utf8proc = {
# source.url = "https://github.com/JuliaStrings/utf8proc.git";
# source.rev = "v2.9.0";
# source.hash = "sha256-Sgh8vTbclUV+lFZdR29PtNUy8F+9L/OAXk647B+l2mg=";
# # package = libAndDev utf8proc; # nixpkgs is v3, not v2; incompatible .so name. /build/koreader/base/thirdparty/utf8proc/build/aarch64-unknown-linux-gnu/utf8proc-prefix/src/utf8proc/libutf8proc.so.2
# };
# zstd = {
# source.url = "https://github.com/facebook/zstd.git";
# source.rev = "tags/v1.5.5";
# source.hash = "sha256-tHHHIsQU7vJySrVhJuMKUSq11MzkmC+Pcsj00uFJdnQ=";
# package = libAndDev zstd;
# };
# zsync2 = {
# source.url = "https://github.com/NiLuJe/zsync2.git";
# source.rev = "e618d18f6a7cbf350cededa17ddfe8f76bdf0b5c";
# source.hash = "sha256-S0vxCON1l6S+NWlnRPfm7R07DVkvkG+6QW5LNvXBlA8=";
# package = zsync; # possibly a different thing than koreader's
# };
2023-07-19 10:44:00 +00:00
} ;
2023-07-19 10:15:07 +00:00
}