-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scripts: cross-compilation implementation (compilation of 32-bit programs for 64-bit arch) #20864
base: master
Are you sure you want to change the base?
Conversation
c51636f
to
cf462ce
Compare
The branch has conflicts. |
b51e5b9
to
0d6395c
Compare
b5a9764
to
017ab21
Compare
Test build - termux-pacman/glibc-packages#317 |
017ab21
to
808b56f
Compare
3646db5
to
bc819a8
Compare
TERMUX_PKG_BUILD32=false | ||
fi | ||
if [ "$TERMUX_PKG_BUILD_IN_SRC" = "true" ] && [ "$TERMUX_PKG_BUILD32" = "true" ]; then | ||
termux_error_exit "It is not possible to build 32-bit and 64-bit versions of a package in one place, the build location must be separate." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it have to be a separate directory? Why can't the same folder be used for both 64bit and 32bit builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all built components (64-bit and 32-bit) of the package are stored in one directory, this can lead to component confusion. Which in turn can break the build of the package.
if [ "$TERMUX_PKG_BUILD32" = "true" ]; then | ||
( | ||
termux_step_setup_build32_environment | ||
termux_step_make_install32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like termux_step_configure, termux_step_make and termux_step_make_install are run twice if the 32 variants are not overridden. Is that intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's how it's intended. This is implemented to optimize (i.e. not increase) build.sh
scripts, since most of the cross-build stages are not very different from the regular build (except for the variables), and also so that with cross-functions it would be possible to reconfigure the cross-build stages if necessary. That is, to put it simply: if there is a possibility to optimize, then optimize. And if not, then configure this cross-assembly in detail (here everything depends on the package). Here is an example of the build.sh
script of the glibc package, for better understanding.
Note: Please note that all cross functions are run in a slightly modified environment so that they can work correctly (i.e. perform cross compilation).
06d0b55
to
fcb3e09
Compare
c14f524
to
214ccd0
Compare
improved cross compilation based on bionic library |
…rams for 64-bit arch) - New variables have been implemented: - TERMUX_PKG_BUILD32 - enables or disables cross-compilation of the package - TERMUX_PKG_BUILD32DIR - path to compiled cross-package components - TERMUX_LIB64_PATH - 64-bit library path - TERMUX_LIB32_PATH - 32-bit library path - TERMUX_LIB_PATH - path to the library which changes depending on the compilation type (non-cross - TERMUX_LIB64_PATH, cross - TERMUX_LIB32_PATH) - Implemented cross functions (termux_step_configure32, termux_step_make32 and termux_step_make_install32). - The application environment setup scheme has been updated to ensure that cgct works properly. It now sets up temporary glibc, glibc32 packages, and libgcc symbolic links from cgct when needed. The updated scheme also allows forks to easily build glibc packages for their applications. - The glibc package naming standard has been updated, now glibc packages can be named with the "glibc32" prefix.
214ccd0
to
d13b79d
Compare
Main: this PR implements a scheme for building 32-bit programs for 64-bit archs (i.e. arm programs for aarch64 and i686 programs for x86_64). Such cross-compilation will definitely be relevant for building some glibc packages. Possibly for bionic packages too (although I have not seen such requests), but more tests are needed for this.
First words (relevant but not the most important): a package with the glibc32 prefix in its name is a package that is compiled on a 32-bit architecture standard but will run on a 64-bit device