GuixBuildSystem » History » Version 4
Denis 'GNUtoo' Carikli, 07/27/2020 04:59 PM
fix license
| 1 | 1 | Denis 'GNUtoo' Carikli | h1. GuixBuildSystem |
|---|---|---|---|
| 2 | |||
| 3 | 3 | Denis 'GNUtoo' Carikli | h2. Use cases |
| 4 | 2 | Denis 'GNUtoo' Carikli | |
| 5 | Guix can be used for faster testing: |
||
| 6 | * It can build software that uses autotools and Android.mk Makefiles |
||
| 7 | * We might be able to use it to iterate over different Android versions, to test libsamsung-ril changes for various RIL API way faster (without even having to use it in a specific Replicant version, use repo, etc). |
||
| 8 | * It's more self contained than the whole Replicant source code |
||
| 9 | |||
| 10 | TODO: |
||
| 11 | * Import the compilation flags for various Replicant versions like -Werror -Wnounused to make sure that everything is usable in all Replicant versions. |
||
| 12 | * Finish packaging libsamsung-ril |
||
| 13 | * Add more automatic testing either in libsamsung-ipc / libsamsung-ril and or in the unofficial Guix packages. |
||
| 14 | |||
| 15 | h2. Implementation |
||
| 16 | |||
| 17 | 1 | Denis 'GNUtoo' Carikli | Guix currently uses "android-make-stub":https://github.com/daym/android-make-stub.git to build Android software using Android.mk. |
| 18 | |||
| 19 | There are some comments in Guix source code that cross compilation isn't supported for the android-ndk build system. |
||
| 20 | |||
| 21 | Practically speaking it means that Guix won't be able to build any BUILD_SHARED_LIBRARY, BUILD_SHARED_LIBRARY or BUILD_STATIC_EXECUTABLE, however building the HOST_* counterpart works fine. |
||
| 22 | |||
| 23 | To workaround that they simply do replace them in the Android.mk during the build procedude: |
||
| 24 | * BUILD_SHARED_LIBRARY becomes BUILD_HOST_SHARED_LIBRARY |
||
| 25 | * BUILD_SHARED_LIBRARY becomes BUILD_HOST_STATIC_LIBRARY |
||
| 26 | * BUILD_STATIC_EXECUTABLE becomes BUILD_HOST_STATIC_EXECUTABLE |
||
| 27 | |||
| 28 | For instance we have: |
||
| 29 | <pre> |
||
| 30 | (arguments |
||
| 31 | `(#:phases |
||
| 32 | (modify-phases %standard-phases |
||
| 33 | (delete 'bootstrap) |
||
| 34 | (add-before 'build 'patch-host |
||
| 35 | (lambda _ |
||
| 36 | ;; TODO: Cross-compile. |
||
| 37 | (substitute* "Android.mk" |
||
| 38 | (("BUILD_SHARED_LIBRARY") "BUILD_HOST_SHARED_LIBRARY") |
||
| 39 | ;; (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY") |
||
| 40 | ;; (("BUILD_STATIC_EXECUTABLE") "BUILD_HOST_STATIC_EXECUTABLE") |
||
| 41 | ) |
||
| 42 | #t)) |
||
| 43 | ))) |
||
| 44 | </pre> |
||
| 45 | |||
| 46 | Here the (delete 'bootstrap) is because the build is done in several phases, and here the bootstrap phase wasn't overriden by the android-ndk build system yet. As a result it tried to run autogen.sh. That might be because in libsamsung-ipc there is both an android build system and an autotools based one. |
||
| 47 | |||
| 48 | h2. Example |
||
| 49 | |||
| 50 | <pre> |
||
| 51 | ;;; Copyright © 2020 Denis Carikli <GNUtoo@cyberdimension.org> |
||
| 52 | ;;; |
||
| 53 | ;;; This file is not part of GNU Guix (yet). |
||
| 54 | ;;; |
||
| 55 | 4 | Denis 'GNUtoo' Carikli | ;;; This file is free software; you can redistribute it and/or modify it |
| 56 | 1 | Denis 'GNUtoo' Carikli | ;;; under the terms of the GNU General Public License as published by |
| 57 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
||
| 58 | ;;; your option) any later version. |
||
| 59 | ;;; |
||
| 60 | 4 | Denis 'GNUtoo' Carikli | ;;; This file is distributed in the hope that it will be useful, but |
| 61 | 1 | Denis 'GNUtoo' Carikli | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 62 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 63 | ;;; GNU General Public License for more details. |
||
| 64 | ;;; |
||
| 65 | ;;; You should have received a copy of the GNU General Public License |
||
| 66 | 4 | Denis 'GNUtoo' Carikli | ;;; along with this file. If not, see <http://www.gnu.org/licenses/>. |
| 67 | 1 | Denis 'GNUtoo' Carikli | |
| 68 | (define-module (replicant) |
||
| 69 | #:use-module ((guix licenses) #:prefix license:) |
||
| 70 | #:use-module (guix packages) |
||
| 71 | #:use-module (guix git-download) |
||
| 72 | #:use-module (guix build-system android-ndk) |
||
| 73 | #:use-module (guix build-system gnu) |
||
| 74 | #:use-module (gnu packages android) |
||
| 75 | #:use-module (gnu packages autotools) |
||
| 76 | #:use-module (gnu packages pkg-config) |
||
| 77 | #:use-module (gnu packages tls) |
||
| 78 | ) |
||
| 79 | |||
| 80 | (define-public libsamsung-ipc |
||
| 81 | (package |
||
| 82 | (name "libsamsung-ipc") |
||
| 83 | (version "0.1") |
||
| 84 | (source |
||
| 85 | (origin |
||
| 86 | (method git-fetch) |
||
| 87 | (uri (git-reference |
||
| 88 | (url "https://git.replicant.us/replicant/hardware_replicant_libsamsung-ipc.git") |
||
| 89 | (commit "73aa86f31bb004c48c5250ea43cca9ed9d51cb17"))) |
||
| 90 | (file-name (git-file-name name version)) |
||
| 91 | (sha256 (base32 "1wkvkgbckb7cif6lrd8rivh6s4886qa4dw2s433l28h2lh3zmqkb")) |
||
| 92 | ) |
||
| 93 | ) |
||
| 94 | (build-system gnu-build-system) |
||
| 95 | |||
| 96 | (native-inputs |
||
| 97 | `(("autoreconf" ,autoconf) |
||
| 98 | ("aclocal" ,automake) |
||
| 99 | ("libtool" ,libtool) |
||
| 100 | ("pkgconfig" ,pkg-config) |
||
| 101 | )) |
||
| 102 | |||
| 103 | (inputs |
||
| 104 | `(("openssl" ,openssl))) |
||
| 105 | |||
| 106 | (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol") |
||
| 107 | (description |
||
| 108 | "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol, |
||
| 109 | found in many Samsung smartphones and tablets.") |
||
| 110 | (home-page "https://www.replicant.us") |
||
| 111 | (license license:gpl2+) |
||
| 112 | ) |
||
| 113 | ) |
||
| 114 | |||
| 115 | (define-public libsamsung-ipc-android |
||
| 116 | (package |
||
| 117 | (name "libsamsung-ipc-android") |
||
| 118 | (version "0.1") |
||
| 119 | (source |
||
| 120 | (origin |
||
| 121 | (method git-fetch) |
||
| 122 | (uri (git-reference |
||
| 123 | (url "https://git.replicant.us/replicant/hardware_replicant_libsamsung-ipc.git") |
||
| 124 | (commit "73aa86f31bb004c48c5250ea43cca9ed9d51cb17"))) |
||
| 125 | (file-name (git-file-name name version)) |
||
| 126 | (sha256 (base32 "1wkvkgbckb7cif6lrd8rivh6s4886qa4dw2s433l28h2lh3zmqkb")) |
||
| 127 | ) |
||
| 128 | ) |
||
| 129 | (build-system android-ndk-build-system) |
||
| 130 | |||
| 131 | (inputs |
||
| 132 | `(("android-libutils" ,android-libutils) |
||
| 133 | ("libcrypto" ,openssl))) |
||
| 134 | |||
| 135 | (arguments |
||
| 136 | `(#:phases |
||
| 137 | (modify-phases %standard-phases |
||
| 138 | (delete 'bootstrap) |
||
| 139 | (add-before 'build 'patch-host |
||
| 140 | (lambda _ |
||
| 141 | ;; TODO: Cross-compile. |
||
| 142 | (substitute* "Android.mk" |
||
| 143 | (("BUILD_SHARED_LIBRARY") "BUILD_HOST_SHARED_LIBRARY") |
||
| 144 | ;; (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY") |
||
| 145 | ;; (("BUILD_STATIC_EXECUTABLE") "BUILD_HOST_STATIC_EXECUTABLE") |
||
| 146 | ) |
||
| 147 | #t)) |
||
| 148 | ))) |
||
| 149 | |||
| 150 | (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol") |
||
| 151 | (description |
||
| 152 | "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol, |
||
| 153 | found in many Samsung smartphones and tablets.") |
||
| 154 | (home-page "https://www.replicant.us") |
||
| 155 | (license license:gpl2+) |
||
| 156 | ) |
||
| 157 | ) |
||
| 158 | |||
| 159 | ;; TODO: This package doesn't compile yet. |
||
| 160 | ;; To make it compile, we would need to: |
||
| 161 | ;; - patch Guix to change (define android-libcutils to |
||
| 162 | ;; (define-public android-libcutils and also do the same for android-liblog. |
||
| 163 | ;; When this is done we can use the following in inputs: |
||
| 164 | ;; ("android-libcutils" ,android-libcutils) |
||
| 165 | ;; ("android-liblog" ,android-liblog) |
||
| 166 | ;; - to package libnetutils and libpower |
||
| 167 | ;; - find a way to use headers that are not in LOCAL_SHARED_LIBRARIES like |
||
| 168 | ;; hardware/libhardware_legacy/include and system/core/include |
||
| 169 | |||
| 170 | (define-public libsamsung-ril |
||
| 171 | (package |
||
| 172 | (name "libsamsung-ril") |
||
| 173 | (version "0.1") |
||
| 174 | (source |
||
| 175 | (origin |
||
| 176 | (method git-fetch) |
||
| 177 | (uri (git-reference |
||
| 178 | (url "https://git.replicant.us/replicant/hardware_replicant_libsamsung-ril.git") |
||
| 179 | (commit "181d3e2a85dff24552a29a0cecbca9ac78cba5b7"))) |
||
| 180 | (file-name (git-file-name name version)) |
||
| 181 | (sha256 (base32 "0sjiw7kp9hipkc9smphbzzbmhyf30y0vni94w15vliry381g5ma8")) |
||
| 182 | ) |
||
| 183 | ) |
||
| 184 | (build-system android-ndk-build-system) |
||
| 185 | |||
| 186 | (inputs |
||
| 187 | `(("android-libutils" ,android-libutils) |
||
| 188 | ("libsamsung-ipc", libsamsung-ipc) |
||
| 189 | ("libcrypto" ,openssl))) |
||
| 190 | |||
| 191 | (arguments |
||
| 192 | `(#:phases |
||
| 193 | (modify-phases %standard-phases |
||
| 194 | (delete 'bootstrap) |
||
| 195 | (add-before 'build 'patch-host |
||
| 196 | (lambda _ |
||
| 197 | ;; TODO: Cross-compile. |
||
| 198 | (substitute* "Android.mk" |
||
| 199 | (("BUILD_SHARED_LIBRARY") "BUILD_HOST_SHARED_LIBRARY")) |
||
| 200 | #t)) |
||
| 201 | ))) |
||
| 202 | |||
| 203 | (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol") |
||
| 204 | (description |
||
| 205 | "libril implementation for the Samsung IPC modem protocol, found in many Samsung smartphones and tablets.") |
||
| 206 | (home-page "https://www.replicant.us") |
||
| 207 | (license license:gpl2+) |
||
| 208 | ) |
||
| 209 | ) |
||
| 210 | </pre> |