-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Customize binary output location #518
Comments
My answers to such feature requests might repeat themselves, but there's another option:
|
@straight-shoota Wouldn't this require every shard to use a |
Yes, I think every non-trivial shard would benefit from using a build system for such tasks. Ideally |
Just note that my idea with Crystal was to be able to run crystal to compile a program. I didn't read this thread, but I hope that doesn't change! |
I don't understand. If shards build already produces a binary, why not make that binary location customizable? It seems trivial to do. Compiling a C project and so on seems like a task for a build tool, but configuring an output directory? I don't think so. |
It's not super trivial. |
I doubt the output location needs to be changed per run, so it could be specified in the yaml file |
I can't make any sense of that. What would be the use case? The OP mentions the use case of putting build artifacts in a destination directory for a snapcraft distribution. Such a path (in the example In my opinion however, this is a typical use case for |
https://doc.rust-lang.org/cargo/commands/cargo-install.html we can add install command like cargo install. It will easily build some executable files |
👋🏽 thinking on future developer ergonomics (DX) for a bit and given Imagine in the future Crystal allowed and worked in a way that Say:
Heck, why not:
🌈 😊 Pushing this to another build tool (make) just adds another dependency on a chain, which I think contradicts the idea of a thin wrapper around crystal build. Having that path hardcoded inside Of course, this assumes you could cross-compile to these targets without issues (but that is a dream for another issue in another repository) 😉 Talking about packaging itself (Snap, apk, deb, etc) seems a different story, in which case neither shards or Crystal could deal with any package-specific nuances. In that case, you as developer take care of placing all the artifacts you want to package. Cheers, |
@luislavena You can already do everything you mentioned. $ shards build myapp --cross-compile --target=aarch64-linux-musl -obuild/arm64-musl/bin/myapp
Dependencies are satisfied
Building: myapp
cc build/arm64-musl/bin/myapp.o -o build/arm64-musl/bin/myapp -rdynamic -L/home/linuxbrew/.linuxbrew/lib -lpcre -lm -lgc -lpthread -L/home/linuxbrew/.linuxbrew/Cellar/libevent/2.1.12/lib -levent -lrt |
Right @straight-shoota, but you cannot do that with all targets automatically, you need to do it target by target. Apologies for not showing that in my example, copy and pasta failure 🤦🏼♂️ |
Currently
shards build
always outputs the binaries in thebin
directory. Being able to customize this would make things a lot more flexible, especially whenshards
is being used within another package manager.For example I'm working on a v2 Crystal snap plugin. It expects that the built binaries are available at a specific location. At the moment I'm doing
'cp -r ./bin "${SNAPCRAFT_PART_INSTALL}"/bin'
, but that feels kinda meh. I've been referencingGo
andRust
implementations and they have GOBIN and --root respectively.@straight-shoota also suggested that we could utilize the
-o
flag with some special semantics on if it's a directory or not.So guess we just need to figure out what approach we want:
-o
with some special semanticsOriginally posted by @Blacksmoke16 in #179 (comment)
The text was updated successfully, but these errors were encountered: