snapcast icon indicating copy to clipboard operation
snapcast copied to clipboard

Homebrew formula for Snapcast

Open badaix opened this issue 3 years ago • 2 comments

A Homebrew formula would easy the setup on MacOS (on Linux as well). Creating a basic formula seems to be quite straightforward:

brew create https://github.com/badaix/snapcast/archive/refs/tags/v0.24.0.zip

will create a snapcast.rb file, that will (after adding some dependencies) compile and install snapclient and snapserver:

# Documentation: https://docs.brew.sh/Formula-Cookbook
#                https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Snapcast < Formula
  desc "Synchronous multiroom audio player"
  homepage "https://github.com/badaix/snapcast"
  url "https://github.com/badaix/snapcast/archive/refs/tags/v0.24.0.tar.gz"
  sha256 "3f179ad0326627f66fd2e581359366c6c49ef51cb1c7b87ed8739fb9d0969a3c"
  license "GPL-3.0"

  depends_on "cmake" => :build
  depends_on "boost" => :build
  depends_on "alsa-lib"
  depends_on "avahi"
  depends_on "expat"
  depends_on "flac"
  depends_on "opus"
  depends_on "pulseaudio"
  depends_on "libvorbis"
  depends_on "libsoxr"

  def install
    # ENV.deparallelize  # if your formula fails when building in parallel
    # Remove unrecognized options if warned by configure
    # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method
    # system "./configure", *std_configure_args, "--disable-silent-rules"
    system "cmake", "-S", ".", "-B", "build", *std_cmake_args
    system "cmake", "--build", "build"
    # , "--parallel", "#{ENV.make_jobs}"
    system "cmake", "--install", "build"
  end

  test do
    # `test do` will create, run in and delete a temporary directory.
    #
    # This test will fail and we won't accept that! For Homebrew/homebrew-core
    # this will need to be a test that verifies the functionality of the
    # software. Run the test with `brew test snapcast`. Options passed
    # to `brew install` such as `--HEAD` also need to be provided to `brew test`.
    #
    # The installed folder is not in the path, so use the entire path to any
    # executables being tested: `system "#{bin}/program", "do", "something"`.
    system "false"
  end
end
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

This formula is only valid for Linux, and one cannot choose to install the client or server only. Maybe this can be passed as an option, or, more likely, it requires two different formulas.

badaix avatar Apr 23 '21 06:04 badaix

Nice feature request. Although I personally have only used snapclient on macos, i can't see the harm in installing both client and server, then the user just runs whichever they wish.

It certainly would be cool to brew install snapcast instead of having to do everything manually. However, does this brew formula still do the compile from source? Unless I'm missing something would it not be preferable to build and distribute a package for macos, which brew then installs? Hmm, perhaps that's an altogether separate feature request.

artmg avatar Jan 13 '22 19:01 artmg

https://github.com/Homebrew/homebrew-core/pull/107089

codetheweb avatar Aug 02 '22 02:08 codetheweb