~ruther/guix-local

e13678abf1b5cedaa3e7d7bd117c986bd2b5aa37 — Ashish SHUKLA 10 months ago 5fdb1d1
gnu: powertop: Use G-expressions, fix build.

* gnu/packages/linux.scm (powertop)[arguments]: Use gexps.
<#:phases>{patch-absolute-file-names}: Substitute autoconf files.

Fixes: guix/guix#1333

Change-Id: I9612732d97509a9fa2f1425d2b35bff58b0d3895
Signed-off-by: Andreas Enge <andreas@enge.fr>
1 files changed, 28 insertions(+), 18 deletions(-)

M gnu/packages/linux.scm
M gnu/packages/linux.scm => gnu/packages/linux.scm +28 -18
@@ 4266,24 4266,34 @@ devices.  It replaces @code{iwconfig}, which is deprecated.")
        (base32 "10vbk4vplmzp3p1mhwnhj81g6i5xvam9pdvmiy6cmd0xvnmdyy77"))))
    (build-system gnu-build-system)
    (arguments
     '(#:configure-flags
       (list "LDFLAGS=-pthread")
       #:phases
       (modify-phases %standard-phases
         ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to
         ;; allow calibrating the network interface in Guix System.
         (add-after 'unpack 'patch-absolute-file-names
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((kmod (assoc-ref inputs "kmod")))
               (substitute* (find-files "src" "\\.cpp$")
                 ;; Give the right 'modprobe' file name so that essential
                 ;; modules such as msr.ko can be loaded.
                 (("/sbin/modprobe") (string-append kmod "/bin/modprobe"))
                 ;; These programs are only needed to calibrate, so using
                 ;; relative file names avoids adding extra inputs.  When they
                 ;; are missing powertop gracefully handles it.
                 (("/usr/s?bin/(hciconfig|hcitool|xset)" _ command)
                  command))))))))
      (list
        #:configure-flags #~(list "LDFLAGS=-pthread")
        #:phases
        #~(modify-phases %standard-phases
          ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to
          ;; allow calibrating the network interface in Guix System.
          (add-after 'unpack 'patch-absolute-file-names
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((kmod (assoc-ref inputs "kmod")))
                ;; Fix for using a more modern gettext.
                (substitute* "autogen.sh"
                  (("autoreconf")
                   "autoreconf --force"))
                (substitute* "configure.ac"
                  (("^AM_GNU_GETTEXT_VERSION.*$")
                   (string-append "AM_GNU_GETTEXT_VERSION(["
                     #$(package-version (this-package-native-input "gettext-minimal"))
                     "])\n")))
                ;; Give the right 'modprobe' file name so that essential
                ;; modules such as msr.ko can be loaded.
                (substitute* (find-files "src" "\\.cpp$")
                  (("/sbin/modprobe") (string-append kmod "/bin/modprobe"))
                  ;; These programs are only needed to calibrate, so using
                  ;; relative file names avoids adding extra inputs.  When they
                  ;; are missing powertop gracefully handles it.
                  (("/usr/s?bin/(hciconfig|hcitool|xset)" _ command)
                   command
                   command))))))))
    (native-inputs
     (list autoconf
           autoconf-archive