koreader-from-src: get a few more dependencies to succeed

This commit is contained in:
Colin 2023-07-21 04:20:33 +00:00
parent 98ef5d77c3
commit e5d311188e
3 changed files with 42 additions and 13 deletions

View File

@ -1,6 +1,7 @@
{ lib, stdenv
, autoconf
, automake
, buildPackages
, cmake
, fetchurl
, git
@ -13,6 +14,7 @@
, gnutar
, gtk3-x11
, luajit
, perl
, pkg-config
, ragel
, sdcv
@ -53,8 +55,8 @@ stdenv.mkDerivation rec {
patches = [
./debug.patch
./mupdf_dir.patch #< TODO: needed?
./mupdf_no_rm_build_dir.patch
# ./mupdf_dir.patch #< TODO: needed?
./no_rm_build_dirs.patch
(substituteAll (
{
src = ./vendor-external-projects.patch;
@ -75,6 +77,7 @@ stdenv.mkDerivation rec {
git
libtool
makeWrapper
perl # TODO: openssl might try to take a runtime dep on this; see nixpkg
pkg-config
ragel
which
@ -89,6 +92,10 @@ stdenv.mkDerivation rec {
SDL2
];
postPatch = ''
substituteInPlace ../openssl/config --replace '/usr/bin/env' '${buildPackages.coreutils}/bin/env'
'';
dontConfigure = true;
buildPhase = ''
install_lib() {
@ -97,6 +104,7 @@ stdenv.mkDerivation rec {
platform="$3"
lib_src="../$lib"
build_dir="base/thirdparty/$lib/build/$platform"
# link the nix clone into the directory koreader would use for checkout
# ref="base/thirdparty/$l/build/git_checkout"
@ -114,7 +122,7 @@ stdenv.mkDerivation rec {
# instead, we replicate that effect here, and by creating these "stamp" files
# koreader will know to skip the `git clone` and `git checkout` calls.
# the logic we're spoofing lives in koreader/base/thirdparty/cmake_modules/koreader_thirdparty_git.cmake
stamp_dir="base/thirdparty/$lib/build/$platform/git_checkout/stamp"
stamp_dir="$build_dir/git_checkout/stamp"
stamp_info="$stamp_dir/$lib-gitinfo-$rev.txt"
stamp_clone="$stamp_dir/$lib-gitclone-lastrun.txt"
echo "creating stamps for $lib: $stamp_clone > $stamp_info"
@ -128,7 +136,7 @@ stdenv.mkDerivation rec {
# koreader would copy the checkout into this build/working directory,
# but because we spoof the stamps to work around other git errors,
# copy it there on koreader's behalf
prefix="base/thirdparty/$lib/build/$platform/$lib-prefix"
prefix="$build_dir/$lib-prefix"
mkdir -p "$prefix/src"
cp -R "$lib_src" "$prefix/src/$lib"
# src dir needs to be writable for koreader to apply its own patches
@ -136,15 +144,23 @@ stdenv.mkDerivation rec {
}
'' + builtins.concatStringsSep "\n" (lib.mapAttrsToList
(name: src: ''install_lib "${name}" "${src.source.rev}" "${if src.buildInSource or false then "" else "x86_64-unknown-linux-gnu"}"'')
(name: src:
let
# for machine-agnostic libraries (e.g. pure lua), koreader doesn't build them in a flavored directory
machine = if src.machineAgnostic or false then "" else "x86_64-unknown-linux-gnu";
in
''install_lib "${name}" "${src.source.rev}" "${machine}"''
)
sources.thirdparty
) + ''
make TARGET=debian DEBIAN=1 INSTALL_DIR="$out" SHELL=sh VERBOSE=1
make TARGET=debian DEBIAN=1 SHELL=sh VERBOSE=1
'';
# XXX: ^ don't specify INSTALL_DIR="$out" as make arg because that conflicts with vars used by third-party libs
# might be safe to specify that as an env var, though?
installPhase = ''
make TARGET=debian DEBIAN=1 INSTALL_DIR="$out" update
make TARGET=debian DEBIAN=1 update
'';
meta = with lib; {

View File

@ -1,5 +1,5 @@
diff --git a/base/Makefile.third b/base/Makefile.third
index f6a80523..061d2340 100644
index f6a80523..1080ab98 100644
--- a/base/Makefile.third
+++ b/base/Makefile.third
@@ -137,7 +137,6 @@ $(MUPDF_LIB) $(MUPDF_DIR)/include: $(JPEG_LIB) \
@ -10,3 +10,11 @@ index f6a80523..061d2340 100644
install -d $(MUPDF_BUILD_DIR)
cd $(MUPDF_BUILD_DIR) && \
$(CMAKE) $(CMAKE_FLAGS) \
@@ -665,7 +664,6 @@ $(OUTPUT_DIR)/data/KoboUSBMS.tar.gz: $(THIRDPARTY_DIR)/kobo-usbms/*.*
# ===========================================================================
# common lua library for networking
$(LUASOCKET): $(THIRDPARTY_DIR)/luasocket/*.*
- -rm -rf $(LUASOCKET) $(LUASOCKET_BUILD_DIR)
install -d $(LUASOCKET_BUILD_DIR)
cd $(LUASOCKET_BUILD_DIR) && \
$(CMAKE) $(CMAKE_FLAGS) \

View File

@ -34,6 +34,7 @@
source.hash = "sha256-L4m/F9rs8fiv9rSf8oy7P6cthhupc6R/lCv30PLiQ4M=";
};
giflib = {
# Completed
source.url = "https://gitlab.com/koreader/giflib.git";
source.rev = "5.1.4";
source.hash = "sha256-znbY4tliXHXVLBd8sTKrbglOdCUb7xhcCQsDDWcQfhw=";
@ -98,13 +99,17 @@
source.url = "https://github.com/koreader/lj-wpaclient.git";
source.rev = "2f93beb3071e6ebb57c783bd5b92f83aa5ebb757";
source.hash = "sha256-ilJviGZTvL2i1TN5lHQ4eA9pFiM7NlXD+v9ofv520b8=";
machineAgnostic = true;
};
lodepng = {
# Completed
source.url = "https://github.com/lvandeve/lodepng.git";
source.rev = "c18b949b71f45e78b1f9a28c5d458bce0da505d6";
source.hash = "sha256-AAw6I+MxDaxmGpjC5efxuBNw7Lx8FXwg2TEfl6LfPfQ=";
};
lua-htmlparser = {
# TODO: fails build
# - `sh: line 1: luarocks: command not found`
source.url = "https://github.com/msva/lua-htmlparser";
source.rev = "5ce9a775a345cf458c0388d7288e246bb1b82bff";
source.hash = "sha256-aSTLSfqz/MIDFVRwtBlDNBUhPb7KqOl32/Y62Hdec1s=";
@ -121,11 +126,13 @@
source.hash = "sha256-y/czEVPtCt4uN1n49Qi7BrgZmkG+SDXlM5D2GvvO2qg=";
};
luasec = {
# Completed
source.url = "https://github.com/brunoos/luasec";
source.rev = "tags/v1.3.1";
source.hash = "sha256-3iYRNQoVk5HFjDSqRRmg1taSqeT2cHFil36vxjrEofo=";
};
luasocket = {
# Completed
source.url = "https://github.com/lunarmodules/luasocket";
source.rev = "8c2ff7217e2a205eb107a6f48b04ff1b2b3090a1";
source.hash = "sha256-Y35QYNLznQmErr6rIjxLzw0/6Y7y8TbzD4yaEdgEljA=";
@ -152,17 +159,13 @@
source.url = "https://github.com/ArtifexSoftware/mupdf.git";
source.rev = "tags/1.13.0";
source.hash = "sha256-pQejRon9fO9A1mhz3oLjBr1j4HveDLcQIWjR1/Rpy5Q=";
# buildInSource = true;
};
nanosvg = {
# Completed
# XXX koreader expects stamp file to not have x86_64-... prefix?
# maybe because it specifies an empty BUILD_COMMAND instead of `KO_MAKE_RECURSIVE`?
# or because `BUILD_IN_SOURCE`?
source.url = "https://github.com/memononen/nanosvg.git";
source.rev = "9da543e8329fdd81b64eb48742d8ccb09377aed1";
source.hash = "sha256-VOiN6583DtzGYPRkl19VG2QvSzl4T9HaynBuNcvZf94=";
buildInSource = true;
machineAgnostic = true;
};
openssh = {
source.url = "https://github.com/openssh/openssh-portable.git";
@ -170,6 +173,7 @@
source.hash = "sha256-yjIpSbe5pt9sEV2MZYGztxejg/aBFfKO8ieRvoLN2KA=";
};
openssl = {
# Completed
source.url = "https://github.com/openssl/openssl.git";
source.rev = "OpenSSL_1_1_1u";
source.hash = "sha256-JOcUj4ovA6621+1k2HUsvhGX1B9BjvaMbCaSx680nSs=";
@ -190,6 +194,7 @@
source.hash = "sha256-FQvlrJ+Uy7+wtUxBuS5NdoToUwNRhYw2ju8Ya8MLyQw=";
};
turbo = {
# Completed
source.url = "https://github.com/kernelsauce/turbo";
source.rev = "tags/v2.1.3";
source.hash = "sha256-vBRkFdc5a0FIt15HBz3TnqMZ+GGsqjEefnfJEpuVTBs=";