GuixBuildSystem » History » Revision 3
« Previous |
Revision 3/7
(diff)
| Next »
Denis 'GNUtoo' Carikli, 07/27/2020 04:58 PM
Fix typo in use case
GuixBuildSystem¶
Use cases¶
Guix can be used for faster testing:- It can build software that uses autotools and Android.mk Makefiles
- 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).
- It's more self contained than the whole Replicant source code
- Import the compilation flags for various Replicant versions like -Werror -Wnounused to make sure that everything is usable in all Replicant versions.
- Finish packaging libsamsung-ril
- Add more automatic testing either in libsamsung-ipc / libsamsung-ril and or in the unofficial Guix packages.
Implementation¶
Guix currently uses android-make-stub to build Android software using Android.mk.
There are some comments in Guix source code that cross compilation isn't supported for the android-ndk build system.
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.
To workaround that they simply do replace them in the Android.mk during the build procedude:- BUILD_SHARED_LIBRARY becomes BUILD_HOST_SHARED_LIBRARY
- BUILD_SHARED_LIBRARY becomes BUILD_HOST_STATIC_LIBRARY
- BUILD_STATIC_EXECUTABLE becomes BUILD_HOST_STATIC_EXECUTABLE
For instance we have:
(arguments `(#:phases (modify-phases %standard-phases (delete 'bootstrap) (add-before 'build 'patch-host (lambda _ ;; TODO: Cross-compile. (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)) )))
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.
Example¶
;;; Copyright © 2020 Denis Carikli <GNUtoo@cyberdimension.org> ;;; ;;; This file is not part of GNU Guix (yet). ;;; ;;; GNU Guix 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. ;;; ;;; GNU Guix 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/>. (define-module (replicant) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix git-download) #:use-module (guix build-system android-ndk) #:use-module (guix build-system gnu) #:use-module (gnu packages android) #:use-module (gnu packages autotools) #:use-module (gnu packages pkg-config) #:use-module (gnu packages tls) ) (define-public libsamsung-ipc (package (name "libsamsung-ipc") (version "0.1") (source (origin (method git-fetch) (uri (git-reference (url "https://git.replicant.us/replicant/hardware_replicant_libsamsung-ipc.git") (commit "73aa86f31bb004c48c5250ea43cca9ed9d51cb17"))) (file-name (git-file-name name version)) (sha256 (base32 "1wkvkgbckb7cif6lrd8rivh6s4886qa4dw2s433l28h2lh3zmqkb")) ) ) (build-system gnu-build-system) (native-inputs `(("autoreconf" ,autoconf) ("aclocal" ,automake) ("libtool" ,libtool) ("pkgconfig" ,pkg-config) )) (inputs `(("openssl" ,openssl))) (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-android (package (name "libsamsung-ipc-android") (version "0.1") (source (origin (method git-fetch) (uri (git-reference (url "https://git.replicant.us/replicant/hardware_replicant_libsamsung-ipc.git") (commit "73aa86f31bb004c48c5250ea43cca9ed9d51cb17"))) (file-name (git-file-name name version)) (sha256 (base32 "1wkvkgbckb7cif6lrd8rivh6s4886qa4dw2s433l28h2lh3zmqkb")) ) ) (build-system android-ndk-build-system) (inputs `(("android-libutils" ,android-libutils) ("libcrypto" ,openssl))) (arguments `(#:phases (modify-phases %standard-phases (delete 'bootstrap) (add-before 'build 'patch-host (lambda _ ;; TODO: Cross-compile. (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)) ))) (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+) ) ) ;; TODO: This package doesn't compile yet. ;; To make it compile, we would need to: ;; - patch Guix to change (define android-libcutils to ;; (define-public android-libcutils and also do the same for android-liblog. ;; When this is done we can use the following in inputs: ;; ("android-libcutils" ,android-libcutils) ;; ("android-liblog" ,android-liblog) ;; - to package libnetutils and libpower ;; - find a way to use headers that are not in LOCAL_SHARED_LIBRARIES like ;; hardware/libhardware_legacy/include and system/core/include (define-public libsamsung-ril (package (name "libsamsung-ril") (version "0.1") (source (origin (method git-fetch) (uri (git-reference (url "https://git.replicant.us/replicant/hardware_replicant_libsamsung-ril.git") (commit "181d3e2a85dff24552a29a0cecbca9ac78cba5b7"))) (file-name (git-file-name name version)) (sha256 (base32 "0sjiw7kp9hipkc9smphbzzbmhyf30y0vni94w15vliry381g5ma8")) ) ) (build-system android-ndk-build-system) (inputs `(("android-libutils" ,android-libutils) ("libsamsung-ipc", libsamsung-ipc) ("libcrypto" ,openssl))) (arguments `(#:phases (modify-phases %standard-phases (delete 'bootstrap) (add-before 'build 'patch-host (lambda _ ;; TODO: Cross-compile. (substitute* "Android.mk" (("BUILD_SHARED_LIBRARY") "BUILD_HOST_SHARED_LIBRARY")) #t)) ))) (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol") (description "libril implementation for the Samsung IPC modem protocol, found in many Samsung smartphones and tablets.") (home-page "https://www.replicant.us") (license license:gpl2+) ) )
Updated by Denis 'GNUtoo' Carikli almost 5 years ago · 3 revisions