build: Append existing CFLAGS and LDFLAGS for CGO#367
Merged
rcoreilly merged 1 commit intogo-python:masterfrom Dec 6, 2024
Merged
build: Append existing CFLAGS and LDFLAGS for CGO#367rcoreilly merged 1 commit intogo-python:masterfrom
rcoreilly merged 1 commit intogo-python:masterfrom
Conversation
Underlying `go build` commands can pass custom `CFLAGS` and `LDFLAGS` to CGO invocations, which GoPy uses in order to pass some of its own command-line arguments to builds. However, there are cases where additional, build-specific parameters may need to be used (e.g. in the case where we're linking against a static library which itself links to other dynamic libraries, which aren't set as options in the packages themselves); this commit respects any existing uses of the `CGO_CFLAGS` and `CGO_LDFLAGS` environment variables, and appends their values to ones used internally by GoPy if needed.
rcoreilly
approved these changes
Dec 6, 2024
Member
rcoreilly
left a comment
There was a problem hiding this comment.
Looks reasonable -- thanks!
Contributor
Author
|
Thanks so much for pushing this through, @rcoreilly! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Underlying
go buildcommands can pass customCFLAGSandLDFLAGSto CGO invocations, which GoPy uses in order to pass some of its own command-line arguments to builds.However, there are cases where additional, build-specific parameters may need to be used (e.g. in the case where we're linking against a static library which itself links to other dynamic libraries, which aren't set as options in the packages themselves); this commit respects any existing uses of the
CGO_CFLAGSandCGO_LDFLAGSenvironment variables, and appends their values to ones used internally by GoPy if needed.My own, specific use-case here is using GoPy in
slidge-whatsapp, and usinggo-fitz, which links againstlibmupdf, which in turn requires a number of different libraries (libjpeg,libharfbuzz, etc.)Infuriatingly enough, Debian doesn't provide a package containing a shared library for MuPDF, only a static library, which requires that we declare any shared libraries specifically at the time of compilation; otherwise builds work but you get
undefined referenceerrors at runtime.