nixpkgs/pkgs/development/compilers/neko/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

63 lines
2.2 KiB
Nix

{ lib, stdenv, fetchFromGitHub, fetchpatch, boehmgc, zlib, sqlite, pcre, cmake, pkg-config
, git, apacheHttpd, apr, aprutil, libmysqlclient, mbedtls_2, openssl, pkgs, gtk2, libpthreadstubs
}:
stdenv.mkDerivation rec {
pname = "neko";
version = "2.3.0";
src = fetchFromGitHub {
owner = "HaxeFoundation";
repo = "neko";
rev = "v${lib.replaceStrings [ "." ] [ "-" ] version}";
sha256 = "19rc59cx7qqhcqlb0znwbnwbg04c1yq6xmvrwm1xi46k3vxa957g";
};
patches = [
# https://github.com/HaxeFoundation/neko/pull/224
(fetchpatch {
url = "https://github.com/HaxeFoundation/neko/commit/ff5da9b0e96cc0eabc44ad2c10b7a92623ba49ee.patch";
sha256 = "sha256-isM7QGPiyXgT2zpIGd+r12vKg7I1rOWYTTWxuECafro=";
})
];
nativeBuildInputs = [ cmake pkg-config git ];
buildInputs =
[ boehmgc zlib sqlite pcre apacheHttpd apr aprutil
libmysqlclient mbedtls_2 openssl libpthreadstubs ]
++ lib.optional stdenv.hostPlatform.isLinux gtk2
++ lib.optionals stdenv.hostPlatform.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.Carbon];
cmakeFlags = [ "-DRUN_LDCONFIG=OFF" ];
env = lib.optionalAttrs stdenv.cc.isClang {
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
};
installCheckPhase = ''
bin/neko bin/test.n
'';
# Called from tools/test.neko line 2
# Uncaught exception - Segmentation fault
doInstallCheck = !stdenv.hostPlatform.isDarwin;
dontPatchELF = true;
dontStrip = true;
meta = with lib; {
description = "High-level dynamically typed programming language";
homepage = "https://nekovm.org";
license = [
# list based on https://github.com/HaxeFoundation/neko/blob/v2-3-0/LICENSE
licenses.gpl2Plus # nekoc, nekoml
licenses.lgpl21Plus # mysql.ndll
licenses.bsd3 # regexp.ndll
licenses.zlib # zlib.ndll
licenses.asl20 # mod_neko, mod_tora, mbedTLS
licenses.mit # overall, other libs
"https://github.com/HaxeFoundation/neko/blob/v2-3-0/LICENSE#L24-L40" # boehm gc
];
maintainers = [ maintainers.marcweber maintainers.locallycompact ];
platforms = platforms.linux ++ platforms.darwin;
};
}