nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 skawarePackages,
4 skalibs,
5 execline,
6 writeTextFile,
7}:
8
9let
10 version = "2.9.7.0";
11in
12skawarePackages.buildPackage {
13 inherit version;
14
15 pname = "execline";
16 # ATTN: also check whether there is a new manpages version
17 sha256 = "sha256-c8kWDvyZQHjY6lSA+RYb/Rs88LYff6q3BKsYmFF9Agc=";
18
19 # Maintainer of manpages uses following versioning scheme: for every
20 # upstream $version he tags manpages release as ${version}.1, and,
21 # in case of extra fixes to manpages, new tags in form ${version}.2,
22 # ${version}.3 and so on are created.
23 manpages = skawarePackages.buildManPages {
24 pname = "execline-man-pages";
25 version = "2.9.6.1.1";
26 sha256 = "sha256-bj+74zTkGKLdLEb1k4iHfNI1lAuxLBASc5++m17Y0O8=";
27 description = "Port of the documentation for the execline suite to mdoc";
28 maintainers = [ lib.maintainers.sternenseemann ];
29 };
30
31 description = "Small scripting language, to be used in place of a shell in non-interactive scripts";
32
33 outputs = [
34 "bin"
35 "lib"
36 "dev"
37 "doc"
38 "out"
39 ];
40
41 # TODO: nsss support
42 configureFlags = [
43 "--libdir=\${lib}/lib"
44 "--dynlibdir=\${lib}/lib"
45 "--bindir=\${bin}/bin"
46 "--includedir=\${dev}/include"
47 "--with-sysdeps=${skalibs.lib}/lib/skalibs/sysdeps"
48 "--with-include=${skalibs.dev}/include"
49 "--with-lib=${skalibs.lib}/lib"
50 "--with-dynlib=${skalibs.lib}/lib"
51 ];
52
53 postInstall = ''
54 # remove all execline executables from build directory
55 rm $(find -type f -mindepth 1 -maxdepth 1 -executable)
56 rm libexecline.*
57
58 mv doc $doc/share/doc/execline/html
59 mv examples $doc/share/doc/execline/examples
60
61 mv $bin/bin/execlineb $bin/bin/.execlineb-wrapped
62
63 # A wrapper around execlineb, which provides all execline
64 # tools on `execlineb`’s PATH.
65 # It is implemented as a C script, because on non-Linux,
66 # nested shebang lines are not supported.
67 # The -lskarnet has to come at the end to support static builds.
68 $CC \
69 -O \
70 -Wall -Wpedantic \
71 -D "EXECLINEB_PATH()=\"$bin/bin/.execlineb-wrapped\"" \
72 -D "EXECLINE_BIN_PATH()=\"$bin/bin\"" \
73 -I "${skalibs.dev}/include" \
74 -L "${skalibs.lib}/lib" \
75 -o "$bin/bin/execlineb" \
76 ${./execlineb-wrapper.c} \
77 -lskarnet
78 '';
79
80 # Write an execline script.
81 # Documented in ../../../../doc/build-helpers/trivial-build-helpers.chapter.md
82 passthru.writeScript =
83 name: options: script:
84 writeTextFile {
85 inherit name;
86 text = ''
87 #!${execline}/bin/execlineb ${toString options}
88 ${script}
89 '';
90
91 executable = true;
92 derivationArgs.nativeBuildInputs = [ execline ];
93 checkPhase = ''
94 echo redirfd -w 1 /dev/null echo >test.el
95 cat <$target >>test.el
96 execlineb -W test.el
97 '';
98 };
99}