Skip to content

Commit

Permalink
DiffPDF: Update to 2.0.0
Browse files Browse the repository at this point in the history
Also, use a Requirement that references the Poppler Tab to figure out if Qt
support is present.
  • Loading branch information
Sharpie committed May 23, 2012
1 parent be02a97 commit 3358a54
Showing 1 changed file with 53 additions and 23 deletions.
76 changes: 53 additions & 23 deletions Library/Formula/diffpdf.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
require 'formula'

def poppler_has_qt4?
poppler = Formula.factory('poppler')
not Dir[poppler.include + '**/*qt4.h'].empty?
class PopplerQt4 < Requirement
def satisfied?
poppler = Tab.for_formula 'poppler'
poppler.installed_with? '--with-qt4'
end

def fatal?
true
end

def message; <<-EOS.undent
DiffPDF requires the Poppler-Qt4 bindings but Poppler was not installed
with support for Qt. Please reinstall Poppler using the `--with-qt4`
option.
EOS
end
end

class Diffpdf < Formula
homepage 'http://www.qtrac.eu/diffpdf.html'
url 'http://www.qtrac.eu/diffpdf-1.8.0.tar.gz'
md5 'bfede6ebd3cc4993c50aec5b90628807'
url 'http://www.qtrac.eu/diffpdf-2.0.0.tar.gz'
md5 '88b5346cdbfb024a9ad751c7e9a0eee4'

depends_on 'qt'
depends_on 'poppler'
depends_on PopplerQt4.new

# The location of Poppler library/include paths is hardcoded in the project file
# which causes builds to fail if Homebrew is not installed to /usr/local.
Expand All @@ -20,15 +34,9 @@ def patches
end

def install
unless poppler_has_qt4?
onoe <<-EOS.undent
Could not locate header files for poppler-qt4. This probably means that Poppler
was not installed with support for Qt. Try reinstalling Poppler using the
`--with-qt4` option.
EOS
exit 1
end

# The 2.0 sources shipped without translation files. Generate them so that
# compilation does not fail.
system 'lrelease', 'diffpdf.pro'
# Generate makefile and disable .app creation
system 'qmake -spec macx-g++ CONFIG-=app_bundle'
system 'make'
Expand All @@ -41,25 +49,47 @@ def install
__END__

diff --git a/diffpdf.pro b/diffpdf.pro
index 1566ed7..7d37a3d 100644
index 8b511b6..2079247 100644
--- a/diffpdf.pro
+++ b/diffpdf.pro
@@ -17,15 +17,6 @@ HEADERS += sequence_matcher.hpp
SOURCES += sequence_matcher.cpp
SOURCES += main.cpp
RESOURCES += resources.qrc
-LIBS += -lpoppler-qt4
@@ -31,36 +31,7 @@ LIBS += -lpoppler-qt4
win32 {
CONFIG += release
}
-exists($(HOME)/opt/poppler018/) {
- message(Using locally built Poppler library)
- INCLUDEPATH += $(HOME)/opt/poppler018/include/poppler/cpp
- INCLUDEPATH += $(HOME)/opt/poppler018/include/poppler/qt4
- LIBS += -Wl,-rpath -Wl,$(HOME)/opt/poppler018/lib -Wl,-L$(HOME)/opt/poppler018/lib
-} else {
- exists(/usr/include/poppler/qt4) {
- INCLUDEPATH += /usr/include/poppler/qt4
- exists(/poppler_lib) {
- message(Using locally built Poppler library on Windows)
- INCLUDEPATH += /c/poppler_lib/include/poppler/cpp
- INCLUDEPATH += /c/poppler_lib/include/poppler/qt4
- LIBS += -Wl,-rpath -Wl,/c/poppler_lib/bin -Wl,-L/c/poppler_lib/bin
- } else {
- INCLUDEPATH += /usr/local/include/poppler/qt4
- exists(/usr/include/poppler/qt4) {
- INCLUDEPATH += /usr/include/poppler/cpp
- INCLUDEPATH += /usr/include/poppler/qt4
- } else {
- INCLUDEPATH += /usr/local/include/poppler/cpp
- INCLUDEPATH += /usr/local/include/poppler/qt4
- }
- }
-}
-#exists($(HOME)/opt/podofo09/) {
-# message(Using locally built PoDoFo library)
-# INCLUDEPATH += $(HOME)/opt/podofo09/include/poppler/cpp
-# INCLUDEPATH += $(HOME)/opt/podofo09/include/poppler/qt4
-# LIBS += -Wl,-rpath -Wl,$(HOME)/opt/podofo09/lib64 -Wl,-L$(HOME)/opt/podofo09/lib64
-#} else {
-# exists(/usr/include/podofo) {
-# INCLUDEPATH += /usr/include/podofo
-# } else {
-# INCLUDEPATH += /usr/local/include/podofo
-# }
-#}
+
+LIBS += -L$$quote(HOMEBREW_PREFIX/lib) -lpoppler-qt4
+INCLUDEPATH += $$quote(HOMEBREW_PREFIX/include/poppler/cpp)
+INCLUDEPATH += $$quote(HOMEBREW_PREFIX/include/poppler/qt4)

0 comments on commit 3358a54

Please sign in to comment.