Formula head + resource head

I would like to give multiple git repos for a formula by using a resource, but the formula below gives this error:

Error: Tcl-Tk-Embedded: undefined method `head’ for #Resource:0x00007f8bad27a7a0

class TclTkEmbedded < Formula
  desc "Tool Command Language"
  homepage "https://www.tcl.tk/"
  head "https://github.com/tcltk/tcl.git"

  keg_only :provided_by_macos,
	"tk installs some X11 headers and macOS provides an (older) Tcl/Tk"

  resource "tk" do
	head "https://github.com/tcltk/tk.git"
  end

  build.head? do
	reason <<~EOS
	  Smilei needs the Apple Command Line Tools to be installed.
		You can install them, if desired, with:
		  xcode-select --install
	EOS
	satisfy { MacOS::CLT.installed? }
  end

  env :std

  def install

	cd "macosx" do
	  system "make", "embedded"
	end

	# Let tk finds our new tclsh
	ENV.prepend_path "PATH", bin

	resource("tk").stage do
	  cd "macosx" do
		system "make", "embedded"
	  end
	end

  end

end

What I would like to achieve is the same as this simple script:

git clone git@github.com:tcltk/tk.git
git clone git@github.com:tcltk/tcl.git
cd tcl/macosx/
make embedded -j10
cd ../../tk/macosx/
make embedded -j10

Thanks!

that’s because head ""only defines what the git head of the formula is. Resources need to be defined with a URL.

1 Like