hi ,
the termux app is very great i tried to install some python libraries on it with pip and it's worked ,
however , im building the app which is relying in some python libraries and i want provide user interface on app to using this libraries , for that reason i want embedded termux in my app and run some command to downloading this libraries in first usage then i will make user interface for users to execute some command ,
im already converted termux app into library now all i need is remove the termuxActivity and replace it with a function which accept the command and return the result for command for example :-
fun runSomeCommand(command : String): String {
???
return "result"
}
i know it's a big job , but all i want just a hint or little help , hmm if everything going fine i will produce my work as library so other developer can use it just for installing tools embedded into their own app :)
i want embedded termux in my app...
Even if you embed Termux into your app, you will have to recompile all needed packages (in your case python and it's deps) because of changed prefix which is /data/data/{app package}/files/usr/...
Use Android Terminal Emulator with portable PyPy or some other lightweight Python binaries. eGenix PyRun may work.. Also, why didn't you try SL4A?
Closing in favor of https://github.com/termux/termux-app/issues/804.
i want embedded termux in my app...
Even if you embed Termux into your app, you will have to recompile all needed packages (in your case python and it's deps) because of changed prefix which is /data/data/{app package}/files/usr/...
@xeffyr how can I achieve this?
Do I have to recompile on my embedded version of termux? thanks for replying
You can achiveve this by cloning of https://github.com/termux/termux-packages/ and building necessary packages, https://github.com/termux/termux-packages/wiki plenty information to "how to build" packages.
You will need to edit prefix path in line ${TERMUX_PREFIX:="/data/data/com.termux/files/usr"} of script https://github.com/termux/termux-packages/blob/master/scripts/build/termux_step_setup_variables.sh. Then rebuild all packages necessary to have working environment and their dependencies.
Termux is application that can't be just cloned. All packages were ported from FHS layout to Termux-specific one. Now you will have to do same, but with different prefix.
Cross-compilation on device is not possible. Especially with different prefix.
You can achiveve this by cloning of
https://github.com/termux/termux-packages/and building necessary packages, https://github.com/termux/termux-packages/wiki plenty information to "how to build" packages.You will need to edit prefix path in line
${TERMUX_PREFIX:="/data/data/com.termux/files/usr"}of script https://github.com/termux/termux-packages/blob/master/scripts/build/termux_step_setup_variables.sh. Then rebuild all packages necessary to have working environment and their dependencies.Termux is application that can't be just cloned. All packages were ported from FHS layout to Termux-specific one. Now you will have to do same, but with different prefix.
Cross-compilation on device is not possible. Especially with different prefix.
@xeffyr thanks a lot for replying. Effectively managed to recompile python package with the ${TERMUX_PREFIX} changed with my appid. Managed to achieve this using the docker container. Thank you a lot for that.
So now I got a bunch of .deb files, but..... how can I install them if the "/data/data/com.termux/files/usr" PREFIX is still present on my embedded Termux? So when I try to use pkg, dpkg, they try to access to this wrong path, that does not match with mine.
Thanks a lot @xeffyr, I really appreciate this.
Recompile ALL packages that are intended to be used inside your app. Termux is not cloneable, you have to create own app and own package repository.
So when I try to use pkg, dpkg, they try to access to this wrong path, that does not match with mine.
Once you will have own repository, change default URL to yours in https://github.com/termux/termux-packages/blob/master/packages/apt/build.sh#L55.
@danielrosero I am trying to use image magick package from termux. I took asset and unzipped the github termux packages to my files directory which is /data/data/com.../files. I have also changed prefix to my app id. When I am trying to execute build-package.sh file I am getting error - touch:'/tmp/.termux-build.lck':no such file directory. I have created home and usr directories. If anyone ready solve I can even share my apps source code. Is there any other way to get platform independent binaries which like as ls or sh which is usually present in /system/bin/ls. I want image magick binary which I can directly execute in my own app by process builder. Thanks
When I am trying to execute build-package.sh file I am getting error - touch:'/tmp/.termux-build.lck':no such file directory.
@rupesh-kumar-lpu Are you understand that it must be executed in Docker image (either on Linux PC or VPS) ?
Follow https://github.com/termux/termux-packages/wiki/Build-environment.
Without properly configured build machine with Docker installed you won't be able do too much. On device builds are very limited since Termux is not self-hosting.
Is there any other way to get platform independent binaries which like as ls or sh
Platform independent binaries do not exist. Everything is tight to CPU arch, OS and file system layout.
Most helpful comment
You can achiveve this by cloning of
https://github.com/termux/termux-packages/and building necessary packages, https://github.com/termux/termux-packages/wiki plenty information to "how to build" packages.You will need to edit prefix path in line
${TERMUX_PREFIX:="/data/data/com.termux/files/usr"}of script https://github.com/termux/termux-packages/blob/master/scripts/build/termux_step_setup_variables.sh. Then rebuild all packages necessary to have working environment and their dependencies.Termux is application that can't be just cloned. All packages were ported from FHS layout to Termux-specific one. Now you will have to do same, but with different prefix.
Cross-compilation on device is not possible. Especially with different prefix.