[Replicant] [libsamsung-ipc] [PATCH 3/3] Add guix.scm
Denis 'GNUtoo' Carikli
GNUtoo at cyberdimension.org
Sun Nov 29 01:59:21 UTC 2020
The guix.scm file can be used to test the build in various
configurations in a reproducible way.
Once you have guix installed, and up to date, you can use
it with the following command:
$ guix build --file=guix.scm
The filename (guix.scm) is a convention that is also used in
other packages to also do build tests in various configurations.
For more background on the use of guix.scm see the Guix days 2020
presentation about it[1].
[1]https://xana.lepiller.eu/guix-days-2020/guix-days-2020-efraim-flashner-build-it-with-guix.webm
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
guix.scm | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 194 insertions(+)
create mode 100644 guix.scm
diff --git a/guix.scm b/guix.scm
new file mode 100644
index 0000000..26210f5
--- /dev/null
+++ b/guix.scm
@@ -0,0 +1,194 @@
+;;; Copyright © 2020 Denis Carikli <GNUtoo at cyberdimension.org>
+;;;
+;;; This file is not part of GNU Guix (yet).
+;;;
+;;; Part of this file might be moved to Guix when a new release of
+;;; libsamsung-ipc is made. This will probably not happen before
+;;; the API and ABI changes are complete, ie when the ipc_client
+;;; has been passed to all the exported functions when that makes
+;;; sense.
+;;;
+;;; This file is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; This file is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(use-modules
+ (ice-9 popen)
+ (ice-9 rdelim)
+ (sxml ssax input-parse)
+ ((guix licenses) #:prefix license:)
+ (guix build-system android-ndk)
+ (guix build-system gnu)
+ (guix gexp)
+ (guix git-download)
+ (guix packages)
+ (gnu packages android)
+ (gnu packages autotools)
+ (gnu packages disk)
+ (gnu packages linux)
+ (gnu packages llvm)
+ (gnu packages pkg-config)
+ (gnu packages python)
+ (gnu packages python-xyz)
+ (gnu packages tls))
+
+(define %strict-cflags "CFLAGS=-Werror -W -Wall -Wunused -Wunused-function")
+
+(define %commit
+ (let* ((port (open-input-pipe
+ "git --no-pager log --oneline HEAD -1 --format='%H'"))
+ (str (read-line port)))
+ (close-pipe port)
+ str))
+
+(define %local-source
+ (local-file
+ (dirname (current-filename)) #:recursive? #t))
+
+(define-public libsamsung-ipc
+ (package
+ (name "libsamsung-ipc")
+ (version (git-version "0.0" "HEAD" %commit))
+ (source %local-source)
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("autoreconf" ,autoconf)
+ ("aclocal" ,automake)
+ ("ddrescue", ddrescue)
+ ("libtool" ,libtool)
+ ("pkgconfig" ,pkg-config)
+ ("python" ,python)
+ ("python-sh" ,python-sh)))
+ (inputs
+ `(("openssl" ,openssl)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'patch-python
+ (lambda _
+ (substitute* (find-files "tools" ".*\\.py$")
+ (("/usr/bin/env python") (which "python3")))
+ #t)))))
+ (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.")
+ (home-page "https://www.replicant.us")
+ (license license:gpl2+)))
+
+(define-public libsamsung-ipc-gcc-android
+ (package
+ (inherit libsamsung-ipc)
+ (name "libsamsung-ipc-gcc-android")
+ (build-system android-ndk-build-system)
+ (inputs
+ `(("android-libutils" ,android-libutils)
+ ("libcrypto" ,openssl)))
+ (native-inputs '())
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (delete 'bootstrap)
+ (add-before 'build 'patch-host
+ (lambda _
+ (substitute* "Android.mk"
+ (("BUILD_SHARED_LIBRARY") "BUILD_HOST_SHARED_LIBRARY")
+ (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY")
+ (("BUILD_STATIC_EXECUTABLE") "BUILD_HOST_STATIC_EXECUTABLE"))
+ #t)))
+ #:make-flags (list ,%strict-cflags)))))
+
+(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 "tools" ".*\\.py$")
+ (("/usr/bin/env python") (which "python3")))
+ #t)))
+ #:make-flags (list ,%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-10)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'patch-python
+ (lambda _
+ (substitute* (find-files "tools" ".*\\.py$")
+ (("/usr/bin/env python") (which "python3")))
+ #t)))
+ #:make-flags (list ,%strict-cflags)))))
+
+(define-public libsamsung-ipc-clang-android
+ (package
+ (inherit libsamsung-ipc)
+ (name "libsamsung-ipc-clang-android")
+ (build-system android-ndk-build-system)
+ (inputs
+ `(("android-libutils" ,android-libutils)
+ ("libcrypto" ,openssl)
+ ("clang" ,clang-10)))
+ (native-inputs '())
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (delete 'bootstrap)
+ (add-before 'build 'patch-host
+ (lambda _
+ (substitute* "Android.mk"
+ (("BUILD_SHARED_LIBRARY") "BUILD_HOST_SHARED_LIBRARY")
+ (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY")
+ (("BUILD_STATIC_EXECUTABLE") "BUILD_HOST_STATIC_EXECUTABLE"))
+ #t))
+ (add-after 'patch-host 'prepare-build-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "CC" "clang")
+ #t)))
+ #:make-flags (list ,%strict-cflags)))))
+
+;; Combinaisons:
+;; +--------------------------------+----------+----------+--------------+--------------+
+;; | Package name | Compiler | Compiler | Build system | Comments |
+;; | | | flags | | |
+;; +--------------------------------+----------+----------+--------------+--------------+
+;; | libsamsung-ipc | GCC | none | autotools | Base package |
+;; +--------------------------------+----------+----------+--------------+--------------+
+;; | libsamsung-ipc-gcc-android | GCC | strict | Android.mk | |
+;; +--------------------------------+----------+----------+--------------+--------------+
+;; | libsamsung-ipc-gcc-autotools | GCC | strict | autotools | |
+;; +--------------------------------+----------+----------+--------------+--------------+
+;; | libsamsung-ipc-clang-android | clang | strict | Android.mk | |
+;; +--------------------------------+----------+----------+--------------+--------------+
+;; | libsamsung-ipc-clang-autotools | clang | strict | autotools | |
+;; +--------------------------------+----------+----------+--------------+--------------+
+
+(list libsamsung-ipc
+ libsamsung-ipc-gcc-android
+ libsamsung-ipc-gcc-autotools
+ libsamsung-ipc-clang-android
+ libsamsung-ipc-clang-autotools)
--
2.29.2
More information about the Replicant
mailing list