Closed danielledeleo closed 7 months ago
Don't forget to update the issue link in the commit message... (you can force push here)
Would it be possible for a user to redefine those flags to make it possible to build with custom Unit installs even if you have Unit via Homebrew installed?
Would it be possible for a user to redefine those flags to make it possible to build with custom Unit installs even if you have Unit via Homebrew installed?
Yes. I can confirm that setting the CGO_
environment variables overrides those set in the .go file. With Unit built from source and installed with make libunit-install
these flags work. It is pretty opaque though.
CGO_LDFLAGS="-L/usr/local/lib" CGO_CFLAGS="-I/usr/local/include" go build
Actually... this isn't ideal. If artifacts from a source build are present in the default includepath, the Homebrew libraries will not be used unless specified as per #967.
So, if no source builds are present in the default includepath, a Homebrew install will work with a simple go build
, otherwise it will have to be overridden.
If this behaviour is acceptable, I'm okay to merge this.
Actually... this isn't ideal. If artifacts from a source build are present in the default includepath, the Homebrew libraries will not be used unless specified as per #967.
Assuming I'm understanding correctly (and it's entirely possible I'm not), might that not be desirable? If you want to try with a newer version of Unit built from source...
might that not be desirable? If you want to try with a newer version of Unit built from source...
Yeah that would be the behaviour!
On Tue, 05 Dec 2023 10:57:31 -0800 Dani De Leo @.***> wrote:
might that not be desirable? If you want to try with a newer version of Unit built from source...
Yeah that would be the behaviour!
Sounds reasonable to me...
This patch adds include paths for
libunit
installed via Homebrew only when built on Darwin (macOS). I don't know if Linux Homebrew uses the same paths, so this shouldn't get in the way in that edge case.Small note, the syntax used on line 1 is the preferred syntax as of go1.18 and the old style of
// +build
should bego fix
d across the repository in the future.Fixes nginx/unit#967