1{ lib
2, rustPlatform
3, fetchCrate
4, libxml2
5, ncurses
6, zlib
7, features ? [ "default" ]
8, llvmPackages_12
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "frawk";
13 version = "0.4.8";
14
15 src = fetchCrate {
16 inherit pname version;
17 sha256 = "sha256-wPnMJDx3aF1Slx5pjLfii366pgNU3FJBdznQLuUboYA=";
18 };
19
20 cargoSha256 = "sha256-Xk+iH90Nb2koCdGmVSiRl8Nq26LlFdJBuKmvcbgnkgs=";
21
22 buildInputs = [ libxml2 ncurses zlib ];
23
24 buildNoDefaultFeatures = true;
25 buildFeatures = features;
26
27 preBuild = lib.optionalString (lib.elem "default" features || lib.elem "llvm_backend" features) ''
28 export LLVM_SYS_120_PREFIX=${llvmPackages_12.llvm.dev}
29 '' + lib.optionalString (lib.elem "default" features || lib.elem "unstable" features) ''
30 export RUSTC_BOOTSTRAP=1
31 '';
32
33 # depends on cpu instructions that may not be available on builders
34 doCheck = false;
35
36 meta = with lib; {
37 description = "A small programming language for writing short programs processing textual data";
38 homepage = "https://github.com/ezrosent/frawk";
39 changelog = "https://github.com/ezrosent/frawk/releases/tag/v${version}";
40 license = with licenses; [ mit /* or */ asl20 ];
41 maintainers = with maintainers; [ figsoda ];
42 };
43}