twam / homebrew-openfpga

OpenFPGA related tools for Homebrew
2 stars 2 forks source link

Update for prjtrellis brew formula #2

Closed pnrhub closed 5 years ago

pnrhub commented 5 years ago

Suggested update too prjtrellis.rb:

class Prjtrellis < Formula
  desc "Device database and tools for bitstream creation for ECP5 FPGAs"
  homepage "https://github.com/SymbiFlow/prjtrellis"
  version "20190809"
  url "https://github.com/SymbiFlow/prjtrellis/archive/dc4120e76750ed372feab637f299585908431c35.tar.gz"
  sha256 "4f2e50061d1fc4bbcc17623459f26fc8c01ca7a9eca7a9aed3273da9c2bcd5c1"
  head "https://github.com/SymbiFlow/prjtrellis.git"

  option "without-python", "No python"
  option "without-shared", "No shared Trellis lib"
  option "with-static", "Use static lib build"

  depends_on "cmake" => :build
  depends_on "ninja" => :build
  depends_on "boost"
  depends_on "boost-python3"
  depends_on "python"

  resource "database" do
    url "https://github.com/SymbiFlow/prjtrellis-db/archive/b4d626b6402c131e9a035470ffe4cf33ccbe7986.tar.gz"
    sha256 "28a0d6037a970fc9054003699d807bed5e20faf912fcc697ab6ea24b07508f04"
  end

  def install
    (buildpath/"database").install resource("database") unless build.head?

    args = []
    args << "-DBUILD_PYTHON=OFF" if build.without? "python"
    args << "-DBUILD_SHARED=OFF" if build.without? "shared"
    args << "-DSTATIC_BUILD=ON" if build.with? "static"

    args << "-DBoost_NO_BOOST_CMAKE=ON"

    args << "-DCURRENT_GIT_VERSION=dc4120e7" unless build.head?
    args << "-DCURRENT_GIT_VERSION="+head.version.commit if build.head?

    cd "libtrellis" do
      system "cmake", *args, ".", "-GNinja", *std_cmake_args
      system "ninja"
      system "ninja", "install"
    end
  end

  test do
    system "#{bin}/ecppack", "--help"
  end
end
twam commented 5 years ago

Thanks for the patch!