summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-01-23 15:42:57 +0000
committerProfpatsch <mail@profpatsch.de>2020-01-24 21:04:32 +0100
commit5e4c494636078516ab6197f9b65cd47aa36ab289 (patch)
tree77f3400f3948569b96ca87727097a3fd3def7246 /pkgs/tools
parentd7f2bf70bd35a62d2f7bebce962cd4a22681d72c (diff)
downloadnixpkgs-5e4c494636078516ab6197f9b65cd47aa36ab289.tar
nixpkgs-5e4c494636078516ab6197f9b65cd47aa36ab289.tar.gz
nixpkgs-5e4c494636078516ab6197f9b65cd47aa36ab289.tar.bz2
nixpkgs-5e4c494636078516ab6197f9b65cd47aa36ab289.tar.lz
nixpkgs-5e4c494636078516ab6197f9b65cd47aa36ab289.tar.xz
nixpkgs-5e4c494636078516ab6197f9b65cd47aa36ab289.tar.zst
nixpkgs-5e4c494636078516ab6197f9b65cd47aa36ab289.zip
execline: wrap unconditionally; strip
I don't think there's any situation in which an unwrapped execlineb is
useful -- if you want to use different versions of the execlineb tool
it'll still prefer ones in PATH.  At the same time, implementing the
wrapper in this way, as a series of two derivations, meant that we
didn't get stdenv goodness for the wrapper.  This meant that, for
example, the wrapper was not stripped, and so execline ended up with
runtime dependencies on gcc and the Linux headers.  I don't want to
have to reimplement this sort of stuff when it's already in stdenv,
and so it makes much more sense to create the wrapper in the
mkDerivation call, where all of stdenv's normal magic will find it.
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/misc/execline/default.nix100
-rw-r--r--pkgs/tools/misc/execline/execlineb-wrapper.c7
2 files changed, 39 insertions, 68 deletions
diff --git a/pkgs/tools/misc/execline/default.nix b/pkgs/tools/misc/execline/default.nix
index d06798e5d6d..fb685e65a4f 100644
--- a/pkgs/tools/misc/execline/default.nix
+++ b/pkgs/tools/misc/execline/default.nix
@@ -1,85 +1,49 @@
 { lib, skawarePackages
 # for execlineb-with-builtins
 , coreutils, gnugrep, writeScriptBin, runCommand, runCommandCC
-# Whether to wrap bin/execlineb to have the execline tools on its PATH.
-, execlineb-with-builtins ? true
 }:
 
 with skawarePackages;
 
-let
-  outputs = [ "bin" "lib" "dev" "doc" "out" ];
-
-  execline =
-    buildPackage {
-      pname = "execline";
-      version = "2.5.3.0";
-      sha256 = "0czdrv9m8mnx94nf28dafij6z03k4mbhbs6hccfaardfd5l5q805";
-
-      description = "A small scripting language, to be used in place of a shell in non-interactive scripts";
-
-      inherit outputs;
-
-      # TODO: nsss support
-      configureFlags = [
-        "--libdir=\${lib}/lib"
-        "--dynlibdir=\${lib}/lib"
-        "--bindir=\${bin}/bin"
-        "--includedir=\${dev}/include"
-        "--with-sysdeps=${skalibs.lib}/lib/skalibs/sysdeps"
-        "--with-include=${skalibs.dev}/include"
-        "--with-lib=${skalibs.lib}/lib"
-        "--with-dynlib=${skalibs.lib}/lib"
-      ];
+buildPackage {
+  pname = "execline";
+  version = "2.5.3.0";
+  sha256 = "0czdrv9m8mnx94nf28dafij6z03k4mbhbs6hccfaardfd5l5q805";
 
-      postInstall = ''
-        # remove all execline executables from build directory
-        rm $(find -type f -mindepth 1 -maxdepth 1 -executable)
-        rm libexecline.*
+  description = "A small scripting language, to be used in place of a shell in non-interactive scripts";
 
-        mv doc $doc/share/doc/execline/html
-        mv examples $doc/share/doc/execline/examples
-      '';
-
-    };
+  outputs = [ "bin" "lib" "dev" "doc" "out" ];
 
-  # A wrapper around execlineb, which provides all execline
-  # tools on `execlineb`’s PATH.
-  # It is implemented as a C script, because on non-Linux,
-  # nested shebang lines are not supported.
-  execlineb-with-builtins-drv = runCommandCC "execlineb" {} ''
-    mkdir -p $out/bin
+  # TODO: nsss support
+  configureFlags = [
+    "--libdir=\${lib}/lib"
+    "--dynlibdir=\${lib}/lib"
+    "--bindir=\${bin}/bin"
+    "--includedir=\${dev}/include"
+    "--with-sysdeps=${skalibs.lib}/lib/skalibs/sysdeps"
+    "--with-include=${skalibs.dev}/include"
+    "--with-lib=${skalibs.lib}/lib"
+    "--with-dynlib=${skalibs.lib}/lib"
+  ];
+
+  postInstall = ''
+    # remove all execline executables from build directory
+    rm $(find -type f -mindepth 1 -maxdepth 1 -executable)
+    rm libexecline.*
+
+    mv doc $doc/share/doc/execline/html
+    mv examples $doc/share/doc/execline/examples
+
+    mv $bin/bin/execlineb $bin/bin/.execlineb-wrapped
     cc \
       -O \
       -Wall -Wpedantic \
-      -D 'EXECLINEB_PATH()="${execline}/bin/execlineb"' \
-      -D 'EXECLINE_BIN_PATH()="${execline}/bin"' \
+      -D "EXECLINEB_PATH()=\"$bin/bin/.execlineb-wrapped\"" \
+      -D "EXECLINE_BIN_PATH()=\"$bin/bin\"" \
       -I "${skalibs.dev}/include" \
       -L "${skalibs.lib}/lib" \
-      -l"skarnet" \
-      -o "$out/bin/execlineb" \
+      -lskarnet \
+      -o "$bin/bin/execlineb" \
       ${./execlineb-wrapper.c}
   '';
-
-
-  # the original execline package, with bin/execlineb overwritten
-  execline-with-builtins = runCommand "my-execline"
-    (execline.drvAttrs // {
-      preferLocalBuild = true;
-      allowSubstitutes = false;
-    })
-    # copy every output and just overwrite the execlineb binary in $bin
-    ''
-      ${lib.concatMapStringsSep "\n"
-        (output: ''
-          cp -r ${execline.${output}} "''$${output}"
-          chmod --recursive +w "''$${output}"
-        '')
-        outputs}
-      install ${execlineb-with-builtins-drv}/bin/execlineb $bin/bin/execlineb
-    '';
-
-in
-  if execlineb-with-builtins
-  then execline-with-builtins
-  else execline
+}
diff --git a/pkgs/tools/misc/execline/execlineb-wrapper.c b/pkgs/tools/misc/execline/execlineb-wrapper.c
index 09ccf990af7..d31a76ca26e 100644
--- a/pkgs/tools/misc/execline/execlineb-wrapper.c
+++ b/pkgs/tools/misc/execline/execlineb-wrapper.c
@@ -1,3 +1,10 @@
+/*
+ * A wrapper around execlineb, which provides all execline
+ * tools on execlineb’s PATH.
+ * It is implemented as a C program, because on non-Linux,
+ * nested shebang lines are not supported.
+ */
+
 #include <stdlib.h>
 #include <string.h>