Done with the help of https://github.com/Mindavi/nixpkgs-mark-broken Tool is still WIP but this is one of the first results. I manually audited the results and removed some results that were not valid. Note that some of these packages maybe should have more constrained platforms set instead of broken set, but I think not being perfectly correct is better than just keep trying to build all these things and never succeeding. Some observations: - Some darwin builds require XCode tools - aarch64-linux builds sometimes suffer from using gcc9 - gcc9 is getting older and misses some new libraries/features - Sometimes tools try to do system detection or expect some explicit settings for platforms that are not x86_64-linux
96 lines
2.6 KiB
Nix
96 lines
2.6 KiB
Nix
{ lib, stdenv, fetchFromGitHub, llvmPackages, ncurses, cmake, libxml2
|
|
, symlinkJoin, breakpointHook, cudaPackages, enableCUDA ? false
|
|
, libobjc, Cocoa, Foundation
|
|
}:
|
|
|
|
let
|
|
luajitRev = "50936d784474747b4569d988767f1b5bab8bb6d0";
|
|
luajitBase = "LuaJIT-${luajitRev}";
|
|
luajitArchive = "${luajitBase}.tar.gz";
|
|
luajitSrc = fetchFromGitHub {
|
|
owner = "LuaJIT";
|
|
repo = "LuaJIT";
|
|
rev = luajitRev;
|
|
sha256 = "1g87pl014b5v6z2nnhiwn3wf405skawszfr5wdzyfbx00j3kgxd0";
|
|
};
|
|
|
|
llvmMerged = symlinkJoin {
|
|
name = "llvmClangMerged";
|
|
paths = with llvmPackages; [
|
|
llvm.out
|
|
llvm.dev
|
|
llvm.lib
|
|
clang-unwrapped.out
|
|
clang-unwrapped.dev
|
|
clang-unwrapped.lib
|
|
];
|
|
};
|
|
|
|
cuda = cudaPackages.cudatoolkit_11;
|
|
|
|
clangVersion = llvmPackages.clang-unwrapped.version;
|
|
|
|
in stdenv.mkDerivation rec {
|
|
pname = "terra";
|
|
version = "1.0.6";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "terralang";
|
|
repo = "terra";
|
|
rev = "release-${version}";
|
|
sha256 = "1bs76ibzb469rlqs7slw8pm65csjq1nf0lqh6i9kcvbzavmdfds7";
|
|
};
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
buildInputs = [ llvmMerged ncurses libxml2 ]
|
|
++ lib.optionals enableCUDA [ cuda ]
|
|
++ lib.optionals stdenv.isDarwin [ libobjc Cocoa Foundation ];
|
|
|
|
cmakeFlags = [
|
|
"-DHAS_TERRA_VERSION=0"
|
|
"-DTERRA_VERSION=${version}"
|
|
"-DTERRA_LUA=luajit"
|
|
"-DCLANG_RESOURCE_DIR=${llvmMerged}/lib/clang/${clangVersion}"
|
|
] ++ lib.optional enableCUDA "-DTERRA_ENABLE_CUDA=ON";
|
|
|
|
doCheck = true;
|
|
hardeningDisable = [ "fortify" ];
|
|
outputs = [ "bin" "dev" "out" "static" ];
|
|
|
|
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
|
|
ln -s ${luajitSrc} build/${luajitBase}
|
|
tar --mode="a+rwX" -chzf build/${luajitArchive} -C build ${luajitBase}
|
|
rm build/${luajitBase}
|
|
'';
|
|
|
|
installPhase = ''
|
|
install -Dm755 -t $bin/bin bin/terra
|
|
install -Dm755 -t $out/lib lib/terra${stdenv.hostPlatform.extensions.sharedLibrary}
|
|
install -Dm644 -t $static/lib lib/libterra_s.a
|
|
|
|
mkdir -pv $dev/include
|
|
cp -rv include/terra $dev/include
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "A low-level counterpart to Lua";
|
|
homepage = "https://terralang.org/";
|
|
platforms = platforms.all;
|
|
maintainers = with maintainers; [ jb55 seylerius thoughtpolice elliottslaughter ];
|
|
license = licenses.mit;
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
|
broken = stdenv.isDarwin && stdenv.isAarch64;
|
|
};
|
|
}
|