summary refs log tree commit diff
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2018-05-09 19:58:51 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2018-05-09 22:31:29 +0200
commitc87ca40f9bff8b852018b884e1fed963a6643b57 (patch)
tree764ef92e97eb80bddabdbd4335f442285f7cb6ad
parentcbf83e00909ed0ec2403e0e85c1bc24fd159c021 (diff)
downloadguix-c87ca40f9bff8b852018b884e1fed963a6643b57.tar.gz
gnu: Add android-libselinux.
* gnu/packages/android.scm (android-libselinux): New variable.
-rw-r--r--gnu/packages/android.scm44
1 files changed, 44 insertions, 0 deletions
diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index c3174babbd..1acc7d454a 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -35,7 +35,9 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages selinux)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages tls)
@@ -398,6 +400,48 @@ that is safe to use for user space.  It also includes
 @code{system_properties.h} and @code{_system_properties.h}.")
     (license license:asl2.0)))
 
+(define-public android-libselinux
+  (package
+    (name "android-libselinux")
+    (version (android-platform-version))
+    (source
+     (android-platform-external version "libselinux"
+                                "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
+    (build-system android-ndk-build-system)
+    (arguments
+     ;; See logd/Android.mk for the *_LOG_TAG values.
+     `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
+                                         "-I core/include "
+                                         "-I core/libpackagelistparser/include "
+                                         "-DAUDITD_LOG_TAG=1003 "
+                                         "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
+                          "LDFLAGS=-L . -lpcre")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unpack-core
+           (lambda* (#:key inputs #:allow-other-keys)
+             (mkdir-p "core")
+             (with-directory-excursion "core"
+               (invoke "tar" "axf" (assoc-ref inputs "core") "--strip-components=1"))
+             #t))
+         (add-after 'unpack-core 'patch-HOST
+           (lambda _
+             ;; gettid duplicates otherwise.
+             (substitute* "src/procattr.c"
+              (("#ifdef HOST") "#ifdef XXX"))
+             #t)))))
+    (inputs
+     `(("openssl" ,openssl)))
+    (native-inputs
+     `(("android-bionic-uapi" ,android-bionic-uapi)
+       ("core" ,(android-platform-system-core version))))
+    (propagated-inputs
+     `(("pcre" ,pcre)))
+    (home-page "https://developer.android.com/")
+    (synopsis (package-synopsis libselinux))
+    (description (package-description libselinux))
+    (license (package-license libselinux))))
+
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")