diff --git a/Formula/beak.rb b/Formula/beak.rb index fc902c4..0094e9b 100644 --- a/Formula/beak.rb +++ b/Formula/beak.rb @@ -1,21 +1,15 @@ class Beak < Formula - desc "A command line interface for your Swift scripts" + desc "Command-line interface for your Swift scripts" homepage "https://github.com/yonaskolb/Beak" - url "https://github.com/yonaskolb/Beak/archive/0.4.0.tar.gz" - sha256 "c306292c94aadd648437a2334936231baaa9ba195738aeeb28379fcb34900d41" - head "https://github.com/yonaskolb/Beak.git" + url "https://github.com/yonaskolb/Beak.git", :tag => "0.4.0", :revision => "8508e02da82c279b3cf1719bd226dc8c94538a71" - depends_on :xcode + depends_on :xcode => ["10.0", :build] def install - - # fixes an issue an issue in homebrew when both Xcode 9.3+ and command line tools are installed - # see more details here https://github.com/Homebrew/brew/pull/4147 - ENV["CC"] = Utils.popen_read("xcrun -find clang").chomp + system "make", "install", "prefix=#{prefix}" + end - build_path = "#{buildpath}/.build/release/beak" - ohai "Building Beak" - system("swift build --disable-sandbox -c release -Xswiftc -static-stdlib") - bin.install build_path + test do + system bin/"beak", "version" end end diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fac5217 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +SHELL = /bin/bash + +prefix ?= /usr/local +bindir ?= $(prefix)/bin +libdir ?= $(prefix)/lib +srcdir = Sources + +REPODIR = $(shell pwd) +BUILDDIR = $(REPODIR)/.build +SOURCES = $(wildcard $(srcdir)/**/*.swift) + +.DEFAULT_GOAL = all + +.PHONY: all +all: beak + +beak: $(SOURCES) + @swift build \ + -c release \ + --disable-sandbox \ + --build-path "$(BUILDDIR)" + +.PHONY: install +install: beak + @install -d "$(bindir)" "$(libdir)" + @install "$(BUILDDIR)/release/beak" "$(bindir)" + +.PHONY: uninstall +uninstall: + @rm -rf "$(bindir)/beak" + +.PHONY: clean +distclean: + @rm -f $(BUILDDIR)/release + +.PHONY: clean +clean: distclean + @rm -rf $(BUILDDIR)