diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-09-29 13:40:53 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-09-29 13:42:44 +0200 |
commit | 2b1f2cc914bcb7439efc489d8a858dace16ae95e (patch) | |
tree | 50552a6923c277429fe8d8b958a1a7ad2b074d13 | |
parent | de98f96324bce8b803383c8982ca57e8f3799eea (diff) | |
download | hardware_replicant_libsamsung-ipc-2b1f2cc914bcb7439efc489d8a858dace16ae95e.tar.gz hardware_replicant_libsamsung-ipc-2b1f2cc914bcb7439efc489d8a858dace16ae95e.tar.bz2 hardware_replicant_libsamsung-ipc-2b1f2cc914bcb7439efc489d8a858dace16ae95e.zip |
guix.scm: use guix style
The guix style command reformats a package or a file to use the code
style used by Guix.
This commit should contain no functional changes.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | scripts/guix.scm | 366 |
1 files changed, 165 insertions, 201 deletions
diff --git a/scripts/guix.scm b/scripts/guix.scm index cbea46f..11b4cc1 100644 --- a/scripts/guix.scm +++ b/scripts/guix.scm @@ -41,34 +41,34 @@ ;;; to all the exported functions, and make a new release when that is ;;; done. -(use-modules - (ice-9 popen) - (ice-9 rdelim) - (ice-9 regex) - (ice-9 textual-ports) - (sxml ssax input-parse) - ((guix licenses) #:prefix license:) - (guix build-system android-ndk) - (guix build-system gnu) - (guix gexp) - (guix git-download) - (guix packages) - (guix profiles) - (guix transformations) - (gnu packages) - (gnu packages android) - (gnu packages autotools) - (gnu packages base) - (gnu packages commencement) - (gnu packages curl) - (gnu packages disk) - (gnu packages linux) - (gnu packages llvm) - (gnu packages pkg-config) - (gnu packages python) - (gnu packages python-xyz) - (gnu packages tls) - (gnu packages valgrind)) +(use-modules (ice-9 popen) + (ice-9 rdelim) + (ice-9 regex) + (ice-9 textual-ports) + (sxml ssax input-parse) + ((guix licenses) + #:prefix license:) + (guix build-system android-ndk) + (guix build-system gnu) + (guix gexp) + (guix git-download) + (guix packages) + (guix profiles) + (guix transformations) + (gnu packages) + (gnu packages android) + (gnu packages autotools) + (gnu packages base) + (gnu packages commencement) + (gnu packages curl) + (gnu packages disk) + (gnu packages linux) + (gnu packages llvm) + (gnu packages pkg-config) + (gnu packages python) + (gnu packages python-xyz) + (gnu packages tls) + (gnu packages valgrind)) ;; We need a more recent version of android-make-stub as it now ;; support passing LOCAL_MODULE= to make to build specific local @@ -77,108 +77,89 @@ ;; first. In addition we need a fix to make the applications that ;; depend on libsamsung-ipc find libsamsung-ipc's includes directory. (define with-fixed-android-make-stub - (options->transformation - '((with-commit - . - "android-make-stub=4bc0e068c32fe525741da00af064ddc079de7e4b")))) + (options->transformation '((with-commit . "android-make-stub=4bc0e068c32fe525741da00af064ddc079de7e4b")))) (define (parse-android.mk port modules-list) (let* ((line (read-line port))) (if (not (eof-object? line)) - (let* ((line-parts (string-split line #\ ))) + (let* ((line-parts (string-split line #\space))) (if (string=? (car line-parts) "LOCAL_MODULE") (if (not (string=? (list-ref line-parts 2) "libsamsung-ipc")) (if (string=? modules-list "") - (parse-android.mk - port - (list-ref line-parts 2)) - (parse-android.mk - port - (string-append modules-list - " " (list-ref line-parts 2)))) + (parse-android.mk port + (list-ref line-parts 2)) + (parse-android.mk port + (string-append modules-list " " + (list-ref line-parts 2)))) (parse-android.mk port modules-list)) - (parse-android.mk port modules-list))) - modules-list))) + (parse-android.mk port modules-list))) modules-list))) (define android-local-modules-list - (let* ((port (open-input-file - "./Android.mk")) + (let* ((port (open-input-file "./Android.mk")) (local-modules (parse-android.mk port ""))) (close-input-port port) - (string-split local-modules #\ ))) + (string-split local-modules #\space))) (define %common-strict-cflags - (let* ((port (open-input-pipe - "./strict-cflags.sh")) - (str (read-line port))) + (let* ((port (open-input-pipe "./strict-cflags.sh")) + (str (read-line port))) (close-pipe port) (string-append "CFLAGS=" str))) (define %clang-strict-cflags - (string-append - "-Werror=non-virtual-dtor")) + (string-append "-Werror=non-virtual-dtor")) (define %commit (let* ((port (open-input-pipe "git --no-pager log --oneline HEAD -1 --format='%H'")) - (str (read-line port))) - (close-pipe port) - str)) + (str (read-line port))) + (close-pipe port) str)) (define %local-source - (local-file - (dirname (dirname (current-filename))) - #:recursive? #t)) + (local-file (dirname (dirname (current-filename))) + #:recursive? #t)) (define android-make #~(lambda (target android-local-modules) - (lambda* - (#:key inputs - make-flags - native-inputs - outputs - #:allow-other-keys) - (substitute* - "Android.mk" - (("BUILD_SHARED_LIBRARY") - "BUILD_HOST_SHARED_LIBRARY") - (("BUILD_EXECUTABLE") "BUILD_HOST_EXECUTABLE")) - ((assoc-ref %standard-phases target) - #:inputs inputs - #:outputs outputs - ;; TODO: use pkg-config for -lssl -lcrypto - #:make-flags - (append - make-flags - '("LDFLAGS=-lssl -lcrypto" - "LOCAL_MODULE=libsamsung-ipc" - "SO=libsamsung-ipc.so"))) - (map-in-order - (lambda (local-module) + (lambda* (#:key inputs make-flags native-inputs outputs + #:allow-other-keys) + (substitute* "Android.mk" + (("BUILD_SHARED_LIBRARY") + "BUILD_HOST_SHARED_LIBRARY") + (("BUILD_EXECUTABLE") + "BUILD_HOST_EXECUTABLE")) ((assoc-ref %standard-phases target) #:inputs inputs #:outputs outputs - ;; TODO: use pkg-config for -lssl -lcrypto - #:make-flags - (append - make-flags - (list - (string-append - "LDFLAGS=-Wl,-rpath=" - #$output - "/lib -lssl -lcrypto -L .") - (string-append "LOCAL_MODULE=" - local-module))))) - android-local-modules)))) + #:make-flags (append make-flags + '("LDFLAGS=-lssl -lcrypto" + "LOCAL_MODULE=libsamsung-ipc" + "SO=libsamsung-ipc.so"))) + (map-in-order (lambda (local-module) + ((assoc-ref %standard-phases target) + #:inputs inputs + #:outputs outputs + #:make-flags (append make-flags + (list (string-append + "LDFLAGS=-Wl,-rpath=" + #$output + "/lib -lssl -lcrypto -L .") + (string-append + "LOCAL_MODULE=" + local-module))))) + android-local-modules)))) (define android-phases - #~(modify-phases - %standard-phases - (delete 'bootstrap) - (replace 'build - (#$android-make 'build '#$android-local-modules-list)) - (replace 'install - (#$android-make 'install '#$android-local-modules-list)))) + #~(modify-phases %standard-phases + (delete 'bootstrap) + (replace 'build + (#$android-make + 'build + '#$android-local-modules-list)) + (replace 'install + (#$android-make + 'install + '#$android-local-modules-list)))) (define-public libsamsung-ipc (package @@ -186,35 +167,31 @@ (version (git-version "0.0" "HEAD" %commit)) (source %local-source) (build-system gnu-build-system) - (native-inputs - `(("autoreconf" ,autoconf) - ("aclocal" ,automake) - ("ddrescue", ddrescue) - ("libc:debug", (@@ (gnu packages commencement) glibc-final) "debug") - ("libtool" ,libtool) - ("pkgconfig" ,pkg-config) - ("python" ,python) - ("python-sh" ,python-sh) - ("valgrind" ,valgrind))) - (inputs - `(("libcurl" ,curl) - ("openssl" ,openssl))) + (native-inputs `(("autoreconf" ,autoconf) + ("aclocal" ,automake) + ("ddrescue" ,ddrescue) + ("libc:debug" ,(@@ (gnu packages commencement) + glibc-final) "debug") + ("libtool" ,libtool) + ("pkgconfig" ,pkg-config) + ("python" ,python) + ("python-sh" ,python-sh) + ("valgrind" ,valgrind))) + (inputs `(("libcurl" ,curl) + ("openssl" ,openssl))) (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'build 'fix-valgrind - (lambda _ - (substitute* (find-files "." ".*\\.py$") - (("'--leak-check=full',") - (string-append - "'--leak-check=full', '--extra-debuginfo-path=" - (assoc-ref %build-inputs "libc:debug") - "/lib/debug',"))) - #t))) - #:configure-flags - (list "--enable-debug" - "--enable-valgrind-tests"))) - (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol") + `(#:phases (modify-phases %standard-phases + (add-after 'build 'fix-valgrind + (lambda _ + (substitute* (find-files "." ".*\\.py$") + (("'--leak-check=full',") + (string-append + "'--leak-check=full', '--extra-debuginfo-path=" + (assoc-ref %build-inputs "libc:debug") + "/lib/debug',"))) #t))) + #:configure-flags (list "--enable-debug" "--enable-valgrind-tests"))) + (synopsis + "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol") (description "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol, found in many Samsung smartphones and tablets.") @@ -223,109 +200,96 @@ found in many Samsung smartphones and tablets.") (define-public libsamsung-ipc-static (package - (inherit libsamsung-ipc) + (inherit libsamsung-ipc) (name "libsamsung-ipc-static") - (native-inputs - `(("autoreconf" ,autoconf) - ("aclocal" ,automake) - ("ddrescue", ddrescue) - ("libtool" ,libtool) - ("pkgconfig" ,pkg-config) - ("python" ,python) - ("python-sh" ,python-sh))) - (inputs - `(("libcurl" ,curl) - ("openssl" ,openssl) - ("openssl:static" ,openssl "static"))) + (native-inputs `(("autoreconf" ,autoconf) + ("aclocal" ,automake) + ("ddrescue" ,ddrescue) + ("libtool" ,libtool) + ("pkgconfig" ,pkg-config) + ("python" ,python) + ("python-sh" ,python-sh))) + (inputs `(("libcurl" ,curl) + ("openssl" ,openssl) + ("openssl:static" ,openssl "static"))) (arguments - `(#:phases - (modify-phases - %standard-phases - (add-before 'build 'patch-for-static-build + `(#:phases (modify-phases %standard-phases + (add-before 'build 'patch-for-static-build (lambda _ (define (append-to-file name body) (let ((file (open-file name "a"))) (display body file) (close-port file))) - (append-to-file - "tools/ipc-modem/Makefile.am" - "ipc_modem_LDFLAGS += -all-static")))) - #:configure-flags - (list "--enable-debug" - "--enable-static=yes" - "--enable-shared=no"))))) + (append-to-file "tools/ipc-modem/Makefile.am" + "ipc_modem_LDFLAGS += -all-static")))) + #:configure-flags (list "--enable-debug" "--enable-static=yes" + "--enable-shared=no"))))) (define-public libsamsung-ipc-gcc-android (package - (inherit libsamsung-ipc) + (inherit libsamsung-ipc) (name "libsamsung-ipc-gcc-android") (build-system android-ndk-build-system) - (inputs - `(("android-libutils" ,android-libutils) - ("libcrypto" ,openssl) - ("libcurl" ,curl))) + (inputs `(("android-libutils" ,android-libutils) + ("libcrypto" ,openssl) + ("libcurl" ,curl))) (native-inputs '()) (arguments - (list - #:make-flags #~(list #$%common-strict-cflags #$%clang-strict-cflags) - #:phases android-phases)))) + (list #:make-flags #~(list #$%common-strict-cflags + #$%clang-strict-cflags) + #:phases android-phases)))) (define-public libsamsung-ipc-gcc-autotools (package - (inherit libsamsung-ipc) - (name "libsamsung-ipc-gcc-autotools") - (arguments - `(#:phases - (modify-phases %standard-phases - (add-before 'build 'patch-python - (lambda _ - (substitute* (find-files "." ".*\\.py$") - (("/usr/bin/env python") (which "python3"))) - #t))) - #:configure-flags - (list "--enable-debug") - #:make-flags (list ,%common-strict-cflags))))) + (inherit libsamsung-ipc) + (name "libsamsung-ipc-gcc-autotools") + (arguments + `(#:phases (modify-phases %standard-phases + (add-before 'build 'patch-python + (lambda _ + (substitute* (find-files "." ".*\\.py$") + (("/usr/bin/env python") + (which "python3"))) #t))) + #:configure-flags (list "--enable-debug") + #:make-flags (list ,%common-strict-cflags))))) (define-public libsamsung-ipc-clang-autotools (package - (inherit libsamsung-ipc) - (name "libsamsung-ipc-gcc-autotools") - (native-inputs - `(("autoreconf" ,autoconf) - ("aclocal" ,automake) - ("ddrescue", ddrescue) - ("libtool" ,libtool) - ("pkgconfig" ,pkg-config) - ("python" ,python) - ("python-sh" ,python-sh) - ("clang" ,clang))) + (inherit libsamsung-ipc) + (name "libsamsung-ipc-gcc-autotools") + (native-inputs `(("autoreconf" ,autoconf) + ("aclocal" ,automake) + ("ddrescue" ,ddrescue) + ("libtool" ,libtool) + ("pkgconfig" ,pkg-config) + ("python" ,python) + ("python-sh" ,python-sh) + ("clang" ,clang))) (arguments - `(#:phases - (modify-phases %standard-phases - (add-before 'build 'patch-python - (lambda _ - (substitute* (find-files "." ".*\\.py$") - (("/usr/bin/env python") (which "python3"))) - #t))) - #:configure-flags - (list "--enable-debug") - #:make-flags (list ,%common-strict-cflags ,%clang-strict-cflags))))) + `(#:phases (modify-phases %standard-phases + (add-before 'build 'patch-python + (lambda _ + (substitute* (find-files "." ".*\\.py$") + (("/usr/bin/env python") + (which "python3"))) #t))) + #:configure-flags (list "--enable-debug") + #:make-flags (list ,%common-strict-cflags + ,%clang-strict-cflags))))) (define-public libsamsung-ipc-clang-android (package - (inherit libsamsung-ipc) + (inherit libsamsung-ipc) (name "libsamsung-ipc-clang-android") (build-system android-ndk-build-system) - (inputs - `(("android-libutils" ,android-libutils) - ("libcrypto" ,openssl) - ("libcurl" ,curl) - ("clang" ,clang))) + (inputs `(("android-libutils" ,android-libutils) + ("libcrypto" ,openssl) + ("libcurl" ,curl) + ("clang" ,clang))) (native-inputs '()) (arguments - (list - #:make-flags #~(list #$%common-strict-cflags #$%clang-strict-cflags) - #:phases android-phases)))) + (list #:make-flags #~(list #$%common-strict-cflags + #$%clang-strict-cflags) + #:phases android-phases)))) ;; Combinaisons: ;; +--------------------------------+----------+----------+--------------+--------------+ |