Created
April 14, 2012 10:53
-
-
Save 2bits/2383544 to your computer and use it in GitHub Desktop.
wkhtmltopdf-0.11.0_rc1 hack to build their patched qt as an option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class WkhtmltopdfQt < Formula | |
url 'git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git' | |
end | |
class Wkhtmltopdf < Formula | |
homepage 'http://code.google.com/p/wkhtmltopdf/' | |
url 'http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1.tar.bz2' | |
sha1 'db03922d281856e503b3d562614e3936285728c7' | |
version '0.11.0_rc1' | |
depends_on 'qt' unless ARGV.include? '--build-patched-qt' | |
#depends_on 'wkhtmltopdf-qt' if ARGV.include? '--build-patched-qt' | |
def options | |
[['--build-patched-qt', 'Download and build a special patched qt (~1hr)']] | |
end | |
def install | |
# fix that missing TEMP= include. | |
inreplace 'common.pri' do |s| | |
s.gsub! 'TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl', '' | |
s.gsub! 'include($$join(TEMP, "/"))', '' | |
end | |
# build their patched qt if the user options that | |
if ARGV.include? '--build-patched-qt' then | |
WkhtmltopdfQt.new.brew { (buildpath).install Dir['*'] } | |
system "exit 1" | |
end | |
# It tries to build universally, but Qt is bottled as 64bit => build error. | |
# If we are 64bit, do not compile with -arch i386. This is a Homebrew | |
# issue with our Qt4, not upstream, because wkhtmltopdf bundles a patched | |
# Qt4 that Homebrew doesn't use. | |
if MacOS.prefer_64_bit? | |
inreplace 'src/pdf/pdf.pro', 'x86', 'x86_64' | |
inreplace 'src/image/image.pro', 'x86', 'x86_64' | |
end | |
system 'qmake', '-spec', 'macx-g++' | |
system 'make' | |
ENV['DYLD_LIBRARY_PATH'] = './bin' | |
`bin/wkhtmltopdf --manpage > wkhtmltopdf.1` | |
`bin/wkhtmltoimage --manpage > wkhtmltoimage.1` | |
# install binaries, libs, and man pages | |
bin.install Dir[ "bin/wkh*" ] | |
lib.install Dir[ "bin/lib*" ] | |
man1.install Dir[ "wkht*.1" ] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bumping into an error when trying:
I get:
Without the --build-patched-qt wkhtmltopdf, the build works fine.