41 | | test.run yes |
42 | | test.dir ${worksrcpath}/test |
43 | | test.target all |
| 62 | variant qt4 { |
| 63 | configure.args-delete --disable-poppler-qt4 |
| 64 | depends_lib-append port:qt4-mac |
| 65 | } |
| 66 | |
| 67 | pre-fetch { |
| 68 | # variant "quartz" is only necessary if your active port "cairo" |
| 69 | # has been build without "X Window" support (variant "no_x11") |
| 70 | # (in addition: port "pango" and port "gtk2" build without x11) |
| 71 | |
| 72 | set A [variant_isset qt3Splash] |
| 73 | set B [variant_isset qt4Splash] |
| 74 | set C [variant_isset glibSplash] |
| 75 | set D [variant_isset glibCairo] |
| 76 | set E [variant_isset abiword] |
| 77 | set F [variant_isset quartz] |
| 78 | set popplerWithoutVariants [expr !$A && !$B && !$C && !$D && !$E && !$F] |
| 79 | |
| 80 | if { $popplerWithoutVariants || ($D && !$F) } then { |
| 81 | if {![cairoWithX11]} then { |
| 82 | ui_error "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" |
| 83 | ui_error "The active port \"cairo\" has been build without x11 support." |
| 84 | ui_error "To build Poppler, select variant \"quartz\"" |
| 85 | ui_error "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" |
| 86 | return -code 1 |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | # Variant "qt4" completes the maximal installation of poppler. |
| 91 | # This variant cannot be used together with any of the variants |
| 92 | # "qt3Splash", "qt4Splash", "glibSplash", "glibCairo", and "abiword". |
| 93 | # These variants are each for a minimal installation of poppler. |
| 94 | |
| 95 | if { [variant_isset qt4] && ($A || $B || $C || $D || $E) } then { |
| 96 | ui_error "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" |
| 97 | ui_error "variant \"qt4\" cannot be used together with any of the variants" |
| 98 | ui_error "\"qt3Splash\", \"qt4Splash\", \"glibSplash\", \"glibCairo\", and \"abiword\"" |
| 99 | ui_error "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" |
| 100 | return -code 1 |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | # The following variants are for minimal installation of Poppler |
| 108 | # and minimal port dependencies. |
| 109 | # |
| 110 | # Poppler with variants +glibSplash +glibCairo +abiword (+qt3Splash) |
| 111 | # is the same as Poppler without any variant. |
| 112 | # If you do not have port "qt3-mac" installed, poppler gets automatically |
| 113 | # configured without Qt3 bindings. |
| 114 | |
| 115 | variant qt3Splash description {Qt3 bindings to poppler & Splash output device} { |
| 116 | } |
| 117 | |
| 118 | variant qt4Splash description {Qt4 bindings to poppler & Splash output device} { |
| 119 | } |
| 120 | |
| 121 | #variant qt4Arthur description {Qt4 bindings to poppler & Arthur output device (Qt4 Paint System)} { |
| 122 | #} |
| 123 | |
| 124 | # There is no source code for a variant Qt4Cairo (what about Qt3 ?) |
| 125 | |
| 126 | variant glibSplash description {GLib bindings to poppler & Splash output device} { |
| 127 | } |
| 128 | |
| 129 | variant glibCairo description {GLib bindings to poppler & Cairo output device} { |
| 130 | } |
| 131 | |
| 132 | variant abiword description {rendering backend/output device, and pdftoabw command line utility} { |
| 133 | } |
| 134 | |
| 135 | |
| 136 | # not testet: |
| 137 | #platform darwin 6 { |
| 138 | # configure.env-append MACOSX_DEPLOYMENT_TARGET=10.2 |
| 139 | #} |
| 140 | |
| 141 | # not testet: |
| 142 | #platform darwin 7 { |
| 143 | # configure.env-append MACOSX_DEPLOYMENT_TARGET=10.3 |
| 144 | #} |
| 145 | |
| 146 | platform darwin 8 { |
| 147 | configure.env-append MACOSX_DEPLOYMENT_TARGET=10.4 |
| 148 | } |
| 149 | |
| 150 | platform darwin 9 { |
| 151 | configure.env-append MACOSX_DEPLOYMENT_TARGET=10.5 |
| 152 | } |
| 153 | |
| 154 | |
| 155 | pre-configure { |
| 156 | setConfigureOptionsForMinimalInstallationOfSelectedPopplerVariant |
| 157 | setListOfPortDependenciesOfSelectedPopplerVariant |
| 158 | } |
| 159 | |
| 160 | |
| 161 | # The following procedure has a lengthy body, but is simple in its purpose. |
| 162 | # Each poppler variant has a set of configure options which are necessary |
| 163 | # to get a minimal installation of poppler. If a combination of variants is |
| 164 | # selected, what is the united set of configure options? |
| 165 | # To get this set, the needed configure options of all selected poppler |
| 166 | # variants are accumulated. The same is done for the NOT needed configure options. |
| 167 | # The difference of the two accumulated sets is the set of configure options |
| 168 | # needed for a minimal installation of poppler. |
| 169 | |
| 170 | proc setConfigureOptionsForMinimalInstallationOfSelectedPopplerVariant {} { |
| 171 | global prefix configure.args |
| 172 | |
| 173 | set listOfConfigureOptions ${configure.args} |
| 174 | set listOfConfigureOptionsToAppend {} |
| 175 | set listOfConfigureOptionsToDelete {} |
| 176 | |
| 177 | proc optionToAppend {option} { |
| 178 | # accumulate all configure options to be included |
| 179 | # of all selected poppler variants |
| 180 | upvar listOfConfigureOptionsToAppend listOfConfigureOptionsToAppend |
| 181 | if {[lsearch -exact "$listOfConfigureOptionsToAppend" "$option"] == -1} then { |
| 182 | lappend listOfConfigureOptionsToAppend "$option" |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | proc optionToDelete {option} { |
| 187 | # accumulate all configure options to be excluded |
| 188 | # of all selected poppler variants |
| 189 | upvar listOfConfigureOptionsToDelete listOfConfigureOptionsToDelete |
| 190 | if {[lsearch -exact "$listOfConfigureOptionsToDelete" "$option"] == -1} then { |
| 191 | lappend listOfConfigureOptionsToDelete "$option" |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | if {[variant_isset quartz]} then { |
| 196 | optionToAppend {--disable-gtk-test} |
| 197 | optionToAppend {--without-x} |
| 198 | } |
| 199 | |
| 200 | if { [variant_isset qt3Splash] |
| 201 | || [variant_isset qt4Splash] |
| 202 | || [variant_isset glibSplash] |
| 203 | || [variant_isset glibCairo] |
| 204 | || [variant_isset abiword]} then { |
| 205 | optionToAppend {--disable-cairo-output} |
| 206 | optionToAppend {--disable-splash-output} |
| 207 | optionToAppend {--disable-gdk} |
| 208 | optionToAppend {--disable-poppler-glib} |
| 209 | optionToAppend {--disable-poppler-qt} |
| 210 | optionToAppend {--disable-poppler-qt4} |
| 211 | optionToAppend {--disable-abiword-output} |
| 212 | optionToAppend {--enable-xpdf-headers} |
| 213 | optionToAppend {--enable-zlib} |
| 214 | optionToAppend "--mandir=${prefix}/share/man" |
| 215 | } |
| 216 | |
| 217 | if {[variant_isset glibSplash]} then { |
| 218 | optionToAppend {--disable-poppler-qt} |
| 219 | optionToAppend {--disable-poppler-qt4} |
| 220 | optionToDelete {--disable-poppler-glib} |
| 221 | #------------------------------------ |
| 222 | optionToAppend {--disable-cairo-output} |
| 223 | optionToAppend {--disable-abiword-output} |
| 224 | optionToDelete {--disable-splash-output} |
| 225 | |
| 226 | # GDK (GIMP Drawing Kit) is required by the GLib wrapper |
| 227 | # when splash output device is enabled. |
| 228 | optionToDelete {--disable-gdk} |
| 229 | } |
| 230 | |
| 231 | if {[variant_isset glibCairo]} then { |
| 232 | optionToAppend {--disable-poppler-qt} |
| 233 | optionToAppend {--disable-poppler-qt4} |
| 234 | optionToDelete {--disable-poppler-glib} |
| 235 | #-------------------------------------- |
| 236 | optionToAppend {--disable-splash-output} |
| 237 | optionToAppend {--disable-gdk} |
| 238 | optionToAppend {--disable-abiword-output} |
| 239 | optionToDelete {--disable-cairo-output} |
| 240 | } |
| 241 | |
| 242 | if {[variant_isset qt3Splash]} then { |
| 243 | optionToAppend {--disable-poppler-glib} |
| 244 | optionToAppend {--disable-gdk} |
| 245 | optionToAppend {--disable-poppler-qt4} |
| 246 | optionToDelete {--disable-poppler-qt} |
| 247 | #-------------------------------------- |
| 248 | optionToAppend {--disable-cairo-output} |
| 249 | optionToAppend {--disable-abiword-output} |
| 250 | optionToDelete {--disable-splash-output} |
| 251 | } |
| 252 | |
| 253 | if {[variant_isset qt4Splash]} then { |
| 254 | optionToAppend {--disable-poppler-glib} |
| 255 | optionToAppend {--disable-gdk} |
| 256 | optionToAppend {--disable-poppler-qt} |
| 257 | optionToDelete {--disable-poppler-qt4} |
| 258 | #---------------------------------------- |
| 259 | optionToAppend {--disable-cairo-output} |
| 260 | optionToAppend {--disable-abiword-output} |
| 261 | optionToDelete {--disable-splash-output} |
| 262 | } |
| 263 | |
| 264 | if {[variant_isset abiword]} then { |
| 265 | optionToAppend {--disable-splash-output} |
| 266 | optionToAppend {--disable-gdk} |
| 267 | optionToAppend {--disable-cairo-output} |
| 268 | optionToDelete {--disable-abiword-output} |
| 269 | } |
| 270 | |
| 271 | ################################ |
| 272 | # balance of configure options # |
| 273 | ################################ |
| 274 | |
| 275 | foreach option $listOfConfigureOptionsToAppend { |
| 276 | if {[lsearch -exact "$listOfConfigureOptions" "$option"] == -1} then { |
| 277 | lappend listOfConfigureOptions "$option" |
| 278 | configure.args-append "$option" |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | foreach option $listOfConfigureOptionsToDelete { |
| 283 | set i [lsearch -exact "$listOfConfigureOptions" "$option"] |
| 284 | if {$i > -1} then { |
| 285 | set listOfConfigureOptions [lreplace $listOfConfigureOptions $i $i] |
| 286 | configure.args-delete "$option" |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | ui_debug "+++++++++++++++++++++++++++++++++++" |
| 291 | ui_debug "configure options:" |
| 292 | ui_debug "${configure.args}" |
| 293 | ui_debug "+++++++++++++++++++++++++++++++++++" |
| 294 | } |
| 295 | |
| 296 | |
| 297 | proc cairoWithX11 {} { |
| 298 | global prefix |
| 299 | set ret 1 |
| 300 | if {[file exists "${prefix}/include/cairo/cairo.h"]} then { |
| 301 | if {![file exists "${prefix}/include/cairo/cairo-xlib.h"]} then { |
| 302 | set ret 0 |
| 303 | } |
| 304 | } else { |
| 305 | ui_error "++++++++++++++++++++++++++++++++++++++++++" |
| 306 | ui_error "port \"cairo\" is not installed or activated" |
| 307 | ui_error "++++++++++++++++++++++++++++++++++++++++++" |
| 308 | return -code 1 |
| 309 | } |
| 310 | |
| 311 | return $ret |
| 312 | } |
| 313 | |
| 314 | |
| 315 | # Poppler without any variant has a maximum of dependencies to other ports. |
| 316 | # But variant "qt4Splash" is neither dependent on port "XFree86" nor on "gtk2". |
| 317 | # To get the list of needed port dependencies, the following procedure |
| 318 | # accumulates the needed port dependencies of all selected poppler variants. |
| 319 | |
| 320 | proc setListOfPortDependenciesOfSelectedPopplerVariant {} { |
| 321 | global prefix depends_lib |
| 322 | |
| 323 | set listOfPortDependenciesToAppend {} |
| 324 | |
| 325 | proc dependencyToAppend {entry} { |
| 326 | # accumulate all port dependencies to be included |
| 327 | # of all selected poppler variants |
| 328 | upvar listOfPortDependenciesToAppend listOfPortDependenciesToAppend |
| 329 | if {[lsearch -exact "$listOfPortDependenciesToAppend" "$entry"] == -1} then { |
| 330 | lappend listOfPortDependenciesToAppend "$entry" |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | if { [variant_isset abiword] |
| 335 | || [variant_isset qt4Splash] |
| 336 | || [variant_isset glibCairo] |
| 337 | || [variant_isset glibSplash]} then { |
| 338 | |
| 339 | foreach item $depends_lib { |
| 340 | depends_lib-delete $item |
| 341 | } |
| 342 | |
| 343 | dependencyToAppend {port:freetype} |
| 344 | dependencyToAppend {port:fontconfig} |
| 345 | dependencyToAppend {port:expat} |
| 346 | dependencyToAppend {port:libiconv} |
| 347 | dependencyToAppend {port:zlib} |
| 348 | dependencyToAppend {port:poppler-data} |
| 349 | } |
| 350 | |
| 351 | if {[variant_isset abiword]} then { |
| 352 | dependencyToAppend {port:libxml2} |
| 353 | } |
| 354 | |
| 355 | if {[variant_isset qt3Splash]} then { |
| 356 | dependencyToAppend {port:qt3-mac} |
| 357 | dependencyToAppend {port:jpeg} |
| 358 | dependencyToAppend {port:libpng} |
| 359 | } |
| 360 | |
| 361 | if {[variant_isset qt4Splash]} then { |
| 362 | dependencyToAppend {port:qt4-mac} |
| 363 | dependencyToAppend {port:jpeg} |
| 364 | dependencyToAppend {port:libpng} |
| 365 | } |
| 366 | |
| 367 | if { [variant_isset glibCairo] |
| 368 | && [variant_isset quartz]} then { |
| 369 | dependencyToAppend {port:cairo} |
| 370 | dependencyToAppend {port:glib2} |
| 371 | dependencyToAppend {port:gettext} |
| 372 | dependencyToAppend {port:libpixman} |
| 373 | dependencyToAppend {port:jpeg} |
| 374 | dependencyToAppend {port:libpng} |
| 375 | # no dependency on XFree86 and xrender |
| 376 | # no dependency on gtk2, pango, and tiff |
| 377 | } |
| 378 | |
| 379 | if { [variant_isset glibSplash] |
| 380 | && [variant_isset quartz]} then { |
| 381 | dependencyToAppend {port:gtk2} |
| 382 | dependencyToAppend {port:glib2} |
| 383 | dependencyToAppend {port:gettext} |
| 384 | dependencyToAppend {port:libpixman} |
| 385 | dependencyToAppend {port:jpeg} |
| 386 | dependencyToAppend {port:libpng} |
| 387 | |
| 388 | # GDK (GIMP Drawing Kit) is required by the GLib wrapper |
| 389 | # when splash output device is enabled. |
| 390 | # GDK (part of GTK) depends on Pango, Pango depends on Cairo. |
| 391 | dependencyToAppend {port:pango} |
| 392 | dependencyToAppend {port:cairo} |
| 393 | |
| 394 | dependencyToAppend {port:tiff} |
| 395 | # no dependency on XFree86 and xrender |
| 396 | } |
| 397 | |
| 398 | if { [variant_isset glibCairo] |
| 399 | || [variant_isset glibSplash]} then { |
| 400 | dependencyToAppend {port:XFree86} |
| 401 | dependencyToAppend {port:xrender} |
| 402 | dependencyToAppend {port:gtk2} |
| 403 | dependencyToAppend {port:glib2} |
| 404 | dependencyToAppend {port:gettext} |
| 405 | dependencyToAppend {port:libpixman} |
| 406 | dependencyToAppend {port:jpeg} |
| 407 | dependencyToAppend {port:libpng} |
| 408 | dependencyToAppend {port:cairo} |
| 409 | dependencyToAppend {port:pango} |
| 410 | dependencyToAppend {port:tiff} |
| 411 | } |
| 412 | |
| 413 | foreach entry $listOfPortDependenciesToAppend { |
| 414 | depends_lib-append $entry |
| 415 | } |
| 416 | |
| 417 | ui_debug "+++++++++++++++++++++++++++++++++++" |
| 418 | ui_debug "port dependencies:" |
| 419 | ui_debug "$depends_lib" |
| 420 | ui_debug "+++++++++++++++++++++++++++++++++++" |
| 421 | } |
| 422 | |
| 423 | # SOME NOTES TO "gtk test" (see variant "quartz"): |
| 424 | # |
| 425 | # After build of poppler the directory ${worksrcpath}/test |
| 426 | # contains five shell scripts: |
| 427 | # |
| 428 | # (1) gtk-cairo-test |
| 429 | # (2) gtk-splash-test |
| 430 | # (3) pdf_inspector |
| 431 | # (4) pdf-fullrewrite |
| 432 | # (5) perf-test |
| 433 | # |
| 434 | # These shell scripts are wrapper scripts for the identically |
| 435 | # named binaries contained in the directory "test/.libs". |
| 436 | # |
| 437 | # The first three scripts can only be launched on the command line |
| 438 | # in a window of the X Window system. |
| 439 | # |
| 440 | # Usage (change the current directory to ${worksrcpath}/test): |
| 441 | # |
| 442 | #$ ./gtk-cairo-test PDF-FILES... (opens each pdf file in a window) |
| 443 | # |
| 444 | #$ ./gtk-splash-test PDF-FILES... (opens each pdf file in a window) |
| 445 | # |
| 446 | #$ ./pdf_inspector (no arguments, it opens a dialog window) |
| 447 | # |
| 448 | #$ ./pdf-fullrewrite INPUT-FILE OUTPUT-FILE |
| 449 | # |
| 450 | #$ ./perf-test [-preview|-slowpreview] [-loadonly] [-timings] [-text] |
| 451 | # [-resolution NxM] [-recursive] [-page N] [-out out.txt] PDF-FILES... |
| 452 | # |
| 453 | # ("perf-test" is a tool to stress-test poppler rendering and measure |
| 454 | # rendering times for very simplistic performance measuring.) |
| 455 | # |
| 456 | # The wrapper scripts should never be moved out of the build directory, |
| 457 | # otherwise they will not operate correctly. |
| 458 | # Therefore it is not possible to install them in the directory ${prefix}/bin |
| 459 | # |
| 460 | # To use them, you must keep the work directory ( sudo port -k install poppler ) |
| 461 | |