Instantly share code, notes, and snippets.

@aleb /pitivi.rb
Last active Sep 14, 2018

Embed
What would you like to do?
Homebrew formula for building Pitivi
class Pitivi < Formula
# Required to create a virtualenv with Matplotlib.
include Language::Python::Virtualenv
desc "Powerful and easy to use video editor"
homepage "http://www.pitivi.org"
url "https://download.gnome.org/sources/pitivi/0.999/pitivi-0.999.tar.xz"
sha256 "cb6f8a831383e698c2117ca7caec77b8167a6b2e2b0fb9c375e6a4f7c815b757"
head do
url "https://gitlab.gnome.org/GNOME/pitivi.git", :branch => "1.0"
end
# Required because we use 'msgfmt' in meson.build.
depends_on "gettext" => :build
# Required because we use 'intltool-merge' in meson.build.
depends_on "intltool" => :build
# Required because we use 'itstool' in meson.build.
depends_on "itstool" => :build
# Pitivi's build system.
depends_on "meson" => :build
# Mesonbuild's backend.
depends_on "ninja" => :build
# Required by gst-transcoder.
depends_on "libffi"
# Required because Pitivi is written in Python3. :)
depends_on "python"
# Required because without this installing pygobject3 fails with:
# Error: /usr/local/opt/py3cairo not present or broken
# Please reinstall py3cairo. Sorry :(
depends_on "py3cairo"
depends_on "pygobject3"
# Provides the GTK+ UI.
depends_on "gtk+3"
# Allows our SVG icons to be loaded.
depends_on "librsvg"
# Provides the GTK icons.
depends_on "gnome-icon-theme"
# Provides gi.repository.Notify.
depends_on "libnotify"
# Required for building pitivi/coptimizations/renderer.c
depends_on "py3cairo"
# Required for drawing the keyframe lines.
depends_on "numpy"
#depends_on "brewsci/bio/matplotlib"
# Required to be able to use GStreamer in Python.
depends_on "gst-python"
# Required to be able to run the tests in tests/meson.build
depends_on "gst-validate"
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/gst-plugins-base.rb
depends_on "gst-plugins-base" => ["with-libogg", # For the Ogg muxer.
"with-opus", # For the Opus audio codec.
"with-libvorbis", # For the Vorbis audio codec.
"with-theora"] # For the Theora video codec.
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/gst-plugins-good.rb
depends_on "gst-plugins-good" => ["with-gdk-pixbuf", # Required by the previewers.
"with-gtk+3", # For the video output sink (gstgtk).
"with-jpeg", # For JPG images.
"with-libpng", # For PNG images.
"with-libvpx"] # For the VP8 codec.
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/gst-plugins-bad.rb
depends_on "gst-plugins-bad" => ["with-libvo-aacenc"] # For the AAC audio codec
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/gst-plugins-ugly.rb
depends_on "gst-plugins-ugly" => ["with-lame", # For the mp3 audio codec.
"with-x264"] # For the x264 video codec.
# Provides the video editing functionality.
depends_on "gst-editing-services"
# Additional codecs through the GStreamer Libav library backed by FFmpeg.
depends_on "gst-libav" => :recommended
resource "Cycler" do
url "https://files.pythonhosted.org/packages/c2/4b/137dea450d6e1e3d474e1d873cd1d4f7d3beed7e0dc973b06e8e10d32488/cycler-0.10.0.tar.gz"
sha256 "cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8"
end
resource "kiwisolver" do
url "https://files.pythonhosted.org/packages/31/60/494fcce70d60a598c32ee00e71542e52e27c978e5f8219fae0d4ac6e2864/kiwisolver-1.0.1.tar.gz"
sha256 "ce3be5d520b4d2c3e5eeb4cd2ef62b9b9ab8ac6b6fedbaa0e39cdb6f50644278"
end
resource "matplotlib" do
url "https://files.pythonhosted.org/packages/eb/a0/31b6ba00bc4dcbc06f0b80d1ad6119a9cc3081ecb04a00117f6c1ca3a084/matplotlib-2.2.3.tar.gz"
sha256 "7355bf757ecacd5f0ac9dd9523c8e1a1103faadf8d33c22664178e17533f8ce5"
end
resource "numpy" do
url "https://files.pythonhosted.org/packages/65/ab/4dfcc20234fae12ee40c714b98077d6e3a10652496bd1488fa4828529b22/numpy-1.15.1.zip"
sha256 "7b9e37f194f8bcdca8e9e6af92e2cbad79e360542effc2dd6b98d63955d8d8a3"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/3c/ec/a94f8cf7274ea60b5413df054f82a8980523efd712ec55a59e7c3357cf7c/pyparsing-2.2.0.tar.gz"
sha256 "0832bcf47acd283788593e7a0f542407bd9550a55a8a8435214a1960e04bcb04"
end
resource "python-dateutil" do
url "https://files.pythonhosted.org/packages/a0/b0/a4e3241d2dee665fea11baec21389aec6886655cd4db7647ddf96c3fad15/python-dateutil-2.7.3.tar.gz"
sha256 "e27001de32f627c22380a688bcc43ce83504a7bc5da472209b4c70f02829f0b8"
end
resource "pytz" do
url "https://files.pythonhosted.org/packages/ca/a9/62f96decb1e309d6300ebe7eee9acfd7bccaeedd693794437005b9067b44/pytz-2018.5.tar.gz"
sha256 "ffb9ef1de172603304d9d2819af6f5ece76f2e85ec10692a524dd876e72bf277"
end
resource "six" do
url "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz"
sha256 "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"
end
def install
# According to https://docs.brew.sh/Python-for-Formula-Authors
venv = virtualenv_create(libexec, "python3")
venv.pip_install resources
venv.pip_install_and_link buildpath
# We have everything and we don't need a PYTHONPATH.
ENV.delete("PYTHONPATH")
mkdir "build" do
system "meson", "--prefix=#{prefix}", ".."
system "ninja"
system "ninja", "install"
end
mv "#{lib}/pitivi/python/pitivi/timeline/renderer.dylib", "#{lib}/pitivi/python/pitivi/timeline/renderer.so"
end
test do
File.exist? "#{bin}/pitivi"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment