aartaka / chur-guix

A collection of pentesting packages for Guix package manager
GNU General Public License v3.0
5 stars 0 forks source link

Add a build system for the interpreted executables #3

Open aartaka opened 4 years ago

aartaka commented 4 years ago

Most packages use a similar pattern of installation through trivial-build-system and patterns like:

(begin
  (use-modules (guix build utils))
  (let* ((src (assoc-ref %build-inputs "source"))
         (out (assoc-ref %outputs "out"))
         (bin (string-append out "/bin"))
         (bash (string-append (assoc-ref %build-inputs "bash") "/bin/bash"))
         (perl (string-append (assoc-ref %build-inputs "perl") "/bin/perl")))
    (mkdir-p bin)
    (copy-recursively src out)
    (with-directory-excursion bin
      (call-with-output-file "nikto"
        (lambda (p)
          (format p "#!~a
exec ~a ~a/program/nikto.pl \"$@\"" bash perl out)))
      (chmod "nikto" #o555)
      #t)))

It'd be nice to have shell-exec-build-system to abstract this repeating code away.

aartaka commented 4 years ago

make-wrapper from (nonguix build utils) is getting close to solving this, but it has no support for custom interpreters.