cairo 1.6.1-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cairo might be problematic. Click here for more details.
- data/AUTHORS +4 -0
- data/COPYING +59 -0
- data/ChangeLog +1320 -0
- data/GPL +340 -0
- data/NEWS +98 -0
- data/README +70 -0
- data/Rakefile +215 -0
- data/cairo/bin/libcairo-2.dll +0 -0
- data/cairo/bin/libpng13.dll +0 -0
- data/cairo/bin/zlib1.dll +0 -0
- data/cairo/include/cairo/cairo-deprecated.h +142 -0
- data/cairo/include/cairo/cairo-features.h +35 -0
- data/cairo/include/cairo/cairo-pdf.h +68 -0
- data/cairo/include/cairo/cairo-ps.h +114 -0
- data/cairo/include/cairo/cairo-svg.h +82 -0
- data/cairo/include/cairo/cairo-win32.h +104 -0
- data/cairo/include/cairo/cairo.h +1945 -0
- data/cairo/include/libpng13/png.h +3419 -0
- data/cairo/include/libpng13/pngconf.h +1437 -0
- data/cairo/lib/cairo.def +251 -0
- data/cairo/lib/cairo.lib +0 -0
- data/cairo/lib/libcairo.dll.a +0 -0
- data/cairo/lib/libpng.def +372 -0
- data/cairo/lib/libpng13.dll.a +0 -0
- data/cairo/lib/pkgconfig/cairo-pdf.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-png.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-ps.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-svg.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-win32-font.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-win32.pc +12 -0
- data/cairo/lib/pkgconfig/cairo.pc +13 -0
- data/cairo/lib/pkgconfig/libpng.pc +14 -0
- data/cairo/lib/pkgconfig/libpng13.pc +14 -0
- data/cairo/make/cairo-1.6.4-1.sh +55 -0
- data/cairo/manifest/cairo-1.6.4-1.mft +6 -0
- data/cairo/manifest/cairo-dev-1.6.4-1.mft +72 -0
- data/cairo/manifest/libpng-dev-1.2.8.mft +7 -0
- data/cairo/share/doc/cairo-1.6.4-1/COPYING +32 -0
- data/cairo/share/doc/cairo-1.6.4-1/COPYING-LGPL-2.1 +510 -0
- data/cairo/share/doc/cairo-1.6.4-1/COPYING-MPL-1.1 +470 -0
- data/cairo/share/gtk-doc/html/cairo/Drawing.html +53 -0
- data/cairo/share/gtk-doc/html/cairo/Fonts.html +56 -0
- data/cairo/share/gtk-doc/html/cairo/Support.html +50 -0
- data/cairo/share/gtk-doc/html/cairo/Surfaces.html +65 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-errors.html +128 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-fonts.html +59 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-memory.html +129 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-overloading.html +127 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-path.html +123 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-patterns.html +63 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-return-values.html +126 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-streams.html +98 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-surfaces.html +99 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Error-Handling.html +328 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Font-Options.html +720 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-FreeType-Fonts.html +297 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html +484 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-PDF-Surfaces.html +246 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-PNG-Support.html +345 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Paths.html +1336 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Patterns.html +1560 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-PostScript-Surfaces.html +656 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Quartz-Fonts.html +161 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Quartz-Surfaces.html +232 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-SVG-Surfaces.html +337 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Scaled-Fonts.html +823 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Text.html +836 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Transformations.html +462 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Types.html +143 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Version-Information.html +325 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Win32-Fonts.html +381 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Win32-Surfaces.html +331 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-XLib-Surfaces.html +525 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-font-face-t.html +427 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-matrix-t.html +626 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html +995 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-t.html +2795 -0
- data/cairo/share/gtk-doc/html/cairo/cairo.devhelp +432 -0
- data/cairo/share/gtk-doc/html/cairo/cairo.devhelp2 +432 -0
- data/cairo/share/gtk-doc/html/cairo/home.png +0 -0
- data/cairo/share/gtk-doc/html/cairo/index-1.2.html +137 -0
- data/cairo/share/gtk-doc/html/cairo/index-1.4.html +105 -0
- data/cairo/share/gtk-doc/html/cairo/index-1.6.html +65 -0
- data/cairo/share/gtk-doc/html/cairo/index.html +134 -0
- data/cairo/share/gtk-doc/html/cairo/index.sgml +466 -0
- data/cairo/share/gtk-doc/html/cairo/ix01.html +693 -0
- data/cairo/share/gtk-doc/html/cairo/language-bindings.html +79 -0
- data/cairo/share/gtk-doc/html/cairo/left.png +0 -0
- data/cairo/share/gtk-doc/html/cairo/right.png +0 -0
- data/cairo/share/gtk-doc/html/cairo/style.css +148 -0
- data/cairo/share/gtk-doc/html/cairo/up.png +0 -0
- data/doc/doc.css +91 -0
- data/doc/en/cairo-antialias.html +41 -0
- data/doc/en/cairo-antialias.rd +16 -0
- data/doc/en/cairo-clip-not-representable-error.html +50 -0
- data/doc/en/cairo-clip-not-representable-error.rd +17 -0
- data/doc/en/cairo-color-base.html +72 -0
- data/doc/en/cairo-color-base.rd +38 -0
- data/doc/en/cairo-color-cmyk.html +160 -0
- data/doc/en/cairo-color-cmyk.rd +107 -0
- data/doc/en/cairo-color-hsv.html +140 -0
- data/doc/en/cairo-color-hsv.rd +91 -0
- data/doc/en/cairo-color-rgb.html +145 -0
- data/doc/en/cairo-color-rgb.rd +95 -0
- data/doc/en/cairo-color-x11.html +176 -0
- data/doc/en/cairo-color-x11.rd +151 -0
- data/doc/en/cairo-color.html +241 -0
- data/doc/en/cairo-color.rd +213 -0
- data/doc/en/cairo-content.html +40 -0
- data/doc/en/cairo-content.rd +15 -0
- data/doc/en/cairo-context-blur.html +42 -0
- data/doc/en/cairo-context-blur.rd +15 -0
- data/doc/en/cairo-context-circle.html +42 -0
- data/doc/en/cairo-context-circle.rd +15 -0
- data/doc/en/cairo-context-color.html +42 -0
- data/doc/en/cairo-context-color.rd +15 -0
- data/doc/en/cairo-context-path.html +47 -0
- data/doc/en/cairo-context-path.rd +19 -0
- data/doc/en/cairo-context-rectangle.html +42 -0
- data/doc/en/cairo-context-rectangle.rd +15 -0
- data/doc/en/cairo-context-triangle.html +42 -0
- data/doc/en/cairo-context-triangle.rd +15 -0
- data/doc/en/cairo-context.html +636 -0
- data/doc/en/cairo-context.rd +491 -0
- data/doc/en/cairo-error.html +47 -0
- data/doc/en/cairo-error.rd +16 -0
- data/doc/en/cairo-extend.html +41 -0
- data/doc/en/cairo-extend.rd +16 -0
- data/doc/en/cairo-file-not-found.html +50 -0
- data/doc/en/cairo-file-not-found.rd +17 -0
- data/doc/en/cairo-fill-rule.html +39 -0
- data/doc/en/cairo-fill-rule.rd +14 -0
- data/doc/en/cairo-filter.html +43 -0
- data/doc/en/cairo-filter.rd +18 -0
- data/doc/en/cairo-font-extents.html +74 -0
- data/doc/en/cairo-font-extents.rd +40 -0
- data/doc/en/cairo-font-face.html +41 -0
- data/doc/en/cairo-font-face.rd +14 -0
- data/doc/en/cairo-font-options.html +142 -0
- data/doc/en/cairo-font-options.rd +94 -0
- data/doc/en/cairo-font-slant.html +40 -0
- data/doc/en/cairo-font-slant.rd +15 -0
- data/doc/en/cairo-font-weight.html +39 -0
- data/doc/en/cairo-font-weight.rd +14 -0
- data/doc/en/cairo-format.html +49 -0
- data/doc/en/cairo-format.rd +22 -0
- data/doc/en/cairo-glyph.html +102 -0
- data/doc/en/cairo-glyph.rd +62 -0
- data/doc/en/cairo-gradient-pattern.html +77 -0
- data/doc/en/cairo-gradient-pattern.rd +41 -0
- data/doc/en/cairo-hint-metrics.html +40 -0
- data/doc/en/cairo-hint-metrics.rd +15 -0
- data/doc/en/cairo-hint-style.html +42 -0
- data/doc/en/cairo-hint-style.rd +17 -0
- data/doc/en/cairo-image-surface.html +85 -0
- data/doc/en/cairo-image-surface.rd +47 -0
- data/doc/en/cairo-invalid-content-error.html +50 -0
- data/doc/en/cairo-invalid-content-error.rd +17 -0
- data/doc/en/cairo-invalid-dash-error.html +50 -0
- data/doc/en/cairo-invalid-dash-error.rd +17 -0
- data/doc/en/cairo-invalid-dsc-comment-error.html +50 -0
- data/doc/en/cairo-invalid-dsc-comment-error.rd +17 -0
- data/doc/en/cairo-invalid-format-error.html +50 -0
- data/doc/en/cairo-invalid-format-error.rd +17 -0
- data/doc/en/cairo-invalid-index-error.html +50 -0
- data/doc/en/cairo-invalid-index-error.rd +17 -0
- data/doc/en/cairo-invalid-matrix-error.html +50 -0
- data/doc/en/cairo-invalid-matrix-error.rd +17 -0
- data/doc/en/cairo-invalid-path-data-error.html +50 -0
- data/doc/en/cairo-invalid-path-data-error.rd +17 -0
- data/doc/en/cairo-invalid-pop-group-error.html +50 -0
- data/doc/en/cairo-invalid-pop-group-error.rd +17 -0
- data/doc/en/cairo-invalid-restore-error.html +50 -0
- data/doc/en/cairo-invalid-restore-error.rd +17 -0
- data/doc/en/cairo-invalid-status-error.html +50 -0
- data/doc/en/cairo-invalid-status-error.rd +17 -0
- data/doc/en/cairo-invalid-stride-error.html +50 -0
- data/doc/en/cairo-invalid-stride-error.rd +17 -0
- data/doc/en/cairo-invalid-string-error.html +50 -0
- data/doc/en/cairo-invalid-string-error.rd +17 -0
- data/doc/en/cairo-invalid-visual-error.html +50 -0
- data/doc/en/cairo-invalid-visual-error.rd +17 -0
- data/doc/en/cairo-line-cap.html +40 -0
- data/doc/en/cairo-line-cap.rd +15 -0
- data/doc/en/cairo-line-join.html +40 -0
- data/doc/en/cairo-line-join.rd +15 -0
- data/doc/en/cairo-linear-pattern.html +63 -0
- data/doc/en/cairo-linear-pattern.rd +28 -0
- data/doc/en/cairo-matrix.html +257 -0
- data/doc/en/cairo-matrix.rd +186 -0
- data/doc/en/cairo-no-current-point-error.html +50 -0
- data/doc/en/cairo-no-current-point-error.rd +17 -0
- data/doc/en/cairo-null-pointer-error.html +50 -0
- data/doc/en/cairo-null-pointer-error.rd +17 -0
- data/doc/en/cairo-operator.html +51 -0
- data/doc/en/cairo-operator.rd +26 -0
- data/doc/en/cairo-paper-parse-error.html +50 -0
- data/doc/en/cairo-paper-parse-error.rd +17 -0
- data/doc/en/cairo-paper-unknown-paper-name.html +69 -0
- data/doc/en/cairo-paper-unknown-paper-name.rd +30 -0
- data/doc/en/cairo-paper-unknown-unit.html +69 -0
- data/doc/en/cairo-paper-unknown-unit.rd +30 -0
- data/doc/en/cairo-paper-unrecognized-paper-description.html +69 -0
- data/doc/en/cairo-paper-unrecognized-paper-description.rd +30 -0
- data/doc/en/cairo-paper.html +187 -0
- data/doc/en/cairo-paper.rd +141 -0
- data/doc/en/cairo-path-close-path.html +52 -0
- data/doc/en/cairo-path-close-path.rd +21 -0
- data/doc/en/cairo-path-curve-to.html +52 -0
- data/doc/en/cairo-path-curve-to.rd +21 -0
- data/doc/en/cairo-path-data-type.html +41 -0
- data/doc/en/cairo-path-data-type.rd +16 -0
- data/doc/en/cairo-path-data.html +101 -0
- data/doc/en/cairo-path-data.rd +62 -0
- data/doc/en/cairo-path-line-to.html +52 -0
- data/doc/en/cairo-path-line-to.rd +21 -0
- data/doc/en/cairo-path-move-to.html +52 -0
- data/doc/en/cairo-path-move-to.rd +21 -0
- data/doc/en/cairo-path.html +158 -0
- data/doc/en/cairo-path.rd +109 -0
- data/doc/en/cairo-pattern-type-mismatch-error.html +50 -0
- data/doc/en/cairo-pattern-type-mismatch-error.rd +17 -0
- data/doc/en/cairo-pattern.html +102 -0
- data/doc/en/cairo-pattern.rd +62 -0
- data/doc/en/cairo-pdf-surface.html +60 -0
- data/doc/en/cairo-pdf-surface.rd +27 -0
- data/doc/en/cairo-point.html +77 -0
- data/doc/en/cairo-point.rd +42 -0
- data/doc/en/cairo-ps-level.html +52 -0
- data/doc/en/cairo-ps-level.rd +24 -0
- data/doc/en/cairo-ps-surface.html +95 -0
- data/doc/en/cairo-ps-surface.rd +55 -0
- data/doc/en/cairo-quartz-image-surface.html +60 -0
- data/doc/en/cairo-quartz-image-surface.rd +27 -0
- data/doc/en/cairo-quartz-surface.html +60 -0
- data/doc/en/cairo-quartz-surface.rd +27 -0
- data/doc/en/cairo-radial-pattern.html +63 -0
- data/doc/en/cairo-radial-pattern.rd +28 -0
- data/doc/en/cairo-read-error.html +50 -0
- data/doc/en/cairo-read-error.rd +17 -0
- data/doc/en/cairo-rectangle.html +92 -0
- data/doc/en/cairo-rectangle.rd +54 -0
- data/doc/en/cairo-scaled-font.html +87 -0
- data/doc/en/cairo-scaled-font.rd +50 -0
- data/doc/en/cairo-solid-pattern.html +65 -0
- data/doc/en/cairo-solid-pattern.rd +31 -0
- data/doc/en/cairo-subpixel-order.html +42 -0
- data/doc/en/cairo-subpixel-order.rd +17 -0
- data/doc/en/cairo-surface-finished-error.html +50 -0
- data/doc/en/cairo-surface-finished-error.rd +17 -0
- data/doc/en/cairo-surface-pattern.html +60 -0
- data/doc/en/cairo-surface-pattern.rd +27 -0
- data/doc/en/cairo-surface-type-mismatch-error.html +50 -0
- data/doc/en/cairo-surface-type-mismatch-error.rd +17 -0
- data/doc/en/cairo-surface.html +114 -0
- data/doc/en/cairo-surface.rd +72 -0
- data/doc/en/cairo-svg-surface.html +80 -0
- data/doc/en/cairo-svg-surface.rd +44 -0
- data/doc/en/cairo-svg-version.html +52 -0
- data/doc/en/cairo-svg-version.rd +24 -0
- data/doc/en/cairo-temp-file-error.html +50 -0
- data/doc/en/cairo-temp-file-error.rd +17 -0
- data/doc/en/cairo-text-extents.html +79 -0
- data/doc/en/cairo-text-extents.rd +44 -0
- data/doc/en/cairo-win32-printing-surface.html +60 -0
- data/doc/en/cairo-win32-printing-surface.rd +27 -0
- data/doc/en/cairo-win32-surface.html +65 -0
- data/doc/en/cairo-win32-surface.rd +31 -0
- data/doc/en/cairo-write-error.html +50 -0
- data/doc/en/cairo-write-error.rd +17 -0
- data/doc/en/cairo.html +123 -0
- data/doc/en/cairo.rd +95 -0
- data/doc/en/index.html +1080 -0
- data/doc/en/index.rd +1051 -0
- data/doc/index.html +18 -0
- data/doc/ja/cairo-antialias.html +57 -0
- data/doc/ja/cairo-clip-not-representable-error.html +56 -0
- data/doc/ja/cairo-color-base.html +75 -0
- data/doc/ja/cairo-color-cmyk.html +152 -0
- data/doc/ja/cairo-color-hsv.html +135 -0
- data/doc/ja/cairo-color-rgb.html +145 -0
- data/doc/ja/cairo-color-x11.html +183 -0
- data/doc/ja/cairo-color.html +317 -0
- data/doc/ja/cairo-content.html +51 -0
- data/doc/ja/cairo-context-blur.html +53 -0
- data/doc/ja/cairo-context-circle.html +54 -0
- data/doc/ja/cairo-context-color.html +52 -0
- data/doc/ja/cairo-context-path.html +77 -0
- data/doc/ja/cairo-context-rectangle.html +60 -0
- data/doc/ja/cairo-context-triangle.html +47 -0
- data/doc/ja/cairo-context.html +1449 -0
- data/doc/ja/cairo-error.html +56 -0
- data/doc/ja/cairo-extend.html +56 -0
- data/doc/ja/cairo-file-not-found.html +51 -0
- data/doc/ja/cairo-fill-rule.html +58 -0
- data/doc/ja/cairo-filter.html +43 -0
- data/doc/ja/cairo-font-extents.html +110 -0
- data/doc/ja/cairo-font-face.html +55 -0
- data/doc/ja/cairo-font-options.html +186 -0
- data/doc/ja/cairo-font-slant.html +50 -0
- data/doc/ja/cairo-font-weight.html +47 -0
- data/doc/ja/cairo-format.html +81 -0
- data/doc/ja/cairo-glyph.html +115 -0
- data/doc/ja/cairo-gradient-pattern.html +119 -0
- data/doc/ja/cairo-hint-metrics.html +57 -0
- data/doc/ja/cairo-hint-style.html +64 -0
- data/doc/ja/cairo-image-surface.html +131 -0
- data/doc/ja/cairo-invalid-content-error.html +54 -0
- data/doc/ja/cairo-invalid-dash-error.html +54 -0
- data/doc/ja/cairo-invalid-dsc-comment-error.html +54 -0
- data/doc/ja/cairo-invalid-format-error.html +54 -0
- data/doc/ja/cairo-invalid-index-error.html +54 -0
- data/doc/ja/cairo-invalid-matrix-error.html +54 -0
- data/doc/ja/cairo-invalid-path-data-error.html +54 -0
- data/doc/ja/cairo-invalid-pop-group-error.html +54 -0
- data/doc/ja/cairo-invalid-restore-error.html +55 -0
- data/doc/ja/cairo-invalid-status-error.html +55 -0
- data/doc/ja/cairo-invalid-stride-error.html +55 -0
- data/doc/ja/cairo-invalid-string-error.html +54 -0
- data/doc/ja/cairo-invalid-visual-error.html +57 -0
- data/doc/ja/cairo-line-cap.html +50 -0
- data/doc/ja/cairo-line-join.html +53 -0
- data/doc/ja/cairo-linear-pattern.html +87 -0
- data/doc/ja/cairo-matrix.html +343 -0
- data/doc/ja/cairo-no-current-point-error.html +54 -0
- data/doc/ja/cairo-null-pointer-error.html +54 -0
- data/doc/ja/cairo-operator.html +51 -0
- data/doc/ja/cairo-paper-parse-error.html +55 -0
- data/doc/ja/cairo-paper-unknown-paper-name.html +76 -0
- data/doc/ja/cairo-paper-unknown-unit.html +75 -0
- data/doc/ja/cairo-paper-unrecognized-paper-description.html +76 -0
- data/doc/ja/cairo-paper.html +357 -0
- data/doc/ja/cairo-path-close-path.html +57 -0
- data/doc/ja/cairo-path-curve-to.html +70 -0
- data/doc/ja/cairo-path-data-type.html +53 -0
- data/doc/ja/cairo-path-data.html +127 -0
- data/doc/ja/cairo-path-line-to.html +62 -0
- data/doc/ja/cairo-path-move-to.html +62 -0
- data/doc/ja/cairo-path.html +144 -0
- data/doc/ja/cairo-pattern-type-mismatch-error.html +56 -0
- data/doc/ja/cairo-pattern.html +128 -0
- data/doc/ja/cairo-pdf-surface.html +86 -0
- data/doc/ja/cairo-point.html +90 -0
- data/doc/ja/cairo-ps-level.html +62 -0
- data/doc/ja/cairo-ps-surface.html +214 -0
- data/doc/ja/cairo-quartz-image-surface.html +75 -0
- data/doc/ja/cairo-quartz-surface.html +93 -0
- data/doc/ja/cairo-radial-pattern.html +93 -0
- data/doc/ja/cairo-read-error.html +55 -0
- data/doc/ja/cairo-rectangle.html +109 -0
- data/doc/ja/cairo-scaled-font.html +144 -0
- data/doc/ja/cairo-solid-pattern.html +87 -0
- data/doc/ja/cairo-subpixel-order.html +57 -0
- data/doc/ja/cairo-surface-finished-error.html +54 -0
- data/doc/ja/cairo-surface-pattern.html +68 -0
- data/doc/ja/cairo-surface-type-mismatch-error.html +56 -0
- data/doc/ja/cairo-surface.html +191 -0
- data/doc/ja/cairo-svg-surface.html +114 -0
- data/doc/ja/cairo-svg-version.html +66 -0
- data/doc/ja/cairo-temp-file-error.html +50 -0
- data/doc/ja/cairo-text-extents.html +101 -0
- data/doc/ja/cairo-win32-printing-surface.html +80 -0
- data/doc/ja/cairo-win32-surface.html +100 -0
- data/doc/ja/cairo-write-error.html +55 -0
- data/doc/ja/cairo.html +148 -0
- data/doc/ja/index.html +1080 -0
- data/extconf.rb +153 -0
- data/misc/update-colors.rb +143 -0
- data/pkg-config.rb +278 -0
- data/samples/agg/README +4 -0
- data/samples/agg/aa_demo.rb +47 -0
- data/samples/agg/aa_test.rb +304 -0
- data/samples/blur.rb +47 -0
- data/samples/pac.rb +99 -0
- data/samples/pac2.rb +171 -0
- data/samples/png.rb +45 -0
- data/samples/scalable.rb +56 -0
- data/samples/text-on-path.rb +60 -0
- data/samples/text2.rb +131 -0
- data/src/cairo.def +96 -0
- data/src/cairo.so +0 -0
- data/src/lib/cairo.rb +141 -0
- data/src/lib/cairo/color.rb +255 -0
- data/src/lib/cairo/colors.rb +656 -0
- data/src/lib/cairo/constants.rb +21 -0
- data/src/lib/cairo/context.rb +29 -0
- data/src/lib/cairo/context/blur.rb +45 -0
- data/src/lib/cairo/context/circle.rb +9 -0
- data/src/lib/cairo/context/color.rb +11 -0
- data/src/lib/cairo/context/path.rb +116 -0
- data/src/lib/cairo/context/rectangle.rb +33 -0
- data/src/lib/cairo/context/triangle.rb +12 -0
- data/src/lib/cairo/paper.rb +183 -0
- data/src/lib/cairo/papers.rb +41 -0
- data/src/lib/cairo/path.rb +15 -0
- data/src/lib/cairo/point.rb +7 -0
- data/src/libruby-cairo.a +0 -0
- data/src/rb_cairo.c +82 -0
- data/src/rb_cairo.h +264 -0
- data/src/rb_cairo_constants.c +456 -0
- data/src/rb_cairo_context.c +1548 -0
- data/src/rb_cairo_exception.c +214 -0
- data/src/rb_cairo_font_extents.c +125 -0
- data/src/rb_cairo_font_face.c +56 -0
- data/src/rb_cairo_font_options.c +197 -0
- data/src/rb_cairo_glyph.c +159 -0
- data/src/rb_cairo_matrix.c +350 -0
- data/src/rb_cairo_path.c +459 -0
- data/src/rb_cairo_pattern.c +540 -0
- data/src/rb_cairo_private.c +78 -0
- data/src/rb_cairo_private.h +72 -0
- data/src/rb_cairo_scaled_font.c +177 -0
- data/src/rb_cairo_surface.c +1252 -0
- data/src/rb_cairo_text_extents.c +138 -0
- data/test/run-test.rb +15 -0
- data/test/test_paper.rb +81 -0
- data/test/test_pkg_config.rb +122 -0
- metadata +490 -0
data/extconf.rb
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 :
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'English'
|
7
|
+
require 'mkmf'
|
8
|
+
require 'pkg-config'
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
# from mkmf-gnome2.rb
|
12
|
+
STDOUT.print("checking for GCC... ")
|
13
|
+
STDOUT.flush
|
14
|
+
if macro_defined?("__GNUC__", "")
|
15
|
+
STDOUT.print "yes\n"
|
16
|
+
$CFLAGS += ' -Wall'
|
17
|
+
$cc_is_gcc = true
|
18
|
+
else
|
19
|
+
STDOUT.print "no\n"
|
20
|
+
$cc_is_gcc = false
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_win32
|
24
|
+
checking_for("Win32 OS") do
|
25
|
+
win32_os = /cygwin|mingw|mswin32/ =~ RUBY_PLATFORM
|
26
|
+
if win32_os
|
27
|
+
$defs << "-DRUBY_CAIRO_PLATFORM_WIN32"
|
28
|
+
if $cc_is_gcc
|
29
|
+
if /^2\./ =~ `#{Config::CONFIG['CC']} -dumpversion`.chomp
|
30
|
+
$CFLAGS += ' -fnative-struct'
|
31
|
+
else
|
32
|
+
$CFLAGS += ' -mms-bitfields'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
win32_os
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_output_lib(target_name, directory=nil)
|
41
|
+
case RUBY_PLATFORM
|
42
|
+
when /cygwin|mingw/
|
43
|
+
filename = File.join(*([directory, "libruby-#{target_name}.a"].compact))
|
44
|
+
if RUBY_VERSION > "1.8.0"
|
45
|
+
$DLDFLAGS << ",--out-implib=#{filename}"
|
46
|
+
elsif RUBY_VERSION > "1.8"
|
47
|
+
$DLDFLAGS.gsub!(/ -Wl,--out-implib=[^ ]+/, '')
|
48
|
+
$DLDFLAGS << " -Wl,--out-implib=#{filename}"
|
49
|
+
else
|
50
|
+
$DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
|
51
|
+
$DLDFLAGS << " --output-lib #{filename}"
|
52
|
+
end
|
53
|
+
$cleanfiles << filename
|
54
|
+
when /mswin32/
|
55
|
+
$DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
|
56
|
+
$DLDFLAGS.gsub!(/ \/IMPLIB:[^ ]+/, '')
|
57
|
+
$DLDFLAGS << " /IMPLIB:$(IMPLIB)"
|
58
|
+
when /darwin/
|
59
|
+
if have_macro("CAIRO_HAS_QUARTZ_SURFACE", ["cairo.h"])
|
60
|
+
checking_for("RubyCocoa") do
|
61
|
+
begin
|
62
|
+
require 'osx/cocoa'
|
63
|
+
$defs << "-DHAVE_RUBY_COCOA"
|
64
|
+
$DLDFLAGS << " -Wl,-framework,RubyCocoa"
|
65
|
+
true
|
66
|
+
rescue LoadError
|
67
|
+
false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
pkg = "cairo"
|
76
|
+
modname = "cairo"
|
77
|
+
ext_dir_name = "src"
|
78
|
+
srcdir = File.join(File.expand_path(File.dirname(__FILE__)), ext_dir_name)
|
79
|
+
major, minor, micro = 1, 2, 0
|
80
|
+
|
81
|
+
PKGConfig.have_package(pkg, major, minor, micro) or exit 1
|
82
|
+
|
83
|
+
have_func("rb_errinfo")
|
84
|
+
|
85
|
+
check_win32
|
86
|
+
target_name = File.basename(modname)
|
87
|
+
set_output_lib(target_name, ext_dir_name)
|
88
|
+
$defs << "-DRB_CAIRO_COMPILATION"
|
89
|
+
create_makefile(modname, srcdir)
|
90
|
+
|
91
|
+
wine = with_config("wine", false)
|
92
|
+
|
93
|
+
makefile = File.read("Makefile")
|
94
|
+
File.open("Makefile", "w") do |f|
|
95
|
+
objs = []
|
96
|
+
co = nil
|
97
|
+
makefile.each_line do |line|
|
98
|
+
if wine
|
99
|
+
line.gsub!(/\s+gcc\b/, " i586-mingw32msvc-gcc")
|
100
|
+
line.gsub!(/C:/, "$(HOME)/.wine/drive_c")
|
101
|
+
line.gsub!(/Z:/, "")
|
102
|
+
end
|
103
|
+
|
104
|
+
case line
|
105
|
+
when /^DLLIB\s*=\s*/
|
106
|
+
dllib = $POSTMATCH
|
107
|
+
f.puts("DLLIB = #{ext_dir_name}/#{dllib}")
|
108
|
+
f.puts("IMPLIB = #{ext_dir_name}/libruby-#{dllib.gsub(/\..+?$/, '.lib')}")
|
109
|
+
when /^(SRCS)\s*=\s*/
|
110
|
+
name = $1
|
111
|
+
vars = $POSTMATCH.split.collect {|var| "$(srcdir)/#{var}"}.join(" ")
|
112
|
+
f.puts("#{name} = #{vars}")
|
113
|
+
when /^(OBJS|CLEANLIBS|CLEANOBJS)\s*=\s*/
|
114
|
+
name = $1
|
115
|
+
vars = $POSTMATCH.split.collect {|var| "#{ext_dir_name}/#{var}"}
|
116
|
+
objs = vars if name == "OBJS"
|
117
|
+
vars = vars.join(" ")
|
118
|
+
f.puts("#{name} = #{vars}")
|
119
|
+
when /^LDSHARED\s*=/
|
120
|
+
def_file = "#{ext_dir_name}/#{target_name}.def"
|
121
|
+
line.gsub!(/\b-shared\b/, "-shared #{def_file}") if wine
|
122
|
+
f.puts(line)
|
123
|
+
when /^\t\$\(CC\)/
|
124
|
+
if PKGConfig.msvc?
|
125
|
+
output_option = "-Fo"
|
126
|
+
else
|
127
|
+
output_option = "-o"
|
128
|
+
end
|
129
|
+
unless /#{Regexp.escape(output_option)}/ =~ line
|
130
|
+
line = "#{line.chomp} #{output_option}$@"
|
131
|
+
end
|
132
|
+
co = line
|
133
|
+
f.puts(line)
|
134
|
+
else
|
135
|
+
f.puts(line)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
if co and !objs.empty?
|
140
|
+
f.puts
|
141
|
+
if PKGConfig.msvc?
|
142
|
+
f.puts "{$(srcdir)}.c{#{ext_dir_name}}.obj:"
|
143
|
+
f.puts co
|
144
|
+
else
|
145
|
+
objs.each do |obj|
|
146
|
+
f.puts "#{obj}: $(srcdir)/#{File.basename(obj).sub(/\..+?$/, '.c')}"
|
147
|
+
f.puts co
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
FileUtils.mkdir_p(ext_dir_name)
|
@@ -0,0 +1,143 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'scrapi'
|
5
|
+
rescue LoadError
|
6
|
+
require 'rubygems'
|
7
|
+
require 'scrapi'
|
8
|
+
end
|
9
|
+
|
10
|
+
def collect_popular_colors(src=nil)
|
11
|
+
src ||= URI("http://en.wikipedia.org/wiki/List_of_colors")
|
12
|
+
|
13
|
+
row = Scraper.define do
|
14
|
+
process "th > a:first-child", :name => :text
|
15
|
+
process "td:nth-child(3)", :hex_triplet => :text
|
16
|
+
process "td:nth-child(4)", :red => :text
|
17
|
+
process "td:nth-child(5)", :green => :text
|
18
|
+
process "td:nth-child(6)", :blue => :text
|
19
|
+
result :name, :hex_triplet, :red, :green, :blue
|
20
|
+
end
|
21
|
+
|
22
|
+
scraper = Scraper.define do
|
23
|
+
process "table > tr", "rows[]" => row
|
24
|
+
result :rows
|
25
|
+
end
|
26
|
+
|
27
|
+
scraper.scrape(src)
|
28
|
+
end
|
29
|
+
|
30
|
+
def collect_x11_colors(src=nil)
|
31
|
+
src ||= URI("http://en.wikipedia.org/wiki/X11_color_names")
|
32
|
+
|
33
|
+
row = Scraper.define do
|
34
|
+
process "th", :name => :text
|
35
|
+
process "td:nth-child(2)", :hex_triplet => "@bgcolor"
|
36
|
+
process "td:nth-child(6)", :red => :text
|
37
|
+
process "td:nth-child(7)", :green => :text
|
38
|
+
process "td:nth-child(8)", :blue => :text
|
39
|
+
result :name, :hex_triplet, :red, :green, :blue
|
40
|
+
end
|
41
|
+
|
42
|
+
scraper = Scraper.define do
|
43
|
+
process "table > tr", "rows[]" => row
|
44
|
+
result :rows
|
45
|
+
end
|
46
|
+
|
47
|
+
x11_colors = scraper.scrape(src)
|
48
|
+
x11_colors.collect do |color|
|
49
|
+
if color.name
|
50
|
+
color.name = color.name.gsub(/([a-z]|[A-Z]+)([A-Z])/, "\\1 \\2")
|
51
|
+
end
|
52
|
+
color
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def constanize_color_name(name)
|
57
|
+
names = name.gsub(/é/, "e").upcase.split(/(?:\s*\(|\)\s*)/)
|
58
|
+
names = names.collect {|name| name.gsub(/[ \-]/, "_")}
|
59
|
+
if names[1] and ["WEB", "COLOR_WHEEL", "X11"].include?(names[1])
|
60
|
+
real_names = [names.join("_")]
|
61
|
+
if names == ["ORANGE", "COLOR_WHEEL"]
|
62
|
+
real_names << names.first
|
63
|
+
end
|
64
|
+
names = real_names
|
65
|
+
end
|
66
|
+
names
|
67
|
+
end
|
68
|
+
|
69
|
+
colors = collect_popular_colors
|
70
|
+
x11_colors = collect_x11_colors
|
71
|
+
|
72
|
+
top_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
73
|
+
colors_rb = File.join(top_dir, "src", "lib", "cairo", "colors.rb")
|
74
|
+
File.open(colors_rb, "w") do |rb|
|
75
|
+
rb.puts <<-HEADER
|
76
|
+
require 'cairo/color'
|
77
|
+
|
78
|
+
module Cairo
|
79
|
+
module Color
|
80
|
+
HEADER
|
81
|
+
|
82
|
+
[
|
83
|
+
[colors, nil],
|
84
|
+
[x11_colors, "X11"]
|
85
|
+
].each do |colors, mod|
|
86
|
+
indent = " " * 2
|
87
|
+
if mod
|
88
|
+
rb.puts("#{indent}module #{mod}")
|
89
|
+
indent << " "
|
90
|
+
end
|
91
|
+
colors.each do |color|
|
92
|
+
if color.name and color.hex_triplet and
|
93
|
+
color.red and color.green and color.blue
|
94
|
+
begin
|
95
|
+
names = constanize_color_name(color.name)
|
96
|
+
|
97
|
+
hexes = color.hex_triplet.scan(/[\da-f]{2,2}/i)
|
98
|
+
red_hex, green_hex, blue_hex = hexes.collect {|hex| hex.hex}
|
99
|
+
|
100
|
+
red = Integer(color.red)
|
101
|
+
green = Integer(color.green)
|
102
|
+
blue = Integer(color.blue)
|
103
|
+
|
104
|
+
if [red_hex, green_hex, blue_hex] != [red, green, blue]
|
105
|
+
warning_message = "Hex triplet(#{color.hex_triplet}) of "
|
106
|
+
warning_message << "#{color.name} is difference from RGB"
|
107
|
+
warning_message << "(#{red}, #{green}, #{blue}). "
|
108
|
+
if ["Alice Blue", "Old Rose"].include?(color.name)
|
109
|
+
warning_message << "Use hex triplet value."
|
110
|
+
red, green, blue = red_hex, green_hex, blue_hex
|
111
|
+
else
|
112
|
+
warning_message << "Use RGB value."
|
113
|
+
end
|
114
|
+
puts warning_message
|
115
|
+
end
|
116
|
+
|
117
|
+
r, g, b = [red, green, blue].collect {|v| v / 255.0}
|
118
|
+
|
119
|
+
rb.puts("#{indent}# #{color.name}: #{color.hex_triplet}")
|
120
|
+
name, *alias_names = names
|
121
|
+
rb.puts("#{indent}#{name} = RGB.new(#{r}, #{g}, #{b})")
|
122
|
+
alias_names.each do |alias_name|
|
123
|
+
rb.puts("#{indent}#{alias_name} = #{name}")
|
124
|
+
end
|
125
|
+
rescue ArgumentError
|
126
|
+
next
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if mod
|
132
|
+
indent = indent[0..-3]
|
133
|
+
rb.puts("#{indent}end")
|
134
|
+
rb.puts("#{indent}include #{mod}")
|
135
|
+
rb.puts
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
rb.puts <<-FOOTER
|
140
|
+
end
|
141
|
+
end
|
142
|
+
FOOTER
|
143
|
+
end
|
data/pkg-config.rb
ADDED
@@ -0,0 +1,278 @@
|
|
1
|
+
require "rbconfig"
|
2
|
+
|
3
|
+
require 'mkmf'
|
4
|
+
require 'shellwords'
|
5
|
+
require 'English'
|
6
|
+
require 'pathname'
|
7
|
+
|
8
|
+
class PackageConfig
|
9
|
+
attr_accessor :msvc_syntax
|
10
|
+
def initialize(name, path=nil, msvc_syntax=false)
|
11
|
+
@name = name
|
12
|
+
@path = path || ENV["PKG_CONFIG_PATH"]
|
13
|
+
@path = [@path, guess_default_path].compact.join(separator)
|
14
|
+
@msvc_syntax = msvc_syntax
|
15
|
+
@variables = @declarations = nil
|
16
|
+
override_variables = with_config("override-variables", "")
|
17
|
+
@override_variables = parse_override_variables(override_variables)
|
18
|
+
end
|
19
|
+
|
20
|
+
def exist?
|
21
|
+
not pc.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
def requires
|
25
|
+
parse_requires(declaration("Requires"))
|
26
|
+
end
|
27
|
+
|
28
|
+
def requires_private
|
29
|
+
parse_requires(declaration("Requires.private"))
|
30
|
+
end
|
31
|
+
|
32
|
+
def cflags
|
33
|
+
path_flags, other_flags = collect_cflags
|
34
|
+
(other_flags + path_flags).join(" ")
|
35
|
+
end
|
36
|
+
|
37
|
+
def cflags_only_I
|
38
|
+
collect_cflags[0].join(" ")
|
39
|
+
end
|
40
|
+
|
41
|
+
def libs
|
42
|
+
path_flags, other_flags = collect_libs
|
43
|
+
(other_flags + path_flags).join(" ")
|
44
|
+
end
|
45
|
+
|
46
|
+
def libs_only_l
|
47
|
+
collect_libs[1].find_all do |arg|
|
48
|
+
if @msvc_syntax
|
49
|
+
/\.lib\z/ =~ arg
|
50
|
+
else
|
51
|
+
/\A-l/ =~ arg
|
52
|
+
end
|
53
|
+
end.join(" ")
|
54
|
+
end
|
55
|
+
|
56
|
+
def version
|
57
|
+
declaration("Version")
|
58
|
+
end
|
59
|
+
|
60
|
+
def variable(name)
|
61
|
+
parse_pc if @variables.nil?
|
62
|
+
expand_value(@override_variables[name] || @variables[name])
|
63
|
+
end
|
64
|
+
|
65
|
+
def declaration(name)
|
66
|
+
parse_pc if @declarations.nil?
|
67
|
+
expand_value(@declarations[name])
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
def pc
|
72
|
+
@path.split(separator).each do |path|
|
73
|
+
pc_name = File.join(path, "#{@name}.pc")
|
74
|
+
return pc_name if File.exist?(pc_name)
|
75
|
+
end
|
76
|
+
return nil
|
77
|
+
end
|
78
|
+
|
79
|
+
def separator
|
80
|
+
File.expand_path(".").index(":") ? ";" : ":"
|
81
|
+
end
|
82
|
+
|
83
|
+
def collect_cflags
|
84
|
+
all_cflags = (requires_private + requires.reverse).collect do |package|
|
85
|
+
self.class.new(package, @path, @msvc_syntax).cflags
|
86
|
+
end
|
87
|
+
all_cflags = [declaration("Cflags")] + all_cflags
|
88
|
+
all_cflags = all_cflags.join(" ").gsub(/-I /, '-I').split.uniq
|
89
|
+
path_flags, other_flags = all_cflags.partition {|flag| /\A-I/ =~ flag}
|
90
|
+
path_flags = path_flags.reject do |flag|
|
91
|
+
flag == "-I/usr/include"
|
92
|
+
end
|
93
|
+
if @msvc_syntax
|
94
|
+
path_flags = path_flags.collect do |flag|
|
95
|
+
flag.gsub(/\A-I/, "/I")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
[path_flags, other_flags]
|
99
|
+
end
|
100
|
+
|
101
|
+
def collect_libs
|
102
|
+
all_libs = requires.collect do |package|
|
103
|
+
self.class.new(package, @path, @msvc_syntax).libs
|
104
|
+
end
|
105
|
+
all_libs = [declaration("Libs")] + all_libs
|
106
|
+
all_libs = all_libs.join(" ").gsub(/-([Ll]) /, '\1').split.uniq
|
107
|
+
path_flags, other_flags = all_libs.partition {|flag| /\A-L/ =~ flag}
|
108
|
+
path_flags = path_flags.reject do |flag|
|
109
|
+
/\A-L\/usr\/lib(?:64)?\z/ =~ flag
|
110
|
+
end
|
111
|
+
if @msvc_syntax
|
112
|
+
path_flags = path_flags.collect do |flag|
|
113
|
+
flag.gsub(/\A-L/, "/libpath:")
|
114
|
+
end
|
115
|
+
other_flags = other_flags.collect do |flag|
|
116
|
+
if /\A-l/ =~ flag
|
117
|
+
"#{$POSTMATCH}.lib"
|
118
|
+
else
|
119
|
+
flag
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
[path_flags, other_flags]
|
124
|
+
end
|
125
|
+
|
126
|
+
IDENTIFIER_RE = /[\w\d_.]+/
|
127
|
+
def parse_pc
|
128
|
+
raise ".pc for #{@name} doesn't exist." unless exist?
|
129
|
+
@variables = {}
|
130
|
+
@declarations = {}
|
131
|
+
File.open(pc) do |input|
|
132
|
+
input.each_line do |line|
|
133
|
+
line = line.gsub(/#.*/, '').strip
|
134
|
+
next if line.empty?
|
135
|
+
case line
|
136
|
+
when /^(#{IDENTIFIER_RE})=/
|
137
|
+
@variables[$1] = $POSTMATCH.strip
|
138
|
+
when /^(#{IDENTIFIER_RE}):/
|
139
|
+
@declarations[$1] = $POSTMATCH.strip
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def parse_requires(requires)
|
146
|
+
return [] if requires.nil?
|
147
|
+
requires_without_version = requires.gsub(/[<>]?=\s*[\d.]+\s*/, '')
|
148
|
+
requires_without_version.split(/[,\s]+/)
|
149
|
+
end
|
150
|
+
|
151
|
+
def parse_override_variables(override_variables)
|
152
|
+
variables = {}
|
153
|
+
override_variables.split(",").each do |variable|
|
154
|
+
name, value = variable.split("=", 2)
|
155
|
+
variables[name] = value
|
156
|
+
end
|
157
|
+
variables
|
158
|
+
end
|
159
|
+
|
160
|
+
def expand_value(value)
|
161
|
+
return nil if value.nil?
|
162
|
+
value.gsub(/\$\{(#{IDENTIFIER_RE})\}/) do
|
163
|
+
variable($1)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def guess_default_path
|
168
|
+
default_path = "/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
|
169
|
+
libdir = ENV["PKG_CONFIG_LIBDIR"]
|
170
|
+
default_path = "#{libdir}:#{default_path}" if libdir
|
171
|
+
pkg_config = with_config("pkg-config", ENV["PKG_CONFIG"] || "pkg-config")
|
172
|
+
pkg_config = Pathname.new(pkg_config)
|
173
|
+
unless pkg_config.absolute?
|
174
|
+
begin
|
175
|
+
require "dl/import"
|
176
|
+
rescue LoadError
|
177
|
+
return default_path
|
178
|
+
end
|
179
|
+
dln = Module.new
|
180
|
+
dln.module_eval do
|
181
|
+
if DL.const_defined?(:Importer)
|
182
|
+
extend DL::Importer
|
183
|
+
else
|
184
|
+
extend DL::Importable
|
185
|
+
end
|
186
|
+
begin
|
187
|
+
dlload RbConfig::CONFIG["LIBRUBY"]
|
188
|
+
rescue RuntimeError
|
189
|
+
return default_path if $!.message == "unknown error"
|
190
|
+
raise
|
191
|
+
rescue DL::DLError
|
192
|
+
return default_path
|
193
|
+
end
|
194
|
+
extern "const char *dln_find_exe(const char *, const char *)"
|
195
|
+
end
|
196
|
+
pkg_config = dln.dln_find_exe(pkg_config.to_s, nil)
|
197
|
+
return default_path if pkg_config.nil?
|
198
|
+
pkg_config = Pathname.new(pkg_config)
|
199
|
+
end
|
200
|
+
[(pkg_config.parent.parent + "lib" + "pkgconfig").to_s,
|
201
|
+
default_path].join(":")
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
module PKGConfig
|
206
|
+
module_function
|
207
|
+
def msvc?
|
208
|
+
/mswin32/.match(RUBY_PLATFORM) and /^cl\b/.match(Config::CONFIG['CC'])
|
209
|
+
end
|
210
|
+
|
211
|
+
def package_config(package)
|
212
|
+
PackageConfig.new(package, nil, msvc?)
|
213
|
+
end
|
214
|
+
|
215
|
+
def exist?(pkg)
|
216
|
+
package_config(pkg).exist?
|
217
|
+
end
|
218
|
+
|
219
|
+
def libs(pkg)
|
220
|
+
package_config(pkg).libs
|
221
|
+
end
|
222
|
+
|
223
|
+
def libs_only_l(pkg)
|
224
|
+
package_config(pkg).libs_only_l
|
225
|
+
end
|
226
|
+
|
227
|
+
def cflags(pkg)
|
228
|
+
package_config(pkg).cflags
|
229
|
+
end
|
230
|
+
|
231
|
+
def cflags_only_I(pkg)
|
232
|
+
package_config(pkg).cflags_only_I
|
233
|
+
end
|
234
|
+
|
235
|
+
def modversion(pkg)
|
236
|
+
package_config(pkg).version
|
237
|
+
end
|
238
|
+
|
239
|
+
def check_version?(pkg, major = 0, minor = 0, micro = 0)
|
240
|
+
return false unless exist?(pkg)
|
241
|
+
ver = modversion(pkg).split(".").collect{|item| item.to_i}
|
242
|
+
(0..2).each {|i| ver[i] = 0 unless ver[i]}
|
243
|
+
|
244
|
+
(ver[0] > major ||
|
245
|
+
(ver[0] == major && ver[1] > minor) ||
|
246
|
+
(ver[0] == major && ver[1] == minor &&
|
247
|
+
ver[2] >= micro))
|
248
|
+
end
|
249
|
+
|
250
|
+
def have_package(pkg, major = nil, minor = 0, micro = 0)
|
251
|
+
if major.nil?
|
252
|
+
STDOUT.print("checking for #{pkg}... ")
|
253
|
+
else
|
254
|
+
STDOUT.print("checking for #{pkg} version (>= #{major}.#{minor}.#{micro})... ")
|
255
|
+
end
|
256
|
+
major ||= 0
|
257
|
+
STDOUT.flush
|
258
|
+
if check_version?(pkg, major, minor, micro)
|
259
|
+
STDOUT.print "yes\n"
|
260
|
+
libraries = libs_only_l(pkg)
|
261
|
+
dldflags = libs(pkg)
|
262
|
+
dldflags = (Shellwords.shellwords(dldflags) -
|
263
|
+
Shellwords.shellwords(libraries))
|
264
|
+
dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(' ')
|
265
|
+
$libs += ' ' + libraries
|
266
|
+
if /mswin32/ =~ RUBY_PLATFORM
|
267
|
+
$DLDFLAGS += ' ' + dldflags
|
268
|
+
else
|
269
|
+
$LDFLAGS += ' ' + dldflags
|
270
|
+
end
|
271
|
+
$CFLAGS += ' ' + cflags(pkg)
|
272
|
+
true
|
273
|
+
else
|
274
|
+
STDOUT.print "no\n"
|
275
|
+
false
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|