nixpkgs/pkgs/development/compilers/dart/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
2.2 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, fetchurl
, unzip
, runCommand
, darwin
2023-03-17 16:59:46 +00:00
, sources ? import ./sources.nix {inherit fetchurl;}
, version ? sources.versionUsed
}:
2021-01-25 14:36:46 +00:00
assert sources != null && (builtins.isAttrs sources);
stdenv.mkDerivation (finalAttrs: {
2019-08-13 21:52:01 +00:00
pname = "dart";
inherit version;
2016-06-03 08:10:13 +00:00
nativeBuildInputs = [ unzip ];
src = sources."${version}-${stdenv.hostPlatform.system}" or (throw "unsupported version/system: ${version}/${stdenv.hostPlatform.system}");
2016-06-03 08:10:13 +00:00
installPhase = ''
mkdir -p $out
cp -R * $out/
echo $libPath
2022-09-05 07:37:07 +00:00
'' + lib.optionalString (stdenv.isLinux) ''
find $out/bin -executable -type f -exec patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \;
2016-06-03 08:10:13 +00:00
'';
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
2013-04-17 14:35:40 +00:00
dontStrip = true;
2023-03-17 16:59:46 +00:00
passthru = {
updateScript = ./update.sh;
tests = {
testCreate = runCommand "dart-test-create" { nativeBuildInputs = [ finalAttrs.finalPackage ]; } ''
PROJECTNAME="dart_test_project"
dart create --no-pub $PROJECTNAME
2023-03-17 16:59:46 +00:00
[[ -d $PROJECTNAME ]]
[[ -f $PROJECTNAME/bin/$PROJECTNAME.dart ]]
touch $out
'';
2018-05-01 18:51:03 +00:00
2023-03-17 16:59:46 +00:00
testCompile = runCommand "dart-test-compile" {
nativeBuildInputs = [ finalAttrs.finalPackage ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.sigtool ];
} ''
HELLO_MESSAGE="Hello, world!"
echo "void main() => print('$HELLO_MESSAGE');" > hello.dart
dart compile exe hello.dart
PROGRAM_OUT=$(./hello.exe)
2023-03-17 16:59:46 +00:00
[[ "$PROGRAM_OUT" == "$HELLO_MESSAGE" ]]
touch $out
'';
};
};
2023-03-17 16:59:46 +00:00
meta = with lib; {
homepage = "https://dart.dev";
2022-10-04 20:35:30 +00:00
maintainers = with maintainers; [ grburst ];
2016-06-03 08:10:13 +00:00
description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps";
longDescription = ''
Dart is a class-based, single inheritance, object-oriented language
with C-style syntax. It offers compilation to JavaScript, interfaces,
mixins, abstract classes, reified generics, and optional typing.
'';
2022-02-20 18:00:08 +00:00
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.bsd3;
2016-06-03 08:10:13 +00:00
};
})