Skip to content
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

Cross compiling #36

Open
vkuznecovas opened this issue Jan 31, 2018 · 6 comments
Open

Cross compiling #36

vkuznecovas opened this issue Jan 31, 2018 · 6 comments

Comments

@vkuznecovas
Copy link

I have not managed to cross compile the bundle to a linux native from a macOS. Am I missing something? Is there a way to do it currently?

@wagoodman
Copy link
Owner

wagoodman commented Jan 31, 2018

Currently no, if you make a bundle from Linux it will only run in Linux (same for Mac). I could look into combining both Mac and Linux binaries into the bundle. There is another issue open on packaging this for multiple OSs, once I get that release process down this will easily be achievable.

For the meantime I've updated the readme noting some of these caveats.

@amir20
Copy link

amir20 commented Feb 2, 2018

Is this fixed now with goreleaser? See https://github.com/wagoodman/bashful/releases for all the releases.

@wagoodman
Copy link
Owner

Needs a few more steps. When creating a bundle, a copy of bashful gets included in the binary generated. This means that if you bundle on Linux and run the bundle on Mac, it will fail since the bashful copy included was built for Linux.

Simple fix would be to include both binaries in the bundle, which needs some thought. But that's gonna inflate the binary size by a factor of 2... Not really desirable. The last option is to make an os specific binary, which is fine, just boring :) .

@amir20
Copy link

amir20 commented Feb 2, 2018

I didn't even know it's possible to include two binaries with different targeted OS's in one bundle.

@wagoodman
Copy link
Owner

wagoodman commented Feb 2, 2018

thats because I'm cheating: https://github.com/wagoodman/bashful/blob/master/main.go#L147

A 'bundle' in this case is just a shell script with a tar concatenated with it. The tar has bashful and other used files. The bash script knows how to separate itself from the tar, untar the tar, and run bashful. Kinda a weird solution but ends up being a powerfully simple way to 'just get a single "executable" ' from a collection of scripts.

The fix here would be to update this self-extracting bash script to be platform aware and use the right copy of bashful in the process.

@amir20
Copy link

amir20 commented Feb 3, 2018

That’s pretty cool. I didn’t know that’s possible. In the past, I have just used go releaser to create one file per distro. The only down side was a more complicated read me file for installing. Are there any other advantages to bundling everything in one tar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants