Publishing Swift CLI to Homebrew with Makefile

32 views Asked by At

I have written a CLI in swift that I would like to distribute over homebrew. I have never published anything on homebrew before, so I followed this tutorial pretty 1:1 I thought.

Here is my formulae:

class Compass < Formula
  desc "Command Line Interface for Sailor - A Frontend Web Framework in Swift"
  homepage "https://github.com/SailorWebFramework/Compass"
  url "https://github.com/SailorWebFramework/Compass", tag: "0.0.1"
  version "0.0.1"

  depends_on "xcode": [:build]

  def install
    system "make", "install",  "prefix=#{prefix}"
  end

  test do
    system "#{bin}compass", "help"
  end
end

and makefile:

prefix ?= /usr/local
bindir = $(prefix)/bin

# Command building targets.
build:
    swift build -c release --disable-sandbox

install: build
    install -d "$(bindir)"
    install ".build/release/Compass" "$(bindir)"

uninstall:
    $(RM) -rf "$(bindir)/Compass"

clean:
    $(RM) -rf .build

.PHONY: build install uninstall clean

When I run brew install SailorWebFramework/formulae/Compass I get:

==> Fetching sailorwebframework/formulae/compass
==> Downloading https://github.com/SailorWebFramework/Compass

...

==> make install prefix=/usr/local/Cellar/compass/0.0.1
make: *** No rule to make target `install'.  Stop.

I don't know why install is not being recognized. My best guess is that I don't have the pathing correct or maybe something is capital/lowercase when it shouldn't be? I've been staring at this for too long and I decided to throw in the towel. Another pair of eyes would be greatly appreciated!

Edit: should clarify that I can run make install locally (at the root of my project) and have it work as expected... the translation to the homebrew protocol is tripping me up.

0

There are 0 answers