lua: use finalAttrs for interpreters (#264381)
This commit is contained in:
parent
291192ede8
commit
79245fc3e7
@ -1,6 +1,5 @@
|
|||||||
{ lib, stdenv, fetchurl, readline
|
{ lib, stdenv, fetchurl, readline
|
||||||
, compat ? false
|
, compat ? false
|
||||||
, callPackage
|
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, self
|
, self
|
||||||
, packageOverrides ? (final: prev: {})
|
, packageOverrides ? (final: prev: {})
|
||||||
@ -18,38 +17,42 @@
|
|||||||
, staticOnly ? stdenv.hostPlatform.isStatic
|
, staticOnly ? stdenv.hostPlatform.isStatic
|
||||||
, luaAttr ? "lua${lib.versions.major version}_${lib.versions.minor version}"
|
, luaAttr ? "lua${lib.versions.major version}_${lib.versions.minor version}"
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
let
|
|
||||||
luaPackages = self.pkgs;
|
|
||||||
|
|
||||||
luaversion = lib.versions.majorMinor version;
|
stdenv.mkDerivation (finalAttrs:
|
||||||
|
let
|
||||||
|
luaPackages = self.pkgs;
|
||||||
|
|
||||||
plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux"
|
luaversion = lib.versions.majorMinor version;
|
||||||
else if (stdenv.isLinux && lib.versionAtLeast self.luaversion "5.4") then "linux-readline"
|
|
||||||
else if stdenv.isDarwin then "macosx"
|
|
||||||
else if stdenv.hostPlatform.isMinGW then "mingw"
|
|
||||||
else if stdenv.isFreeBSD then "freebsd"
|
|
||||||
else if stdenv.isSunOS then "solaris"
|
|
||||||
else if stdenv.hostPlatform.isBSD then "bsd"
|
|
||||||
else if stdenv.hostPlatform.isUnix then "posix"
|
|
||||||
else "generic";
|
|
||||||
|
|
||||||
compatFlags = if (lib.versionOlder self.luaversion "5.3") then " -DLUA_COMPAT_ALL"
|
plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux"
|
||||||
else if (lib.versionOlder self.luaversion "5.4") then " -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2"
|
else if (stdenv.isLinux && lib.versionAtLeast self.luaversion "5.4") then "linux-readline"
|
||||||
else " -DLUA_COMPAT_5_3";
|
else if stdenv.isDarwin then "macosx"
|
||||||
in
|
else if stdenv.hostPlatform.isMinGW then "mingw"
|
||||||
|
else if stdenv.isFreeBSD then "freebsd"
|
||||||
|
else if stdenv.isSunOS then "solaris"
|
||||||
|
else if stdenv.hostPlatform.isBSD then "bsd"
|
||||||
|
else if stdenv.hostPlatform.isUnix then "posix"
|
||||||
|
else "generic";
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
compatFlags = if (lib.versionOlder self.luaversion "5.3") then " -DLUA_COMPAT_ALL"
|
||||||
|
else if (lib.versionOlder self.luaversion "5.4") then " -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2"
|
||||||
|
else " -DLUA_COMPAT_5_3";
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
pname = "lua";
|
pname = "lua";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://www.lua.org/ftp/${pname}-${version}.tar.gz";
|
url = "https://www.lua.org/ftp/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
|
||||||
sha256 = hash;
|
sha256 = hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
LuaPathSearchPaths = luaPackages.luaLib.luaPathList;
|
LuaPathSearchPaths = luaPackages.luaLib.luaPathList;
|
||||||
LuaCPathSearchPaths = luaPackages.luaLib.luaCPathList;
|
LuaCPathSearchPaths = luaPackages.luaLib.luaCPathList;
|
||||||
setupHook = luaPackages.lua-setup-hook LuaPathSearchPaths LuaCPathSearchPaths;
|
setupHook = luaPackages.lua-setup-hook
|
||||||
|
finalAttrs.LuaPathSearchPaths
|
||||||
|
finalAttrs.LuaCPathSearchPaths;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
buildInputs = [ readline ];
|
buildInputs = [ readline ];
|
||||||
@ -163,4 +166,4 @@ stdenv.mkDerivation rec {
|
|||||||
license = lib.licenses.mit;
|
license = lib.licenses.mit;
|
||||||
platforms = lib.platforms.unix;
|
platforms = lib.platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
, stdenv
|
||||||
, fetchFromGitHub
|
|
||||||
, buildPackages
|
, buildPackages
|
||||||
, version
|
, version
|
||||||
, src
|
, src
|
||||||
, extraMeta ? { }
|
, extraMeta ? { }
|
||||||
, callPackage
|
|
||||||
, self
|
, self
|
||||||
, packageOverrides ? (final: prev: {})
|
, packageOverrides ? (final: prev: {})
|
||||||
, pkgsBuildBuild
|
, pkgsBuildBuild
|
||||||
|
Loading…
Reference in New Issue
Block a user