shards installtakes care of everything unless you want to override a value provides the best DX even if the build script is more complex. I doubt I'd have half as many users if it required: manually check your distro version. If it's >= x
installelse download and build it yourself.
Yes. If only
postinstall: linux-musl: ./build/linux-musl.sh # needs variant for some reason linux: ./build/linux.sh windows-msvc: ./build/windows-mingw.cmd windows-mingw: ./build/windows-mingw.cmd posix-default: cd build/posix && make windows-default: cd build/windows && make
And tried keys in order of most specific to less specific arch trying
windows-default 2nd to last before
@oprypin:matrix.org I have a few shards (example) that run on limited platforms. Some are POSIX only. One is OpenBSD only. Future ones may be window only. What say you of 2 additional options for shard.yaml?
A platform flag. If it matches the shard is included. If not the shard is automatically pruned.
# For mmap platforms: - !windows - posix (or) # For mostly posix shards platforms: - !macos - posix
A 2nd platform flag with identical semantics should be available for dependencies
dependencies: generic-file-polling.cr: platforms: - !linux inotify.cr: platforms: - linux
Why both? These options aren't mutually exclusive.
Sometimes the shard author knows it won't work on specific platforms and they can specify them.
Other times the author may choose a more specific solution and wish to exclude a generic shard (see inotify example above). Or they could be working on an newer/older system where a
shard specified dependency doesn't work in their particular situation.
platform: posix. Create a windows anonymous memory shard (No mmap equivalent that handles all functions) with
platform: windows. Create a generic anon memory wrapper shard that includes both. Create a guard page key holding shard similar to
sodium_mallocusing the anon memory shard.
mmaplike mapping a file, I can't do that on windows as it uses a completely different API
platformas a restriction wouldn't be used with pure portable crystal shards, only platform specific shards.
platformas a dependency may be specified to override. See the inotify example. Generic file polling may work everywhere but on linux you may prefer
inotify. On BSD eventually
kqueue. Although technically those should have their own platform limitations so the dependency limit should only be placed on generic file polling.
alias PermissiveType = Array(String | Int32) | String s : PermissiveType = "hello world" #works ss : PermissiveType = ["hello", "world"] # must be (Array(Int32 | String) | String), not Array(String)
PermissiveTypeis strictly more permissive than
Array(String)this cast should be possible - any possible value of that more restrictive type should satisfy the more permissive type.