diff --git a/Formula/flashrom.rb b/Formula/flashrom.rb index 0acfe36cc42..84850c900c4 100644 --- a/Formula/flashrom.rb +++ b/Formula/flashrom.rb @@ -1,20 +1,11 @@ class Flashrom < Formula desc "Identify, read, write, verify, and erase flash chips" homepage "https://flashrom.org/" + url "https://download.flashrom.org/releases/flashrom-v1.3.0.tar.bz2" + sha256 "a053234453ccd012e79f3443bdcc61625cf97b7fd7cb4cdd8bfbffbe8b149623" license "GPL-2.0-or-later" head "https://review.coreboot.org/flashrom.git", branch: "master" - stable do - url "https://download.flashrom.org/releases/flashrom-v1.2.1.tar.bz2" - sha256 "89a7ff5beb08c89b8795bbd253a51b9453547a864c31793302296b56bbc56d65" - - # Add https://github.com/flashrom/flashrom/pull/212, to allow flashrom to build on Apple Silicon - patch do - url "https://github.com/areese/flashrom/commit/0c7b279d78f95083b686f6b1d4ce0f7b91bf0fd0.patch?full_index=1" - sha256 "9e1f54f7ae4e67b880df069b419835131f72d166b3893870746fff456b0b7225" - end - end - livecheck do url "https://download.flashrom.org/releases/" regex(/href=.*?flashrom[._-]v?(\d+(?:\.\d+)+)\.t/i) @@ -34,15 +25,51 @@ class Flashrom < Formula depends_on "libftdi" depends_on "libusb" + # no DirectHW framework available + on_macos do + on_intel do + patch :DATA + end + end + + resource "DirectHW" do + url "https://github.com/PureDarwin/DirectHW/archive/refs/tags/DirectHW-1.tar.gz" + sha256 "14cc45a1a2c1a543717b1de0892c196534137db177413b9b85bedbe15cbe4563" + end + def install ENV["CONFIG_RAYER_SPI"] = "no" ENV["CONFIG_ENABLE_LIBPCI_PROGRAMMERS"] = "no" + # install DirectHW for osx x86 builds + if OS.mac? && Hardware::CPU.intel? + (buildpath/"DirectHW").install resource("DirectHW") + ENV.append "CFLAGS", "-I#{buildpath}" + end + system "make", "DESTDIR=#{prefix}", "PREFIX=/", "install" mv sbin, bin end test do system bin/"flashrom", "--version" + + output = shell_output("#{bin}/flashrom --erase --programmer dummy 2>&1", 1) + assert_match "No EEPROM/flash device found", output end end + +__END__ +diff --git a/Makefile b/Makefile +index a8df91f..a178074 100644 +--- a/Makefile ++++ b/Makefile +@@ -834,7 +834,7 @@ PROGRAMMER_OBJS += hwaccess_physmap.o + endif + + ifeq (Darwin yes, $(TARGET_OS) $(filter $(USE_X86_MSR) $(USE_X86_PORT_IO) $(USE_RAW_MEM_ACCESS), yes)) +-override LDFLAGS += -framework IOKit -framework DirectHW ++override LDFLAGS += -framework IOKit + endif + + ifeq (NetBSD yes, $(TARGET_OS) $(filter $(USE_X86_MSR) $(USE_X86_PORT_IO), yes)) diff --git a/style_exceptions/not_a_binary_url_prefix_allowlist.json b/style_exceptions/not_a_binary_url_prefix_allowlist.json index 8b8f05826c3..3ca4d367b61 100644 --- a/style_exceptions/not_a_binary_url_prefix_allowlist.json +++ b/style_exceptions/not_a_binary_url_prefix_allowlist.json @@ -3,6 +3,7 @@ "astyle", "bittwist", "cspice", + "flashrom", "folderify", "launch4j", "organize-tool",