-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
postinstall
or other hook needed to build c library
#484
Comments
I agree the |
I don't fully agree to my previous comment anymore. The reason is: Shards is a dependency resolver. Not a build system or package installer. If you install a project for local building, you don’t do that via shards ( The solution to both problems mentioned in the OP is to use a build tool. I think I use this |
I thought |
You can use cmake on windows. However, you'll probably need different build commands on windows and posix systems anyways. |
A single universal command that i don't need to read documentation for each shard to to figure out what to run is still desirable to reduce developer friction. Pros:
|
Sounds great, but I don't think it's realistic to implement. If you know any truly cross-platform build system, where you can run a single universal command on any system and it just sets everything up for you as necessary, please use just that. I'm sure it can even run Or, in other words: I don't think we can or even should implement such a universal build system in shards. It's just completely out of scope, an entire, complex problem space on its own. We should stay with the Unix philosophy to do only one thing, and do that right. However, I would be happy to consider integrating external solutions for this problem with shards. But for doing this, we need to have options available. I don't know any existing system that could do what you're describing. At least none that is publicly available and easy to use. That's a good reason why not to try doing this in shards: it's very hard. |
I think there is a misunderstanding.
I outlined a very simple proposal #507. It's probably less than 10 lines of code. Let's see generic_platform = "posix" or "windows" # depending on environment
install_cmd = case postinstall = shard_yaml["postinstall"]
when String
postinstall
when Hash
postinstall[platform_with_arch]? || postinstall["#{platform}-default"]? ||
postinstall[generic_platform_with_arch]? || postinstall["#{generic_platform}-default"]? ||
postinstall["default"]? ||
raise "couldn't locate platform for #{platform_with_arch}"
else
raise "unknown type #{postinstall}, wanted String | Hash(String, String)"
end Slightly over budget but not too complex I hope. |
That's by far not what I would consider a universal build command. It just multiplexes completely different commands based on platform. And as I said in #507 (comment) this kind of thing can easily be moved to a script. This doesn't need to be provided by shards at all. A custom script is also much more flexible for any specific use case. |
I have a shard with no dependencies that builds a c library through
postinstall
. Unfortunatelypostinstall
never runs fromshards install
when using the shard directly.This is causing minor pain in 2 areas:
Solution: an additional hook that always runs or run
postinstall
after installing other dependencies in the same order as the shard being listed as a dependency.If neither solution is acceptable then:
postinstall
is automatic for deps?postinstall
be special when listed as a dep but not for the shard itself?In #305 @ysbaddaden indicates 1 hook should do everything and #319
postinstall
is the appropriate hook for building non crystal dependencies. If so then the missingpostinstall
call is probably an oversight.The text was updated successfully, but these errors were encountered: