Make the build usable by a package manager such as Homebrew - #17
Open
n8felton wants to merge 3 commits into
Open
Make the build usable by a package manager such as Homebrew#17n8felton wants to merge 3 commits into
n8felton wants to merge 3 commits into
Conversation
The build leaves `main.o` untracked in the working tree. Match `*.o` so that a new source file does not need another entry. Signed-off-by: n8felton <n8felton@gmail.com>
`cc` links a C++ object file only because `-lc++` is passed by hand. `$(CXX)` is the correct driver, it supplies the C++ runtime itself, and it respects the compiler that a packager sets. Drop the now redundant `-lc++`. Add a `clean` rule to remove the object file and the binary. Signed-off-by: n8felton <n8felton@gmail.com>
A package build must be able to stage the binary into a temporary directory, and it must not call `sudo`. Homebrew rejects both of these today, and other packagers have the same constraint. Honor `DESTDIR` on the install paths, and replace the `ifeq` block with `PREFIX ?=` for the same result in one line. Remove `sudo` and the root ownership flags, so that the caller decides how to elevate. Remove the `@` prefixes, so that the install commands appear in build logs. This changes existing behavior: `make install` no longer elevates itself. Use `sudo make install` to install to `/usr/local`. Signed-off-by: n8felton <n8felton@gmail.com>
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.
Make the build suitable for a package manager such as Homebrew. Three independent commits, no change to tool behavior.
Refs #16.
Support
DESTDIRand dropsudofrom the install ruleA package build must stage the binary into a temporary directory, and it must not call
sudo. The current rule fails on both counts, somake installis unusable for Homebrew and for any other packager.DESTDIRon both install paths.ifeqblock withPREFIX ?= /usr/localfor the same result in one line.sudoand the-o root -g wheelflags. The caller decides how to elevate.@prefixes, so the install commands appear in build logs.This changes existing behavior.
make installno longer elevates itself. Usesudo make installto install to/usr/local.Link with
$(CXX)and add acleanrulecclinks a C++ object file only because-lc++is passed by hand.$(CXX)is the correct driver, it supplies the C++ runtime itself, and it respects the compiler that a packager sets.-lc++becomes redundant and is dropped.cleanremoves the object file and the binary.Ignore object files
The build leaves
main.ountracked in the working tree. The pattern is*.o, so a new source file does not need another entry.Test
Verified on an M4 MacBook Pro, macOS 26, Apple Clang. The binary is an arm64 Mach-O and it stages to
/tmp/stage/opt/test/bin/macvdmtool.sudo make installinstalls to/usr/local/binas before.