Project

General

Profile

GuixBuildSystem » History » Revision 6

Revision 5 (Denis 'GNUtoo' Carikli, 07/30/2020 10:13 PM) → Revision 6/7 (Denis 'GNUtoo' Carikli, 09/08/2020 01:36 PM)

h1. GuixBuildSystem 

 h2. 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 

 TODO: 
 * 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. 

 h2. Implementation 

 Guix currently uses "android-make-stub":https://github.com/daym/android-make-stub.git 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: 
 <pre> 
    (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)) 
		      ))) 
 </pre> 

 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. 

 h2. Example 

 * There is some work in progress to package libsamsung-ril for faster testing: https://git.replicant.us/contrib/GNUtoo/guix/tree/gnu/packages/replicant.scm?h=libsamsung-ril 

 h2. Additional work 

 There is some work in progress by Julien Lepiller / roptat to package more Android components (including build systems like blueprint / soong) in this    "android-build.scm":https://framagit.org/tyreunom/guix-android/-/blob/master/android/packages/android-build.scm . 

 https://framagit.org/tyreunom/guix-android/raw/master/android/packages/android-build.scm