Ticket #16056: Portfile_v2.diff

File Portfile_v2.diff, 11.9 KB (added by jens.traube@…, 16 years ago)

update of patch -- based on Randell's recent update

  • Portfile

    old new  
    1010homepage    http://${name}.freedesktop.org/
    1111
    1212description     Poppler is a PDF rendering library based on the xpdf-3.0 code base.
    13 long_description \
    14     ${description}
    15 
     13long_description Poppler is a PDF rendering library based on the xpdf-3.0 code base. \
     14                 It consists of frontends (GLib, Qt3, Qt4), the poppler core, \
     15                 and rendering backends (Cairo, Splash, AbiWord). \
     16                 (Poppler Wiki: http://freedesktop.org/wiki/Software/poppler)
    1617master_sites    ${homepage}
    1718checksums   \
    1819    md5 00593d56340b4a635f4a34590c445800 \
    1920    rmd160 26634a62d77471ed668507bd0c287bfff291f881 \
    2021    sha1 993c7ac0e12c20674908a44542f49b43bd417574
    2122
    22 depends_lib \
    23     port:cairo \
    24     port:gtk2 \
    25     port:poppler-data
     23depends_build   port:pkgconfig
     24
     25depends_lib     port:freetype \
     26                port:fontconfig \
     27                port:expat \
     28                port:libiconv \
     29                port:zlib \
     30                port:poppler-data
    2631
    2732post-patch {
    28     reinplace "s|-flat_namespace -undefined suppress||g" \
    29         ${worksrcpath}/configure
    30     reinplace "s|\$includedir|${prefix}/include|g" \
    31         ${worksrcpath}/configure
    3233    reinplace "s|tests||" \
    3334        ${worksrcpath}/qt4/Makefile.in
     35
     36    # replace "\$allow_undefined_flag" with "$allow_undefined_flag":
     37    reinplace {s|\\$allow_undefined_flag|\$allow_undefined_flag|g} \
     38        ${worksrcpath}/configure
    3439}
    3540
    3641configure.args \
     
    5358    }
    5459}
    5560
    56 variant quartz conflicts x11 description { Support for the native Mac OS X interface } {
     61variant quartz conflicts x11 requires glibCairo description { Support for the native Mac OS X interface } {
    5762    configure.args-append --disable-gtk-test --without-x
    5863}
    5964
     
    6368        port:xrender
    6469}
    6570
    66 variant qt4 description { Support for the QT toolkit } {
     71variant qt4 conflicts qt3Splash qt4Splash glibSplash glibCairo abiword description { Support for the QT toolkit } {
    6772    configure.args-delete --disable-poppler-qt4
    6873    if ([variant_isset quartz]) {
    6974        depends_lib-append  port:qt4-mac
     
    7277    }
    7378}
    7479
    75 test.run    yes
    76 test.dir    ${worksrcpath}/test
    77 test.target all
     80variant qt3Splash description {Qt3 bindings to poppler & Splash output device} {
     81    depends_lib-append  port:qt3-mac \
     82                        port:jpeg \
     83                        port:libpng
     84}
     85
     86variant qt4Splash description {Qt4 bindings to poppler & Splash output device} {
     87    depends_lib-append  port:qt4-mac \
     88                        port:jpeg \
     89                        port:libpng
     90}
     91
     92#variant qt4Arthur description {Qt4 bindings to poppler & Arthur output device (Qt4 Paint System)} {
     93#}
     94
     95# There is no source code for a variant Qt4Cairo (what about Qt3 ?)
     96
     97variant glibSplash description {GLib bindings to poppler & Splash output device} {
     98    depends_lib-append  port:gtk2 \
     99                        port:glib2 \
     100                        port:gettext \
     101                        port:libpixman \
     102                        port:jpeg \
     103                        port:libpng \
     104                        port:tiff
     105
     106    # GDK (GIMP Drawing Kit) is required by the GLib wrapper
     107    # when splash output device is enabled.
     108    # GDK (part of GTK) depends on Pango, Pango depends on Cairo.
     109
     110    depends_lib-append  port:pango \
     111                        port:cairo
     112}
     113
     114variant glibCairo description {GLib bindings to poppler & Cairo output device} {
     115    pre-fetch {
     116        if {   ![variant_isset quartz]
     117            && ![file exists "${prefix}/include/cairo/cairo-xlib.h"]} {
     118            ui_error "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
     119            ui_error "The active port \"cairo\" has been built without X11 support."
     120            ui_error "To build Poppler, use the \"+quartz\" variant."
     121            ui_error "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
     122            return -code error
     123        }
     124    }
     125
     126    depends_lib-append  port:cairo \
     127                        port:glib2 \
     128                        port:gettext \
     129                        port:libpixman \
     130                        port:jpeg \
     131                        port:libpng
     132                       
     133    if {![variant_isset quartz]} {
     134        depends_lib-append  port:gtk2 \
     135                            port:pango \
     136                            port:tiff
     137    }
     138}
     139
     140variant abiword description {rendering backend/output device, and pdftoabw command line utility} {
     141    depends_lib-append  port:libxml2
     142}
     143
     144if {   ![variant_isset qt3Splash]
     145    && ![variant_isset qt4Splash]
     146    && ![variant_isset glibSplash]
     147    && ![variant_isset glibCairo]
     148    && ![variant_isset abiword]
     149    && ![variant_isset quartz]} {
     150    default_variants +glibSplash +glibCairo +abiword
     151}
     152
     153# not testet:
     154#platform darwin 6 {
     155#    configure.env-append MACOSX_DEPLOYMENT_TARGET=10.2
     156#}
     157
     158# not testet:
     159#platform darwin 7 {
     160#    configure.env-append MACOSX_DEPLOYMENT_TARGET=10.3
     161#}
     162
     163platform darwin 8 {
     164    configure.env-append MACOSX_DEPLOYMENT_TARGET=10.4
     165}
     166
     167
     168pre-configure {
     169    setConfigureOptionsForMinimalInstallationOfSelectedPopplerVariant
     170}
     171
     172
     173# The following procedure has a lengthy body, but is simple in its purpose.
     174# Each poppler variant has a set of configure options which are necessary
     175# to get a minimal installation of poppler. If a combination of variants is
     176# selected, what is the united set of configure options?
     177# To get this set, the needed configure options of all selected poppler
     178# variants are accumulated. The same is done for the NOT needed configure options.
     179# The difference of the two accumulated sets is the set of configure options
     180# needed for a minimal installation of poppler.
     181
     182proc setConfigureOptionsForMinimalInstallationOfSelectedPopplerVariant {} {
     183    global prefix configure.args
     184
     185    set listOfConfigureOptions ${configure.args}
     186    set listOfConfigureOptionsToAppend {}
     187    set listOfConfigureOptionsToDelete {}
     188
     189    proc optionToAppend {option} {
     190        # accumulate all configure options to be included
     191        # of all selected poppler variants
     192        upvar  listOfConfigureOptionsToAppend listOfConfigureOptionsToAppend
     193        if {[lsearch -exact "$listOfConfigureOptionsToAppend" "$option"] == -1} then {
     194            lappend listOfConfigureOptionsToAppend "$option"
     195        }
     196    }
     197
     198    proc optionToDelete {option} {
     199        # accumulate all configure options to be excluded
     200        # of all selected poppler variants
     201        upvar  listOfConfigureOptionsToDelete listOfConfigureOptionsToDelete
     202        if {[lsearch -exact "$listOfConfigureOptionsToDelete" "$option"] == -1} then {
     203            lappend listOfConfigureOptionsToDelete "$option"
     204        }
     205    }
     206
     207    if {[variant_isset quartz]} then {
     208        optionToAppend {--disable-gtk-test}
     209        optionToAppend {--without-x}
     210    }
     211
     212    if {   [variant_isset qt3Splash]
     213        || [variant_isset qt4Splash]
     214        || [variant_isset glibSplash]
     215        || [variant_isset glibCairo]
     216        || [variant_isset abiword]} then {
     217        optionToAppend {--disable-cairo-output}
     218        optionToAppend {--disable-splash-output}
     219        optionToAppend {--disable-gdk}
     220        optionToAppend {--disable-poppler-glib}
     221        optionToAppend {--disable-poppler-qt}
     222        optionToAppend {--disable-poppler-qt4}
     223        optionToAppend {--disable-abiword-output}
     224        optionToAppend {--enable-xpdf-headers}
     225        optionToAppend {--enable-zlib}
     226        optionToAppend "--mandir=${prefix}/share/man"
     227    }
     228
     229    if {[variant_isset glibSplash]} then {
     230        optionToAppend {--disable-poppler-qt}
     231        optionToAppend {--disable-poppler-qt4}
     232        optionToDelete {--disable-poppler-glib}
     233        #------------------------------------
     234        optionToAppend {--disable-cairo-output}
     235        optionToAppend {--disable-abiword-output}
     236        optionToDelete {--disable-splash-output}
     237
     238        # GDK (GIMP Drawing Kit) is required by the GLib wrapper
     239        # when splash output device is enabled.
     240        optionToDelete {--disable-gdk}
     241    }
     242
     243    if {[variant_isset glibCairo]} then {
     244        optionToAppend {--disable-poppler-qt}
     245        optionToAppend {--disable-poppler-qt4}
     246        optionToDelete {--disable-poppler-glib}
     247        #--------------------------------------
     248        optionToAppend {--disable-splash-output}
     249        optionToAppend {--disable-gdk}
     250        optionToAppend {--disable-abiword-output}
     251        optionToDelete {--disable-cairo-output}
     252    }
     253
     254    if {[variant_isset qt3Splash]} then {
     255        optionToAppend {--disable-poppler-glib}
     256        optionToAppend {--disable-gdk}
     257        optionToAppend {--disable-poppler-qt4}
     258        optionToDelete {--disable-poppler-qt}
     259        #--------------------------------------
     260        optionToAppend {--disable-cairo-output}
     261        optionToAppend {--disable-abiword-output}
     262        optionToDelete {--disable-splash-output}
     263    }
     264
     265    if {[variant_isset qt4Splash]} then {
     266        optionToAppend {--disable-poppler-glib}
     267        optionToAppend {--disable-gdk}
     268        optionToAppend {--disable-poppler-qt}
     269        optionToDelete {--disable-poppler-qt4}
     270        #----------------------------------------
     271        optionToAppend {--disable-cairo-output}
     272        optionToAppend {--disable-abiword-output}
     273        optionToDelete {--disable-splash-output}
     274    }
     275
     276    if {[variant_isset abiword]} then {
     277        optionToAppend {--disable-splash-output}
     278        optionToAppend {--disable-gdk}
     279        optionToAppend {--disable-cairo-output}
     280        optionToDelete {--disable-abiword-output}
     281    }
     282
     283    ################################
     284    # balance of configure options #
     285    ################################
     286
     287    foreach option $listOfConfigureOptionsToAppend {
     288        if {[lsearch -exact "$listOfConfigureOptions" "$option"] == -1} then {
     289            lappend listOfConfigureOptions "$option"
     290            configure.args-append "$option"
     291        }
     292    }
     293
     294    foreach option $listOfConfigureOptionsToDelete {
     295        set i [lsearch -exact "$listOfConfigureOptions" "$option"]
     296        if {$i > -1} then {
     297            set listOfConfigureOptions [lreplace $listOfConfigureOptions $i $i]
     298            configure.args-delete "$option"
     299        }
     300    }
     301
     302    ui_debug "+++++++++++++++++++++++++++++++++++"
     303    ui_debug "configure options:"
     304    ui_debug "${configure.args}"
     305    ui_debug "+++++++++++++++++++++++++++++++++++"
     306}
     307
    78308
     309# SOME NOTES TO "gtk test" (see variant "quartz"):
     310#
     311# After build of poppler the directory ${worksrcpath}/test
     312# contains five shell scripts:
     313#
     314# (1) gtk-cairo-test
     315# (2) gtk-splash-test
     316# (3) pdf_inspector
     317# (4) pdf-fullrewrite
     318# (5) perf-test
     319#
     320# These shell scripts are wrapper scripts for the identically
     321# named binaries contained in the directory "test/.libs".
     322#
     323# The first three scripts can only be launched on the command line
     324# in a window of the X Window system.
     325#
     326# Usage (change the current directory to ${worksrcpath}/test):
     327#
     328#$ ./gtk-cairo-test PDF-FILES...  (opens each pdf file in a window)
     329#
     330#$ ./gtk-splash-test PDF-FILES... (opens each pdf file in a window)
     331#
     332#$ ./pdf_inspector  (no arguments, it opens a dialog window)
     333#
     334#$ ./pdf-fullrewrite INPUT-FILE OUTPUT-FILE
     335#
     336#$ ./perf-test [-preview|-slowpreview] [-loadonly] [-timings] [-text]
     337#              [-resolution NxM] [-recursive] [-page N] [-out out.txt] PDF-FILES...
     338#
     339# ("perf-test" is a tool to stress-test poppler rendering and measure
     340# rendering times for very simplistic performance measuring.)
     341#
     342# The wrapper scripts should never be moved out of the build directory,
     343# otherwise they will not operate correctly.
     344# Therefore it is not possible to install them in the directory ${prefix}/bin
     345#
     346# To use them, you must keep the work directory ( sudo port -k install poppler )
     347
     348ui_debug "+++++++++++++++++++++++++++++++++++"
     349ui_debug "port dependencies:"
     350ui_debug "$depends_lib"
     351ui_debug "+++++++++++++++++++++++++++++++++++"