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

Support Windows postinstall #368

Closed
devnote-dev opened this issue Apr 20, 2023 · 2 comments · Fixed by #391
Closed

Support Windows postinstall #368

devnote-dev opened this issue Apr 20, 2023 · 2 comments · Fixed by #391

Comments

@devnote-dev
Copy link

This is a partial resurrection of #230 with a proposal for handling installs on Windows. I believe that until crystal-lang/shards#468 is finally resolved, Ameba's postinstall hook should run a Crystal file instead of a Makefile directly, which could then invoke a cmd version of the Makefile for Windows. Something like this:

{% if flag?(:win32) %}
  `.\make.cmd build`
{% else %}
  `make bin && make run_file`
{% end %}

At least in this way, people attempting to use Ameba on Windows will actually be able to install it instead of getting a confusing error message and having to run the build commands manually.

@straight-shoota
Copy link
Contributor

This would be making things worse on all other platforms. Instead of running make to build a Crystal program, it would now build a Crystal program to run make to build a Crystal program. That seems pretty crazy to me.

Instead, I'd suggest to avoid building on postinstall. Ameba shouldn't build itself every time it is installed as a dependency. That's annoying and unnecessary and avoidable (cf. https://forum.crystal-lang.org/t/shards-postinstall-considered-harmful/3910 where this project serves as an explicit example).

A better solution is to use a script that builds ameba on demand the first time it's used. This script can be installed automatically (via executables key in shard.yml) and involve platform-specific variants.

@devnote-dev
Copy link
Author

I understand the complexity here but I don't necessarily think that makes it worse.

Instead, I'd suggest to avoid building on postinstall.

It would be better if Shards installed the executable directly instead of installing Ameba then building, but that's for another issue.

A better solution is to use a script that builds ameba on demand the first time it's used.

My understanding of this is to ship "script" executables with Ameba which the user calls, right? Or I guess shipping actual script files would work too.

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

Successfully merging a pull request may close this issue.

3 participants