Brian-ED/rayed-bqn

install directory for homebrew may be incorrect

Closed this issue ยท 11 comments

The readme says /opt/homebrew/lib/libraylib.dylib is the path for libraylib when using homebrew, but according to https://osxdaily.com/2018/07/05/where-homebrew-packages-installed-location-mac/ the default location seems to be /usr/local/opt/raylib/lib/libraylib.dylib which i have confirmed on my own mac i had lying around.

@OliverM can you confirm since you're probably a mac user?

Btw, I'm currently making the default path for the config on macOS so there is less chance for complications while installing rayed-bqn.

I confirmed with another mac user that this is correct, so i will keep the change. Feel free to correct me if I'm wrong ofcourse :)

That article is over 5 years old... I don't have the /usr/local/opt/raylib/lib/libraylib.dylib or even the /usr/local/opt directory on my Mac. So I'm not sure what's going on. I went with the above location because it matches what the current homebrew docs say (in the "What Does Homebrew Do?" section).

Homebrew does allow you to use any host directory you like so maybe this has changed a bit in the past?

yeah, that's weird since i have the exact opposite, since i don't have the path you provided. I did doublecheck with another mac user and they had the same as me. so yeah likely it's changed.
Maybe i need to check if either path exists so it works for both cases.

I think they recommend expanding the HOMEBREW_PREFIX environment variable to find the homebrew installation location, but I don't know how easy it is for you to do that at runtime?

printenv HOMEBREW_PREFIX returns nothing, and couldn't find anything online about homebrew prefix being an env variable.
Oh but i did find that brew just links to the packages in opt directory, the actual location is in /usr/local/Cellar/. can you confirm that raylib lives there for you too? @OliverM

(i just noticed that article is also 5 years old soooo maybe also outdated)

i could also use brew --prefix raylib to find it, but that assumes raylib is installed which i guess it should be but i can't guarentee that.

new idea, what if in the auto-generated config i just look for raylib in some locations, and if it's found i generate the path, and if it didn't exist i just won't write that in config. This means if a field doesn't exist in config rayed-bqn will look for it automatically.
Also a good oprutinity to update the config to just use json instead of the crap i've used so far lol

what if in the auto-generated config i just look for raylib in some locations, and if it's found i generate the path, and if it didn't exist i just won't write that in config

Sounds good. I guess the issue is that some Mac users might prefer to build raylib for themselves rather than install via homebrew. It should probably be enough to check brew --prefix raylib and using the result of that unless it errors. If it does error you could check the default build location and then fail outright if it's not found there. I'm not sure there's any other common locations worth checking?

BTW I don't have /usr/local/Cellar/ either, but it looks like homebrew adds symlinks to installed libraries in /usr/local/lib, at least for my machine. Maybe it's enough to check for /usr/local/lib/libraylib.dylib or use that as a default path?

I also have /usr/local/lib/libraylib.dylib so having that as default sounds great. I'll also add the brew prefix check for good measure. Thanks so much for the help :)

finally! i have tested on my mac the commit 2431de0 and the new config mechanism seems to be working!