Building a qtwebkit formula


(Daniel Rogers) #1

Hi there,

I’m really struggling getting a homebrew formula for qtwebkit working. Qt modules by default install into the QT install directory.

Is it possible for one formula to install files in another formula’s prefix?

Are there good examples of now to successfully install a qt module under homebrew?


(Daniel Rogers) #2

I tried naively copying https://github.com/Skycoder42/homebrew-qt-modules/blob/master/Formula/qtjsonserializer.rb

Here is my attempt.

class Qtwebkit < Formula
  desc "Qt Webkit"
  homepage "https://wiki.qt.io/Qt_WebKit"
  url "https://codereview.qt-project.org/qt/qtwebkit", :using => :git, :branch => '5.9',
    :revisoin => 'bd0657f98aff85b9f06d85a8cf4da6a27f61a56e'
  head "https://codereview.qt-project.org/qt/qtwebkit", :using => :git, :branch => '5.9'
  version "5.9-61a56e"
  sha256 ""
  depends_on "qt"
  # necessary because other dependences for us, like freetype, depend on libpng
  depends_on "libpng"
  def install
    qt = Formula["qt"]
    args = std_cmake_args
    args << "-DQt5_DIR=#{qt.prefix}/lib/cmake/Qt5"
    args << "-Wno-dev"
    system "./Tools/Scripts/build-webkit", "--qt", "--cmakeargs=" + args.join(" ")
    system "make", "-C", "WebKitBuild/Release", "-j#{ENV.make_jobs}"

    ENV.deparallelize
    instdir = "#{buildpath}/install"
    system "make", "-C", "WebKitBuild/Release", "INSTALL_ROOT=#{instdir}", "install"
    prefix.install Dir["#{instdir}#{HOMEBREW_PREFIX}/Cellar/qt/#{Formula["qt"].pkg_version}/*"]
  end
end