2021-09-18 10:52:07 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPackages
|
2022-12-17 10:02:37 +00:00
|
|
|
, pkg-config
|
2021-09-18 10:52:07 +00:00
|
|
|
, fetchurl
|
|
|
|
, libedit
|
2022-01-26 04:04:25 +00:00
|
|
|
, runCommand
|
|
|
|
, dash
|
2021-09-18 10:52:07 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-11-24 20:58:05 +00:00
|
|
|
pname = "dash";
|
2023-03-30 22:05:00 +00:00
|
|
|
version = "0.5.12";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-08-10 07:59:29 +00:00
|
|
|
url = "http://gondor.apana.org.au/~herbert/dash/files/dash-${finalAttrs.version}.tar.gz";
|
|
|
|
hash = "sha256-akdKxG6LCzKRbExg32lMggWNMpfYs4W3RQgDDKSo8oo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
strictDeps = true;
|
2023-03-30 22:05:00 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isStatic [ pkg-config ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2021-04-05 15:23:46 +00:00
|
|
|
buildInputs = [ libedit ];
|
|
|
|
|
|
|
|
configureFlags = [ "--with-libedit" ];
|
2022-12-17 10:02:37 +00:00
|
|
|
preConfigure = lib.optional stdenv.hostPlatform.isStatic ''
|
2023-01-11 07:51:40 +00:00
|
|
|
export LIBS="$(''${PKG_CONFIG:-pkg-config} --libs --static libedit)"
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = {
|
|
|
|
shellPath = "/bin/dash";
|
2022-01-26 04:04:25 +00:00
|
|
|
tests = {
|
2023-08-10 07:59:29 +00:00
|
|
|
"execute-simple-command" = runCommand "dash-execute-simple-command" { } ''
|
2022-01-26 04:04:25 +00:00
|
|
|
mkdir $out
|
2023-08-10 07:59:29 +00:00
|
|
|
${lib.getExe dash} -c 'echo "Hello World!" > $out/success'
|
2022-01-26 04:04:25 +00:00
|
|
|
[ -s $out/success ]
|
|
|
|
grep -q "Hello World" $out/success
|
|
|
|
'';
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-08-10 07:59:29 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "http://gondor.apana.org.au/~herbert/dash/";
|
|
|
|
description = "A POSIX-compliant implementation of /bin/sh that aims to be as small as possible";
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = with licenses; [ bsd3 gpl2 ];
|
|
|
|
mainProgram = "dash";
|
|
|
|
};
|
|
|
|
})
|