Skip to content

Instantly share code, notes, and snippets.

@aleb aleb/pitivi.rb
Last active Nov 8, 2019

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-internal" => :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 "adwaita-icon-theme"
# Provides gi.repository.Notify.
depends_on "libnotify"
# Required for building pitivi/coptimizations/renderer.c
depends_on "py3cairo"
# Required to be able to use GStreamer in Python.
depends_on "gst-python"
# 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-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
# Matplotlib is used for drawing the keyframe lines.
depends_on "numpy"
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 "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
# Required to be able to run the tests in tests/meson.build
depends_on "gst-validate" => :test
def install
# According to https://docs.brew.sh/Python-for-Formula-Authors
venv = virtualenv_create(libexec, "python3")
venv.pip_install resources
# We have everything and we don't need a 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"
xy = Language::Python.major_minor_version "python3"
inreplace bin/"pitivi",
"CONFIGURED_PYTHONPATH = ''",
"CONFIGURED_PYTHONPATH = '#{libexec}/lib/python#{xy}/site-packages'"
# Install also the tests, to be able to run them in the test method below.
(pkgshare/"pitivi-tests").install "tests"
(pkgshare/"pitivi-tests").install "data"
inreplace pkgshare/"pitivi-tests/tests/__init__.py",
"return os.path.abspath(pitivi_dir)",
"return '#{lib}/pitivi/python'"
end
test do
File.exist? bin/"pitivi"
system Formula["gstreamer"].opt_bin/"gst-inspect-1.0", "gtksink"
xy = Language::Python.major_minor_version "python3"
ENV.prepend_create_path "PYTHONPATH", "#{libexec}/lib/python#{xy}/site-packages"
ENV.prepend_create_path "PYTHONPATH", lib/"pitivi/python"
cd pkgshare/"pitivi-tests" do
system "gst-validate-launcher", "tests/ptv_testsuite.py"
end
end
end
@rnkn

This comment has been minimized.

Copy link

rnkn commented Jan 30, 2019

This installed successfully, but upon launching pitivi I got:

Python(9820,0x10fd0b5c0) malloc: *** error for object 0x7f87efa36c18: pointer being freed was not allocated
Python(9820,0x10fd0b5c0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6
@Murazaki

This comment has been minimized.

Copy link

Murazaki commented Nov 8, 2019

Hello @aleb,
Pitivi docs recommends to use brew aleb/gui/pitivi to get it on Mac, however there is no such repo on your github.
Has the process changed lately ?

@aleb

This comment has been minimized.

Copy link
Owner Author

aleb commented Nov 8, 2019

Sorry, I should update the page. Homebrew is not actually good for this because they focus on supporting old Macs, and we don't care about that because we don't even have the time for supporting the latest.

In https://gitlab.gnome.org/GNOME/pitivi/merge_requests/130 you can see the discussion about using Cerbero to build Pitivi for Mac. This was being worked on in https://gitlab.gnome.org/sprhawk/cerbero-pitivi by @sprhawk. Then once Pitivi runs with no major issues on Mac we have to see how to package it in a DMG.

If you can help with any of that, or are interested in testing, drop us a line how to reach you. http://www.pitivi.org/?go=contact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.