mapmapteam / mapmap

Open source video mapping software
http://www.mapmap.info
GNU General Public License v3.0
427 stars 62 forks source link

Homebrew formula for installing MapMap on macOS #434

Open rgov opened 6 years ago

rgov commented 6 years ago

I have written a Homebrew formula that builds MapMap on macOS. The formula lists all the dependencies, which makes it really to install---just brew install mapmap and the rest is automatic. Note though that it does not install it as an .app bundle, and you have to run MapMap from the command line.

Ordinarily, I would submit this to the homebrew-core project, and not here, but I find it frustrating to contribute to their project, and they usually reject submissions for random reasons. If you wish to submit to Homebrew, please be my guest.

class Mapmap < Formula
  desc "Video mapping software"
  homepage "https://mapmapteam.github.io/"
  url "https://github.com/mapmapteam/mapmap/archive/0.6.1.tar.gz"
  sha256 "01a6be81ccf56daba94268877fb8b89c76c896b07dd5280523e1aacaefcf3f5f"
  head "https://github.com/mapmapteam/mapmap.git"

  depends_on "pkg-config" => :build
  depends_on "gst-plugins-base"
  depends_on "gstreamer"
  depends_on "liblo"
  depends_on "qt"
  depends_on "gst-libav" => :recommended
  depends_on "gst-plugins-good" => :recommended

  def install
    inreplace "src/src.pri" do |s|
      s.gsub! "INCLUDEPATH += /Library/Frameworks/GStreamer.framework/Versions/1.0/Headers",
              "QMAKE_CXXFLAGS += #{`pkg-config --cflags gstreamer-1.0 gstreamer-app-1.0 gstreamer-pbutils-1.0`.chomp!}"
      s.gsub! "LIBS += -F /Library/Frameworks/ -framework GStreamer",
              "LIBS += #{`pkg-config --libs gstreamer-1.0 gstreamer-app-1.0 gstreamer-pbutils-1.0`.chomp!}"
      s.gsub! "# CONFIG-=app_bundle",
              "CONFIG-=app_bundle"
    end

    system "qmake", "-config", "release"
    system "make"
    bin.install "MapMap"
  end

  test do
    system "#{bin}/MapMap", "--version"
  end
end
aalex commented 6 years ago

Thanks a lot @rgov !

I will try it out when I/if I have some time. I am excited, as this could become a very easy way to deploy MapMap on macOS computers.

How can I simply run this recipe from the command line with brew?

rgov commented 6 years ago

First, you'll need to install Homebrew. Instructions here: https://brew.sh

Paste the content above into a file at /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mapmap.rb.

Then you can just run brew install mapmap and the rest is automatic.

If it works for you, then you can submit it to the homebrew-core project. After the Homebrew team accepts the formula code, then everyone with Homebrew can install the package with the brew install command.

In the future, it might be nice to make it a .app distribution again, and to use Homebrew to install dependencies inside the .app bundle. But I'm not sure how to do it.

I'll update the code above to add some recommended packages as well.

aalex commented 6 years ago

Great! Thank you.

Perhaps we can write a brew cask formula for the .app as well in the future.

aalex commented 6 years ago

2018-07-06 brew install mapmap.txt

aalex commented 6 years ago

It works!

aalex commented 6 years ago

It should be easy to create a pull request for https://github.com/Homebrew/homebrew-core

I'll wait for the next bugfix release, though, because we have a critical fix in. See #435

aalex commented 6 years ago

I've put it here for now. https://github.com/mapmapteam/brew-mapmap

I might upload the packaging for the upcoming 0.6.2 - that contains bugfixes - to brew.

aalex commented 6 years ago

We need to change the mapmap.pro file so that no change and replace is needed.

Depends on #441

craftmaster2190 commented 2 years ago

+1