Repository navigation
filesearch: building with media on macOS - #50
Merged
Merged
Conversation
…s, in the Makefile and README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Coverage for this change: 90.6% |
There was a problem hiding this comment.
🟡 Changes recommended
The global linker flag breaks older Apple linkers and macOS-to-Linux cross-builds, while Homebrew path injection can override configured or cross-target libraries.
4 open issues
What changed in this PR
Updates media-enabled filesearch builds to accommodate Homebrew’s native libraries on macOS.
Changes:
- Adds automatic discovery of Homebrew’s keg-only FFmpeg 8.
- Allows LibRaw’s cgo flags and suppresses duplicate-library linker warnings on macOS.
- Documents Homebrew dependencies and environment settings for direct
go installusage.
| File | Description |
|---|---|
Makefile |
Configures FFmpeg discovery, cgo flag allowances, and macOS linker warning suppression. |
filesearch/README.md |
Adds Homebrew installation instructions and explains the required environment settings. |
Review effort: Balanced
| ifneq ($(BREW_FFMPEG),) | ||
| export PKG_CONFIG_PATH := $(BREW_FFMPEG)$(if $(PKG_CONFIG_PATH),:$(PKG_CONFIG_PATH)) | ||
| endif | ||
| export CGO_LDFLAGS += -Wl,-no_warn_duplicate_libraries |
| # On macOS, Homebrew's ffmpeg@8, which is keg-only, so isn't found otherwise, | ||
| # when it's installed. The linker warns about the libraries which more than | ||
| # one of the C libraries link, which isn't a problem. | ||
| ifeq ($(OS),darwin) |
| BREW ?= $(shell command -v brew 2>/dev/null) | ||
| BREW_FFMPEG := $(if $(BREW),$(wildcard $(shell $(BREW) --prefix ffmpeg@8 2>/dev/null)/lib/pkgconfig)) | ||
| ifneq ($(BREW_FFMPEG),) | ||
| export PKG_CONFIG_PATH := $(BREW_FFMPEG)$(if $(PKG_CONFIG_PATH),:$(PKG_CONFIG_PATH)) |
| This needs go-metadata's C libraries: FFmpeg 8, libexif, libheif and LibRaw. On macOS, with Homebrew: | ||
|
|
||
| ```bash | ||
| brew install ffmpeg@8 libexif libheif libraw |
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.



CGO_ENABLED=1 go install -tags media …/filesearch/cmd/filesearch@latest, andmake filesearch MEDIA=1, failed on macOS with Homebrew's libraries.ffmpeg@8into its prefix, as it's a versioned formula, sopkg-configcan't findlibavcodecand the rest.-Xpreprocessorflag unless it's allowed.$(brew --prefix ffmpeg@8)/lib/pkgconfigtoPKG_CONFIG_PATHwhen it's installed, allows-Xpreprocessor, and quiets the linker's warning about duplicate libraries, as go-metadata's Makefile does.brew installand the two exports forgo install, with why each is needed.Tested:
go install … -tags mediaof v1.0.1, with the exports, which reads videos' titles with FFmpeg, andmake filesearch MEDIA=1from an empty build cache, which failed (Package 'libswscale' not found) before the change. It only seemed to work before because the build cache held a build from earlier.