简体   繁体   中英

Generic, cross-platform tool to package an application into a single binary?

I have an application composed of a few script files (in this case written in Lua, eg Main.lua , Helper1.lua and Helper2.lua ). In order to run the application on Windows, it is currently necessary to have these script files, plus the interpreter ( lua52.exe and lua52.dll ). The program can then be launched using lua52.exe Main.lua <arguments> .

Ideally I would like to distribute, instead of a folder containing 5 files, a single executable Main.exe . When launched as Main.exe <arguments> , something like the following should happen:

  1. Extract all 5 files into a temporary directory
  2. Launch lua52.exe Main.lua <arguments>
  3. Delete the temporary directory when done

Is there any tool which can package up the 5 files and create Main.exe ?

I believe that for Python (only), pyinstaller -F fits these requirements. Is there a generic tool, not tied to Python (or Lua) and ideally cross-platform (Windows, OS X and Linux) which can do this?

Edit: If there is no cross-platform tool which can do this, I am happy to use a different tool on each platform. For Windows, it appears that WinRAR can almost do what I need (by creating an SFX archive), but unfortunately it does not seem to support forwarding <arguments> onto lua52.exe .

Does anyone know of a Windows tool which would fit my needs better that WinRAR? Also, is there a similar tool for OS X and/or Linux?

if you target only 1 specific platform there should be available installer builders. for example for windows there is http://nsis.sourceforge.net/Main_Page your requirement is rather simple so in fact you can write your own simple runner/installer in something portable c/c++/java and create different installer for different system (as lua52.exe will work only under windows).

if you need your application to be cross-platform you need some common runtime: java/ruby/nodejs or you can try to build smart shell scripts. other option is to go online and create a web application

Have you considered the WinZip self-extractor ?

WinZip® Self-Extractor creates self-extracting Zip files. These self-extracting Zip files are ideal for electronic file distribution, because they contain multiple compressed files, minimizing download time and ensuring that important files do not become separated.

Self-extracting Zip files can optionally run a "setup" or "installation" program, provided by the creator, after the files are decompressed.

It's specific to the Windows platform, but I've used it for software distributions and it's pretty nice, and very affordable. It also has the nice advantage that paranoid power users who already have a Lua interpreter can manually extract your Main.lua script from the same archive without needing to trust your native executables (installer or interpreter). See the link above for a detailed list of features.

Also regarding cross-platform, the lua interpreter you are packaging obviously targets a particular platform, so you already need to provide your users with a platform-specific executable archive for each platform. So there's not much added value to using a unified cross-platform tool for generating all your platform-specific installers, aside from your release preparation time. You could consider something like install4j which utilizes the Java JRE that most users are likely to already have (although if they don't then forcing them to download Java just so the installer can run seems a bit silly).

For cross-platform deployment there is a great toolset (assuming you have a money to spend) by BitRock, see http://installbuilder.bitrock.com/installbuilder-features.html

I don't know how exactly does it work, but the end-results are nice multi-platform installers, Bitnami uses it to package their open source apps (I've seen Windows and Linux installers)

If you are looking especially for lua solution, either check this answer: Easiest way to compile a lua script (*.exe)...?

or you can consider building your own completely customized exe loader (as lua is open source you can embed it easily). C source code included in http://www.freelists.org/post/luajit/Interested-in-lua2exe,5 answer for "lua2exe" Google query can help

For packaging .NET applications into single file including all their resources, look eg here: http://research.microsoft.com/en-us/people/mbarnett/ILMerge.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM