1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-11 23:24:35 +00:00

terra: fix LuaJIT fetch per @jnetod in #125896

This commit is contained in:
Sable Seyler 2021-06-17 10:54:22 -07:00
parent da575846cb
commit c49d9adc38
No known key found for this signature in database
GPG key ID: CC500589263FC3D8
2 changed files with 17 additions and 22 deletions

View file

@ -1,12 +1,15 @@
{ lib, stdenv, fetchurl, fetchFromGitHub, llvmPackages, ncurses, cmake, libxml2
{ lib, stdenv, fetchFromGitHub, llvmPackages, ncurses, cmake, libxml2
, symlinkJoin, breakpointHook, cudaPackages, enableCUDA ? false }:
let
luajitRev = "9143e86498436892cb4316550be4d45b68a61224";
luajitArchive = "LuaJIT-${luajitRev}.tar.gz";
luajitSrc = fetchurl {
url = "https://github.com/LuaJIT/LuaJIT/archive/${luajitRev}.tar.gz";
sha256 = "0kasmyk40ic4b9dwd4wixm0qk10l88ardrfimwmq36yc5dhnizmy";
luajitBase = "LuaJIT-${luajitRev}";
luajitArchive = "${luajitBase}.tar.gz";
luajitSrc = fetchFromGitHub {
owner = "LuaJIT";
repo = "LuaJIT";
rev = luajitRev;
sha256 = "1zw1yr0375d6jr5x20zvkvk76hkaqamjynbswpl604w6r6id070b";
};
llvmMerged = symlinkJoin {
@ -27,7 +30,7 @@ let
in stdenv.mkDerivation rec {
pname = "terra";
version = "1.0.0-beta3";
version = "1.0.0-beta3_${builtins.substring 0 7 src.rev}";
src = fetchFromGitHub {
owner = "terralang";
@ -41,7 +44,7 @@ in stdenv.mkDerivation rec {
cmakeFlags = [
"-DHAS_TERRA_VERSION=0"
"-DTERRA_VERSION=release-1.0.0-beta3"
"-DTERRA_VERSION=${version}"
"-DTERRA_LUA=luajit"
"-DCLANG_RESOURCE_DIR=${llvmMerged}/lib/clang/${clangVersion}"
] ++ lib.optional enableCUDA "-DTERRA_ENABLE_CUDA=ON";
@ -51,16 +54,21 @@ in stdenv.mkDerivation rec {
hardeningDisable = [ "fortify" ];
outputs = [ "bin" "dev" "out" "static" ];
patches = [ ./nix-cflags.patch ./disable-luajit-file-download.patch ];
patches = [ ./nix-cflags.patch ];
postPatch = ''
sed -i '/file(DOWNLOAD "''${LUAJIT_URL}" "''${LUAJIT_TAR}")/d' \
cmake/Modules/GetLuaJIT.cmake
substituteInPlace src/terralib.lua \
--subst-var-by NIX_LIBC_INCLUDE ${lib.getDev stdenv.cc.libc}/include
'';
preConfigure = ''
mkdir -p build
cp ${luajitSrc} build/${luajitArchive}
ln -s ${luajitSrc} build/${luajitBase}
tar --mode="a+rwX" -chzf build/${luajitArchive} -C build ${luajitBase}
rm build/${luajitBase}
'';
installPhase = ''

View file

@ -1,13 +0,0 @@
diff --git a/cmake/Modules/GetLuaJIT.cmake b/cmake/Modules/GetLuaJIT.cmake
index 023b5c2..8564b92 100644
--- a/cmake/Modules/GetLuaJIT.cmake
+++ b/cmake/Modules/GetLuaJIT.cmake
@@ -63,8 +63,6 @@ string(CONCAT
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
-file(DOWNLOAD "${LUAJIT_URL}" "${LUAJIT_TAR}")
-
execute_process(
COMMAND "${CMAKE_COMMAND}" -E tar xzf "${LUAJIT_TAR}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}