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

Make postinstall portable #391

Merged
merged 3 commits into from
Jul 16, 2023

Conversation

straight-shoota
Copy link
Contributor

@straight-shoota straight-shoota commented Jul 15, 2023

There's no need for copying the executables manually (which happens in both makefile targets bin and run_file).
Shards' executables takes care of that.

The makefile targets could potentially be dropped as well, I don't think there would be other uses case for those.

Using shards build directly instead of make build improves portability a lot.

The result should be identical to the previous behaviour, except that it works on more platforms (including Windows).
Only practical difference is that the executables are linked instead of copied. This could perhaps be a problem for the source file ameba.cr. It should be fine for the binary.

This should basically "just work" almost anywhere because shards is always available in the environment. No need for make to be available and makefile compatibility doesn't matter either.

Resolves #368

There's no need for copying the executables manually (which happens in both makefile targets `bin` and `run_file`).
Shards' `executables` takes care of that.

The makefile targets could potentially be dropped as well, I don't think there would be other uses case for those.
Using `shards build` directly instead of `make build` improves portability a lot.
This should basically "just work" almost anywhere (including Windows). No need for `make` to be available and makefile compatibility doesn't matter either.
@straight-shoota
Copy link
Contributor Author

Actually, installing crystal.cr doesn't work on Windows.

But this is a bug in shards: It always appends .exe to the filename and then can't find crystal.cr.exe 🤦

@straight-shoota
Copy link
Contributor Author

I think we can merge as is. It requires a patched shards on Windows, but postinstall and executables don't currently work there anyway. So this is not making anything worse. And it will start working in the next shards release with crystal-lang/shards#593 merged.

@veelenga
Copy link
Member

@straight-shoota Wow, thanks for this suggestion. Can we remove run_file makefile target as part of this PR? The other targets (including bin) could still be useful for local testing.

Copy link
Member

@veelenga veelenga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, LGTM.

@Sija please be free to finish the review or merge

@veelenga veelenga requested a review from Sija July 16, 2023 18:33
@Sija Sija merged commit 8c9d234 into crystal-ameba:master Jul 16, 2023
4 checks passed
@Sija Sija added this to the 1.5.0 milestone Jul 16, 2023
@straight-shoota straight-shoota deleted the feat/portability branch July 16, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Windows postinstall
3 participants