summary refs log tree commit diff
diff options
context:
space:
mode:
authorHilton Chain <hako@ultrarare.space>2022-11-18 12:30:14 +0800
committerLudovic Courtès <ludo@gnu.org>2022-12-04 23:08:20 +0100
commitcb01e0a272cdeb5e4cf27c1f336ebae0550b02d3 (patch)
tree5c8df1697b96b0f7f07ae6dbe143aaaa92743018
parent3a52318e60fa71b18b8473ca99e1e83d16c35d01 (diff)
downloadguix-cb01e0a272cdeb5e4cf27c1f336ebae0550b02d3.tar.gz
gnu: Add apparmor.
* gnu/packages/apparmor.scm (apparmor): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/packages/apparmor.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/apparmor.scm b/gnu/packages/apparmor.scm
index ac97580640..82c00ebb0e 100644
--- a/gnu/packages/apparmor.scm
+++ b/gnu/packages/apparmor.scm
@@ -110,3 +110,69 @@ model by providing mandatory access control (MAC).  It has been included in
 the mainline Linux kernel since version 2.6.36 and its development has been
 supported by Canonical since 2009.")
     (license license:lgpl2.1)))
+
+(define-public apparmor
+  (let ((base libapparmor))
+    (package
+      (inherit base)
+      (name "apparmor")
+      (arguments
+       (append
+        (list #:make-flags
+              #~(list (string-append "CC=" #$(cc-for-target))
+                      (string-append "DESTDIR=" #$output)
+                      "USE_SYSTEM=1"
+                      ;; No need to run the linter
+                      "PYFLAKES=true"))
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:phases phases)
+           #~(modify-phases #$phases
+               (delete 'configure)
+               ;; apparmor-binutils
+               (replace 'change-directory
+                 (lambda _
+                   (chdir "binutils")))
+
+               ;; apparmor-parser
+               (add-after 'install 'chdir-parser
+                 (lambda _
+                   (chdir "../parser")))
+               (add-after 'chdir-parser 'patch-source-shebangs-parser
+                 (assoc-ref %standard-phases 'patch-source-shebangs))
+               (add-after 'patch-source-shebangs-parser 'build-parser
+                 (assoc-ref %standard-phases 'build))
+               (add-after 'build-parser 'check-parser
+                 (assoc-ref %standard-phases 'check))
+               (add-after 'check-parser 'install-parser
+                 (assoc-ref %standard-phases 'install))
+
+               ;; apparmor-utils
+               ;; FIXME: Tests required Python library from this package
+               ;; (itself).
+               (add-after 'install-parser 'chdir-utils
+                 (lambda _
+                   (chdir "../utils")
+                   ;; Fix paths to installed policygroups and templates for
+                   ;; easyprof.
+                   (substitute* "easyprof/easyprof.conf"
+                     (("/usr") #$output))))
+               (add-after 'chdir-utils 'build-utils
+                 (assoc-ref %standard-phases 'build))
+               (add-after 'build-utils 'install-utils
+                 (assoc-ref %standard-phases 'install))
+
+               ;; apparmor-profiles
+               ;; FIXME: Tests need an AppArmor-enabled system.
+               (add-after 'install-utils 'chdir-profiles
+                 (lambda _
+                   (chdir "../profiles")))
+               (add-after 'chdir-profiles 'build-profiles
+                 (assoc-ref %standard-phases 'build))
+               (add-after 'check-build 'install-profiles
+                 (assoc-ref %standard-phases 'install)))))))
+      (propagated-inputs
+       (list libapparmor))
+      ;; Python module `readline' needed
+      (native-inputs
+       (list bison flex gettext-minimal perl python which))
+      (license license:gpl2))))