I have a package that uses platform dependent system libraries, each of which are separated out into there own package. Is there a way I could install a different dependency based on what platform I am installing on?
The most naive solution would be to have the package depend on all of them:
#lang info
...
(define deps '("mypackage-windows" "mypackage-osx"))
But then mypackage-windows and mypackage-osx get installed even if they're not needed. Worse still, I then need to ensure that the OS X and Windows specific packages don't cause issues when installed on the wrong platform.
So, there any way I can tell raco to only install the packages that I need based on each platform?
Yes there is. You can use the
#:platformsymbol in thedepsportion of yourinfo.rktfile to do this.You can find documentation on it here, and an example of it in the racket-gui package.
You can use
'osx'unixand'windowsto determine what platform you are on.So your example would look like:
In fact, if you wanted to have a different version of your package that work differently on 36 and 64 (and even ppc) variants of each you can do that too: