The beginning of this thread was about having a configuration file for the linked options, that instead of been computed directly, could be generated if missing. Allowing the user to override it.
That’s part of my problem and I think it’s related to this discussion.
- I have a shard.
- The shard itself has a preference for custom link options of using it’s own library when the system installed version is old or unavailable.
- The shard will be used by other shards or applications.
- The person compiling the final application should be able to override the link options.
crystal specs
should work in the shard itself or any applications requiring the shard without Makefiles, wrappers, or any additional work.
It doesn’t seem like there’s a standard way to do this or even hooks to do this like in other languages unless I missed them.
I’m 90% of the way there using:
@[Link(ldflags: "``./build/pkg-libs.sh``")]
In my case link flags are determined by a possible local installed library. Based on the solutions above whether using link overrides on the command line or configuration files it seems like my code will break. I hope whatever solution you come up with takes this in to account. (Not my particular method but a design that is flexible enough to accommodate conditional library installations)
Now my problem is crystal spec
changing directories on me. I don’t suppose there’s a simple way to get the project directory before cd
?