mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-30 08:44:31 +00:00
dart-sass-embedded: build from source
This commit is contained in:
parent
4acc6ace1e
commit
e12199b8a0
@ -1,49 +1,74 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, stdenvNoCC
|
, stdenvNoCC
|
||||||
, fetchurl
|
, fetchFromGitHub
|
||||||
, autoPatchelfHook
|
, dart
|
||||||
|
, buf
|
||||||
|
, callPackage
|
||||||
|
, runtimeShell
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation rec {
|
let
|
||||||
|
embedded-protocol = fetchFromGitHub {
|
||||||
|
owner = "sass";
|
||||||
|
repo = "embedded-protocol";
|
||||||
|
rev = "refs/tags/1.2.0";
|
||||||
|
hash = "sha256-OHOWotI+cXjDhEYUNXa36FpMEW7hSIu8gVX3gVRvw2Y=";
|
||||||
|
};
|
||||||
|
|
||||||
|
libExt = stdenvNoCC.hostPlatform.extensions.sharedLibrary;
|
||||||
|
in
|
||||||
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
pname = "dart-sass-embedded";
|
pname = "dart-sass-embedded";
|
||||||
version = "1.62.1";
|
version = "1.62.1";
|
||||||
|
|
||||||
dontConfigure = true;
|
src = fetchFromGitHub {
|
||||||
dontBuild = true;
|
owner = "sass";
|
||||||
|
repo = "dart-sass-embedded";
|
||||||
|
rev = "refs/tags/${finalAttrs.version}";
|
||||||
|
hash = "sha256-GpSus5/QItbzCrOImMvrO6DTAQeODABRNiSYHJlLlIA=";
|
||||||
|
};
|
||||||
|
|
||||||
nativeBuildInputs = lib.optional stdenvNoCC.hostPlatform.isLinux autoPatchelfHook;
|
nativeBuildInputs = [
|
||||||
|
buf
|
||||||
|
dart
|
||||||
|
(callPackage ../../build-support/dart/fetch-dart-deps { } {
|
||||||
|
buildDrvArgs = finalAttrs;
|
||||||
|
vendorHash = "sha256-aEBE+z8M5ivMR9zL7kleBJ8c9T+4PGXoec56iwHVT+c=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
src = let base = "https://github.com/sass/dart-sass-embedded/releases/download/${version}/sass_embedded-${version}"; in
|
strictDeps = true;
|
||||||
fetchurl {
|
|
||||||
"x86_64-linux" = {
|
configurePhase = ''
|
||||||
url = "${base}-linux-x64.tar.gz";
|
runHook preConfigure
|
||||||
hash = "sha256-NXTadacyKlOQNGSLj/hP8syhYuuSTXK2Y9cYzTk28HU=";
|
dart pub get --offline
|
||||||
};
|
mkdir build
|
||||||
"aarch64-linux" = {
|
ln -s ${embedded-protocol} build/embedded-protocol
|
||||||
url = "${base}-linux-arm64.tar.gz";
|
runHook postConfigure
|
||||||
hash = "sha256-DX29U1AjmqVhKFgzP+71vsdoMjQ13IS93PZ1JLOA7bA=";
|
'';
|
||||||
};
|
|
||||||
"x86_64-darwin" = {
|
buildPhase = ''
|
||||||
url = "${base}-macos-x64.tar.gz";
|
runHook preBuild
|
||||||
hash = "sha256-0oyb9YBKoPNaWFLbIUZOJc5yK11uDYyAKKW4urkmRJQ=";
|
UPDATE_SASS_PROTOCOL=false HOME="$TMPDIR" dart run grinder protobuf
|
||||||
};
|
dart run grinder pkg-compile-native
|
||||||
"aarch64-darwin" = {
|
runHook postBuild
|
||||||
url = "${base}-macos-arm64.tar.gz";
|
'';
|
||||||
hash = "sha256-dkBcdVbxolK8xXYaOHot0s9FxGmfhMNAEoZqo+2LRfk=";
|
|
||||||
};
|
|
||||||
}."${stdenvNoCC.hostPlatform.system}" or (throw "Unsupported system ${stdenvNoCC.hostPlatform.system}");
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
runHook preInstall
|
||||||
cp -r * $out
|
mkdir -p "$out/lib" "$out/bin"
|
||||||
ln -s $out/dart-sass-embedded $out/bin/dart-sass-embedded
|
cp build/dart-sass-embedded.native "$out/lib/dart-sass-embedded${libExt}"
|
||||||
|
echo '#!${runtimeShell}' > "$out/bin/dart-sass-embedded"
|
||||||
|
echo "exec ${dart}/bin/dartaotruntime $out/lib/dart-sass-embedded${libExt} \"\$@\"" >> "$out/bin/dart-sass-embedded"
|
||||||
|
chmod +x "$out/bin/dart-sass-embedded"
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A wrapper for Dart Sass that implements the compiler side of the Embedded Sass protocol";
|
description = "A wrapper for Dart Sass that implements the compiler side of the Embedded Sass protocol";
|
||||||
homepage = "https://github.com/sass/dart-sass-embedded";
|
homepage = "https://github.com/sass/dart-sass-embedded";
|
||||||
changelog = "https://github.com/sass/dart-sass-embedded/blob/${version}/CHANGELOG.md";
|
changelog = "https://github.com/sass/dart-sass-embedded/blob/${finalAttrs.version}/CHANGELOG.md";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
maintainers = with maintainers; [ shyim ];
|
maintainers = with maintainers; [ shyim ];
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
@ -198,7 +198,7 @@ let
|
|||||||
./rubyEnv/sass-embedded-static.patch
|
./rubyEnv/sass-embedded-static.patch
|
||||||
];
|
];
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
export SASS_EMBEDDED=${dart-sass-embedded}
|
export SASS_EMBEDDED=${dart-sass-embedded}/bin
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user