aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/diffpdf.rb
blob: 3082a1b2b4fe7083cc6c43c920ab03a209669f08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
require 'formula'

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-2.0.0.tar.gz'
  sha1 'b6a52f48927721721960aa1f581f127aa8454830'

  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.
  def patches
    DATA
  end

  def install
    # 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'

    bin.install 'diffpdf'
    man1.install 'diffpdf.1'
  end
end

__END__

diff --git a/diffpdf.pro b/diffpdf.pro
index 8b511b6..2079247 100644
--- a/diffpdf.pro
+++ b/diffpdf.pro
@@ -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(/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 {
-	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)