Brew not creating symlinks to executable scripts in Formula

I’m trying to write a formula for BlueSpecs Haskell Verilog Compiler which was recently open sourced (It was proprietary for the past 20 years).

The way BSV work is that its main binary is actually a script which sets up the BlueSpec environment and then invokes the Bluespec binaries.

The script resides in /Cellar/bsc/0.0/bin/bsc.

However, when installing, home-brew copies bsc into /usr/local/bin instead of creating a symlink to it.

Home-brew has some weird special treatment for scripts. homebrew handles true executable binaries just fine.

I need a symlink to the script because the script needs to see the lib folder where its contained.

https://github.com/Homebrew/homebrew-core/blob/master/Formula/sqlmap.rb#L14 this is how you can make a symlink. You should move everything into libexec before to make sure you don’t end up with a symlink and a file.

1 Like

Also, I’m using Homebrew on MacOS - not sure why this post showed up on LinuxBrew, but when I use bin.install_symlink, it creates a MacOS alias file instead of a bsd symlink.

For that reason, I’m reverting the using ln -s
Is this an OK practice?

The alias file is not a true symbolic link and also trips up bsc when bsc searches for its path.

ln -s works fine however

Just make sure you use the function then: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libarchive.rb#L39-L42

Everything works now except:

It seems that homebrew is renaming libraries from .so to .dylib or something…

brew audit gives me this error:

**smoke_test** $ brew audit --new-formula bsc

Missing libraries:

/private/tmp/bsc-20200325-71614-1s94xf4/bsc/src/vendor/yices/v2.6/yices2-inst/lib/libyices.2.dylib

libstp.so.1

bsc:

* bsc has broken dynamic library links:

But all the tests provided with Bluespec work just fine.

Lastly, I can’t pass brew audit because I’m building of a tarball which I released on my fork of BSC. Obviously my fork isn’t notable. The original repo though has 250 stars and many watchers.

The maintainers of BSC seem comfortable with this, they plan to release an official tarball perhaps in a month or two, they just haven’t gotten around to deciding who’d do it, or how to do version number above 4.0.

My fork

issue on versioning

It seems that homebrew is renaming libraries from .so to .dylib or something…

Libraries on macOS are dylibs. Anything that uses .so is cheating.

The maintainers of BSC seem comfortable with this, they plan to release an official tarball perhaps in a month or two, they just haven’t gotten around to deciding who’d do it, or how to do version number above 4.0.

It was unavailable for 20 years, I think we can wait another month or so. version 2017.07.A is a valid version though.