-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Allow to build packages on device #4149
Conversation
bd9fed1
to
c94d57d
Compare
7b4bcc4
to
63441cc
Compare
|
||
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_CROSSCOMPILING=True") | ||
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_LINKER=$TERMUX_STANDALONE_TOOLCHAIN/bin/$LD $LDFLAGS") | ||
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_NAME=Android") |
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.
Hmm, this ties into the issue I raised with #151, most packages that use this will likely require setting this on-device too.
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.
-DCMAKE_SYSTEM_NAME=Android
seems require option for standalone toolchain.
File ./share/cmake-3.14/Modules/Platform/Android-Determine.cmake
:
if(NOT IS_DIRECTORY "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}")
message(FATAL_ERROR
"Android: The standalone toolchain directory specified by CMAKE_ANDROID_STANDALONE_TOOLCHAIN:\n"
" ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}\n"
"does not exist."
)
...
if(NOT EXISTS "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h")
message(FATAL_ERROR
"Android: The standalone toolchain directory specified by CMAKE_ANDROID_STANDALONE_TOOLCHAIN:\n"
" ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}\n"
"does not contain a sysroot with a known layout. The file:\n"
" ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h\n"
"does not exist."
)
So having CMAKE_SYSTEM_NAME=Android
on device will require patching CMake.
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.
OK, someone mentioned that on that issue a couple years ago. I'm already proposing patching CMake to make sure CMake sets that variable to Android on Termux, I will look into what else is necessary, such as modifying that file you quote also.
Once that's done, this won't need to be repeated for the on-device build. I just want to know from you and @fornwall that you'd accept a CMake patch to change that, as Fredrik seemed to want it a couple years ago, before I look into submitting a pull for CMake here.
You mentioned earlier that some packages aren't building with the on-device clang, some of those could be because this CMake variable is not set on-device.
8e05033
to
f0c26a2
Compare
cc33204
to
e7f818e
Compare
1a58d83
to
50e0efd
Compare
Thanks for all the work on this, I will try this pull out in a fresh Termux install. Regarding all those packages that delete files, I looked at some of them and they mostly seem to delete files that were probably installed by a previous version of that same package, before updating to the new ones. There's two ways I see to handle this:
Let me know what you think. |
d5b59f7
to
8014bd0
Compare
For now these packages can be just excluded from on-device build. If one of these packages is a dependency, it can be installed with |
8014bd0
to
4fa1f16
Compare
f7d4f9a
to
7d5d8f5
Compare
ed7a0da
to
b81e4f4
Compare
Partial compatibility for on-device builds. There is no guarantee that it will be possible to build all available packages and built packages will have same reliability that cross-compiled but should solve "self-hosting" problems as much as possible.
…tions in build.sh %ci:no-build
b81e4f4
to
c2d7bbc
Compare
Set of compatibility patches that makes our build system partially usable in Termux.
Related issue: #1756
Proof of concept:
Behaviour changes for all builds:
Now will be stripped binaries located only in
bin
,lib
orlibexec
.When build-package.sh is called recursively, it won't pass
TERMUX_ARCH
with command line argument but will do this through exported environment variable.Packages that delete stuff from
TERMUX_PREFIX
in build process. If for some packages that behaviour is acceptable, the others may delete user configuration files and critical runtime libraries.These packages have stubs in their build.sh to prevent building on device. E.g. trying to build perl will result in following: