Skip to content

Instantly share code, notes, and snippets.

@hiro-iFactory
Last active August 29, 2015 14:07
Show Gist options
  • Save hiro-iFactory/764036fa4b9d45793370 to your computer and use it in GitHub Desktop.
Save hiro-iFactory/764036fa4b9d45793370 to your computer and use it in GitHub Desktop.
How to compile wkhtmltopdf with static qt for OSX with Brew
1. Install the static qt:
brew install https://raw.github.com/npinchot/homebrew/wkhtmltopdf_static_qt/Library/Formula/qt-wkhtmltopdf.rb
2. Overwrite/Create the file /usr/local/Library/Formula/wkhtmltopdf.rb
3. brew install wkhtmltopdf
require 'formula'
class Wkhtmltopdf < Formula
homepage 'http://code.google.com/p/wkhtmltopdf/'
url 'https://github.com/wkhtmltopdf/wkhtmltopdf.git'
version '0.12.0'
option 'static'
if build.include? 'static'
depends_on 'qt-wkhtmltopdf'
else
depends_on 'qt'
end
def install
if MacOS.version >= :mavericks && ENV.compiler == :clang
spec = 'unsupported/macx-clang-libc++'
else
spec = 'macx-g++'
end
if build.include? 'static'
qmake = "#{Formula.factory('qt-wkhtmltopdf').prefix}/bin/qmake"
else
qmake = "qmake"
end
system qmake, '-spec', spec
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