101010
101010

Reputation: 15756

Combine resources into single binary

I have a program:

dist/
├── myapp
│   ├── bin
│   │   └── launcher
│   ├── lib
│   │   └── libmyapp.so
│   └── share
│       ├── data00.zip
│       └── data01.zip

What I want to do is combine all of that into a single executable file, so that, for the end user, it's a single file to copy around.

I'd be OK with a bash shell file too. Also, I have control over the .so file. I could statically link it to the player.

How do I combine all of this into a single / merged executable file?

This is on linux. The .zip files are opened with fopen(). I'm hoping for some kind of magic involving something like FUSE or similar technology.

I was hoping to avoid embedding the .zip as a DATA segment payload or using a .h file because that would change my program in ways that I didn't intend. This is more of a packaging question.

Upvotes: 0

Views: 371

Answers (2)

Dúthomhas
Dúthomhas

Reputation: 10093

This is not an unusual need or question. And there are a number of different ways to do this.

On Windows, of course, you should use a Windows Resource with the Windows Resource Compiler.
But you are on Linux :O)

On Linux, objcopy(1) is what comes to the rescue. There is an old Linux Journal article specifically about this:

It really does not get simpler than that.

BTW, there are quite a few questions on SO that deal with the same thing, all using a variation of the same answer. For example: Is there any standard way of embedding resources into Linux executable image? [duplicate] The top answer uses the assembler to do the same thing that objcopy does. Variations abound.

EDIT: Found the proper duplicate. Will mark above.

Upvotes: 0

karaketir16
karaketir16

Reputation: 1

You can compress files and share as self extracting archive, that is .exe format.

You can use 7-zip for that. Use-7Zip-to-Create-Self-Extracting-excutables

Upvotes: 0

Related Questions