|
| 1 | +class Nesfab < Formula |
| 2 | + desc "Programming language that targets the Nintendo Entertainment System" |
| 3 | + homepage "https://pubby.games/nesfab.html" |
| 4 | + # for this version only, point to a specific commit. post-1.6, this will point to a tagged release. |
| 5 | + url "https://github.com/pubby/nesfab/archive/da18a43dc7b941cc4c56c949303aa37633fdc1b0.tar.gz" |
| 6 | + version "1.6" |
| 7 | + sha256 "bfd8c497df0d87138fda9e5de61d1ab5a36fb1951eeaed413b6619032b711745" |
| 8 | + license "GPL-3.0-only" |
| 9 | + |
| 10 | + depends_on "make" => :build |
| 11 | + depends_on "boost" |
| 12 | + on_ventura do |
| 13 | + depends_on "llvm@18" => :build |
| 14 | + end |
| 15 | + on_linux do |
| 16 | + depends_on "gcc" => :build |
| 17 | + end |
| 18 | + |
| 19 | + fails_with :clang do |
| 20 | + build 1599 |
| 21 | + cause "Missing std::lexicographical_compare_three_way" |
| 22 | + end |
| 23 | + |
| 24 | + def install |
| 25 | + # update this when bumping package version |
| 26 | + git_sha = "da18a43d" |
| 27 | + |
| 28 | + if OS.mac? && MacOS.version == :ventura |
| 29 | + ENV.llvm_clang |
| 30 | + ENV.prepend_path "HOMEBREW_LIBRARY_PATHS", Formula["llvm@18"].opt_lib/"c++" |
| 31 | + # adapted from tests in: |
| 32 | + # https://github.com/Homebrew/homebrew-core/blob/5c4e0f50fa0cee5ae512f09ae887e3f5d0c05318/Formula/l/[email protected] |
| 33 | + toolchain_path = "/Library/Developer/CommandLineTools" |
| 34 | + cpp_base = (MacOS.version >= :big_sur) ? MacOS::CLT.sdk_path : toolchain_path |
| 35 | + |
| 36 | + cxxflags = "-isysroot #{MacOS::CLT.sdk_path} " \ |
| 37 | + "-isystem #{cpp_base}/usr/include/c++/v1 " \ |
| 38 | + "-isystem #{MacOS::CLT.sdk_path}/usr/include " \ |
| 39 | + "-isystem #{toolchain_path}/usr/include" |
| 40 | + if Hardware::CPU.intel? |
| 41 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", |
| 42 | + "CXXFLAGS=#{cxxflags}", |
| 43 | + "release" |
| 44 | + else |
| 45 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", |
| 46 | + "CXXFLAGS=#{cxxflags}", |
| 47 | + "ARCH=", "release" |
| 48 | + end |
| 49 | + bin.install "nesfab" => "nesfab-release" |
| 50 | + |
| 51 | + system "make", "clean" |
| 52 | + if Hardware::CPU.intel? |
| 53 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", |
| 54 | + "CXXFLAGS=#{cxxflags}", |
| 55 | + "debug" |
| 56 | + else |
| 57 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", |
| 58 | + "CXXFLAGS=#{cxxflags}", |
| 59 | + "ARCH=", "debug" |
| 60 | + end |
| 61 | + bin.install "nesfab" |
| 62 | + elsif OS.mac? |
| 63 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", "release" if Hardware::CPU.intel? |
| 64 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", "ARCH=", "release" if Hardware::CPU.arm? |
| 65 | + bin.install "nesfab" => "nesfab-release" |
| 66 | + |
| 67 | + system "make", "clean" |
| 68 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", "debug" if Hardware::CPU.intel? |
| 69 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "CXX=#{ENV.cxx}", "ARCH=", "debug" if Hardware::CPU.arm? |
| 70 | + bin.install "nesfab" |
| 71 | + else |
| 72 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "release" if Hardware::CPU.intel? |
| 73 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "ARCH=", "release" if Hardware::CPU.arm? |
| 74 | + bin.install "nesfab" => "nesfab-release" |
| 75 | + |
| 76 | + system "make", "clean" |
| 77 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "debug" if Hardware::CPU.intel? |
| 78 | + system "make", "GIT_COMMIT=#{git_sha}-homebrew", "ARCH=", "debug" if Hardware::CPU.arm? |
| 79 | + bin.install "nesfab" => "nesfab" |
| 80 | + end |
| 81 | + end |
| 82 | + |
| 83 | + test do |
| 84 | + system bin/"nesfab", "--version" |
| 85 | + end |
| 86 | +end |
0 commit comments