koreader-from-src: build without emulation
This commit is contained in:
@@ -998,13 +998,13 @@ in {
|
|||||||
final.autoPatchelfHook
|
final.autoPatchelfHook
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
koreader-from-src = prev.koreader-from-src.override {
|
# koreader-from-src = prev.koreader-from-src.override {
|
||||||
# fixes runtime error: luajit: ./ffi/util.lua:757: attempt to call field 'pack' (a nil value)
|
# # fixes runtime error: luajit: ./ffi/util.lua:757: attempt to call field 'pack' (a nil value)
|
||||||
# inherit (emulated) luajit;
|
# # inherit (emulated) luajit;
|
||||||
luajit = buildInQemu (final.luajit.override {
|
# luajit = buildInQemu (final.luajit.override {
|
||||||
buildPackages.stdenv = emulated.stdenv; # it uses buildPackages.stdenv for HOST_CC
|
# buildPackages.stdenv = emulated.stdenv; # it uses buildPackages.stdenv for HOST_CC
|
||||||
});
|
# });
|
||||||
};
|
# };
|
||||||
# libgweather = rmNativeInputs [ final.glib ] (prev.libgweather.override {
|
# libgweather = rmNativeInputs [ final.glib ] (prev.libgweather.override {
|
||||||
# # alternative to emulating python3 is to specify it in `buildInputs` instead of `nativeBuildInputs` (upstream),
|
# # alternative to emulating python3 is to specify it in `buildInputs` instead of `nativeBuildInputs` (upstream),
|
||||||
# # but presumably that's just a different way to emulate it.
|
# # but presumably that's just a different way to emulate it.
|
||||||
|
@@ -1,29 +1,50 @@
|
|||||||
{ lib, stdenv
|
{ lib
|
||||||
|
, autoPatchelfHook
|
||||||
, autoconf
|
, autoconf
|
||||||
, automake
|
, automake
|
||||||
, autoPatchelfHook
|
|
||||||
, buildPackages
|
, buildPackages
|
||||||
, cmake
|
, cmake
|
||||||
, git
|
, dpkg
|
||||||
, libtool
|
|
||||||
, makeWrapper
|
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchgit
|
, fetchgit
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, dpkg
|
|
||||||
, gettext
|
, gettext
|
||||||
|
, git
|
||||||
|
, libtool
|
||||||
, luajit
|
, luajit
|
||||||
|
, makeWrapper
|
||||||
, perl
|
, perl
|
||||||
, pkg-config
|
, pkg-config
|
||||||
|
, pkgs
|
||||||
, python3
|
, python3
|
||||||
, ragel
|
, ragel
|
||||||
, SDL2
|
, SDL2
|
||||||
|
, stdenv
|
||||||
, substituteAll
|
, substituteAll
|
||||||
, which
|
, which
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
sources = import ./sources.nix;
|
sources = import ./sources.nix;
|
||||||
luajit52 = luajit.override { enable52Compat = true; self = luajit52; };
|
src = fetchFromGitHub {
|
||||||
|
owner = "koreader";
|
||||||
|
repo = "koreader";
|
||||||
|
name = "koreader"; # needed because `srcs = ` in the outer derivation is a list
|
||||||
|
fetchSubmodules = true;
|
||||||
|
# rev = "v${version}";
|
||||||
|
rev = "f3520effd679eb24a352e7dec600c5b378c3d376"; # master
|
||||||
|
hash = "sha256-cPftNXKL9khQKH/DKXyl9YZAEa27T/n3ATErPZy8irY=";
|
||||||
|
};
|
||||||
|
# XXX: for some inscrutable reason, `enable52Compat` is *partially* broken, only when cross compiling.
|
||||||
|
# `table.unpack` is non-nil, but `table.pack` is nil.
|
||||||
|
# the normal path is for `enable52Compat` to set `env.NIX_CFLAGS_COMPILE = "-DLUAJIT_ENABLE_LUA52COMPAT";`
|
||||||
|
# which in turn sets `#define LJ_52 1`, and gates functions like `table.pack`, `table.unpack`.
|
||||||
|
# instead, koreader just removes the `#if LJ_52` gates. doing the same in nixpkgs seems to work.
|
||||||
|
# luajit52 = luajit.override { enable52Compat = true; self = luajit52; };
|
||||||
|
luajit52 = (luajit.override { self = luajit52; }).overrideAttrs (super: {
|
||||||
|
patches = (super.patches or []) ++ [
|
||||||
|
"${src}/base/thirdparty/luajit/koreader-luajit-enable-table_pack.patch"
|
||||||
|
];
|
||||||
|
});
|
||||||
luaEnv = luajit52.withPackages (ps: with ps; [
|
luaEnv = luajit52.withPackages (ps: with ps; [
|
||||||
(buildLuarocksPackage {
|
(buildLuarocksPackage {
|
||||||
pname = "luajson";
|
pname = "luajson";
|
||||||
@@ -53,17 +74,7 @@ in
|
|||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "koreader-from-src";
|
pname = "koreader-from-src";
|
||||||
version = "unstable-2023-10-18";
|
version = "unstable-2023-10-18";
|
||||||
srcs = [
|
srcs = [ src ] ++ (lib.mapAttrsToList
|
||||||
(fetchFromGitHub {
|
|
||||||
owner = "koreader";
|
|
||||||
repo = "koreader";
|
|
||||||
name = "koreader"; # needed because `srcs = ` in the outer derivation is a list
|
|
||||||
fetchSubmodules = true;
|
|
||||||
# rev = "v${version}";
|
|
||||||
rev = "f3520effd679eb24a352e7dec600c5b378c3d376"; # master
|
|
||||||
hash = "sha256-cPftNXKL9khQKH/DKXyl9YZAEa27T/n3ATErPZy8irY=";
|
|
||||||
})
|
|
||||||
] ++ (lib.mapAttrsToList
|
|
||||||
(name: src: fetchgit (
|
(name: src: fetchgit (
|
||||||
{
|
{
|
||||||
inherit name;
|
inherit name;
|
||||||
@@ -224,7 +235,8 @@ stdenv.mkDerivation rec {
|
|||||||
# XXX: nixpkgs adds glib and gtk3-x11 to LD_LIBRARY_PATH as well
|
# XXX: nixpkgs adds glib and gtk3-x11 to LD_LIBRARY_PATH as well
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit luaEnv;
|
# exposed for debugging
|
||||||
|
inherit luajit52 luaEnv;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Reference in New Issue
Block a user