Compiling a bash script into a windows executable
I have a script which was origionally made for Linux, but adapted to run with Cygwin in windows, and if you already have the executables (sh, cp, mv, etc.) then you can run it without Cygwin. The only problem is that the script also uses a few hundred (yes hundreds) of other executables. Is there any way I can compile this script into a regular executable and pack these other supporting files in as resources?
The script is ~1600 lines long which is probably too long to confortably re-implement by hand in C++. I am looking to compile the script into something which windows can execute without having to make edits to the path to include a bunch of third party executables. A way to contain 开发者_开发知识库all this.
I doubt that the solution you have in mind is feasible.
Instead, I'd modify the script so that the first thing it does is figure out where all those hundreds of executables are. Then either set $PATH
appropriately, or invoke each one by its full pathname.
Or you can have an installer that installs the executables in a specified or user-chosen location, then re-generates the script (from an input file) so it knows where the executables are. Ship with the-script.in
, then have the installer perform textual substitutions to generate the-script
from the-script.in
.
I point out:
RPM and SHC
as a possible solution for your problem. Maybe this tools helps you to do the job.
Using SHC to Cygwin is possible to compile bash to exe Ok. Realy old, but I was looking for it and decide to do my self and make it public. http://goo.gl/M1NSY
Use ports of the required utils and use some application virtualization tool to package it all up. Cameyo is a free one. Forget Cygwin, that thing is huuuge :)
精彩评论