[DRE-commits] [ruby-pgplot] 04/06: Refresh patches: Import Git changes

Youhei SASAKI uwabami-guest at moszumanska.debian.org
Thu Aug 28 18:37:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

uwabami-guest pushed a commit to branch master
in repository ruby-pgplot.

commit ed70b8858ffa100a8f8d796439bd7b796bc53768
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date:   Fri Aug 29 02:27:40 2014 +0900

    Refresh patches: Import Git changes
    
    Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
---
 debian/patches/0000-Update-NArray-PATH.patch       |  13 +
 .../patches/0001-Add-enable-autobuild-option.patch |  45 ++
 ...te-extconf-and-Add-support-for-Ruby-1.9.2.patch | 311 ------------
 .../0002-Add-disable-extra-libs-option.patch       | 146 ++++++
 debian/patches/0002-Fix-mkdoc-for-Ruby-1.9.2.patch | 528 ---------------------
 debian/patches/0003-Close-files-in-cogen.rb.patch  |  29 ++
 .../patches/0003-Update-Cogen-for-Ruby1.9.2.patch  |  44 --
 .../0004-Be-smart-about-extra-library-checks.patch | 171 +++++++
 debian/patches/0005-extconf.rb.patch               | 327 +++++++++++++
 debian/patches/0006-rm-extconf-auto.rb.patch       | 138 ++++++
 .../0007-s.add_dependency-narray-0.7.0.patch       |  25 +
 debian/patches/0008-mv-homepage.patch              |  25 +
 debian/patches/0009-fix-docs.patch                 |  86 ++++
 debian/patches/series                              |  13 +-
 14 files changed, 1015 insertions(+), 886 deletions(-)

diff --git a/debian/patches/0000-Update-NArray-PATH.patch b/debian/patches/0000-Update-NArray-PATH.patch
new file mode 100644
index 0000000..8787e6d
--- /dev/null
+++ b/debian/patches/0000-Update-NArray-PATH.patch
@@ -0,0 +1,13 @@
+--- ruby-pgplot.orig/ext/extconf.rb
++++ ruby-pgplot/ext/extconf.rb
+@@ -56,8 +56,9 @@
+     find_dir_in_gemspec ||
+     find_dir_w_file("../"+narray_d,narray_h) ||
+     find_dir_w_file(gems_dir+narray_d,narray_h) ||
++    find_dir_w_file(CONFIG['vendorarchdir'],narray_h) ||
+     find_dir_w_file(CONFIG['sitearchdir'],narray_h) ||
+-    find_dir_w_file(CONFIG['archdir'],narray_h)
++    find_dir_w_file(CONFIG['archdir'],narray_h) 
+   $CPPFLAGS = " -I#{narray_h_dir} " + $CPPFLAGS
+ end
+ exit unless have_header("narray.h")
diff --git a/debian/patches/0001-Add-enable-autobuild-option.patch b/debian/patches/0001-Add-enable-autobuild-option.patch
new file mode 100644
index 0000000..cf01bd9
--- /dev/null
+++ b/debian/patches/0001-Add-enable-autobuild-option.patch
@@ -0,0 +1,45 @@
+From 3728b4348e4edcf5d62be38573f7d2a94ac3d089 Mon Sep 17 00:00:00 2001
+From: David MacMahon <davidm at astro.berkeley.edu>
+Date: Sat, 2 Mar 2013 11:06:42 -0800
+Subject: [PATCH 1/9] Add --enable-autobuild option
+
+This enables the automatic download and build of the pgplot library only if the
+user provides the --enable-autobuild option.  This is more security conscious
+as it requires the user's explicit permission (by providing --enable-autobuild)
+to download and install this third party library.
+---
+ ext/extconf-auto.rb | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/ext/extconf-auto.rb b/ext/extconf-auto.rb
+index 64020d1..5891862 100644
+--- a/ext/extconf-auto.rb
++++ b/ext/extconf-auto.rb
+@@ -14,7 +14,24 @@
+ 
+ load "./extconf.rb"
+ 
++# Exit if user did not specify "--enable-autobuild"
++if !enable_config('autobuild', false)
++  # Print reminder about --enable-autobuild option if pgplot was not found
++  if !$have_pgplot
++    puts
++    puts "The PGPLOT library was not found.  To auto-build it as part of"
++    puts "installing Ruby/PGLOT, pass the --enable-autobuild option."
++    puts
++    puts "Examples:"
++    puts
++    puts "   Gem install:  gem install pgplot -- --enable-autobuild"
++    puts "Manual install:  ruby extconf.rb --enable-autobuild"
++  end
++  exit
++end
++# Exit if pgplot library was found
+ exit if $have_pgplot
++# Exit unless a fortran compiler was found
+ exit unless %w[gfortran g77].any?{|cmd| system("which #{cmd}")}
+ 
+ puts "enabling auto-build PGPLOT Library..."
+-- 
+2.1.0
+
diff --git a/debian/patches/0001-Update-extconf-and-Add-support-for-Ruby-1.9.2.patch b/debian/patches/0001-Update-extconf-and-Add-support-for-Ruby-1.9.2.patch
deleted file mode 100644
index 3aa07e4..0000000
--- a/debian/patches/0001-Update-extconf-and-Add-support-for-Ruby-1.9.2.patch
+++ /dev/null
@@ -1,311 +0,0 @@
-From: Youhei SASAKI <uwabami at gfd-dennou.org>
-Date: Fri, 1 Jun 2012 18:17:00 +0900
-Subject: Update extconf and Add support for Ruby 1.9.2
-
----
- cogen.rb       |    2 +-
- extconf.rb     |    4 ++--
- kwarg.c        |   23 +++++++++++++++++---
- rb_pgplot.c.in |   65 +++++++++++++++++++++++++++++++++++---------------------
- 4 files changed, 64 insertions(+), 30 deletions(-)
-
-diff --git a/cogen.rb b/cogen.rb
-index d5d526a..2494f5f 100644
---- a/cogen.rb
-+++ b/cogen.rb
-@@ -97,7 +97,7 @@ def pgfuncgen(name, inp, out)
-   ninp = inp.size
-   nout = out.size
-   # int->0, float->1
--  val2 = ["NUM2INT","NUM2DBL","STR2CSTR"]
-+  val2 = ["NUM2INT","NUM2DBL","StringValuePtr"]
-   type = ["int","float",nil]
-   conv = ["INT2NUM","rb_float_new",nil]
-   # Initialize Array
-diff --git a/extconf.rb b/extconf.rb
-index 3fabb54..39752c6 100644
---- a/extconf.rb
-+++ b/extconf.rb
-@@ -34,10 +34,10 @@ dir_config("pgplot")
- exit unless have_header("cpgplot.h")
- 
- # Check NArray
--$CPPFLAGS = " -I#{CONFIG['sitearchdir']} "+$CPPFLAGS
-+$CPPFLAGS = " -I#{CONFIG['vendorarchdir']} "+$CPPFLAGS
- exit unless have_header("narray.h")
- if RUBY_PLATFORM =~ /cygwin|mingw/
--  $LDFLAGS = " -L#{CONFIG['sitearchdir']} "+$LDFLAGS
-+  $LDFLAGS = " -L#{CONFIG['archdir']} "+$LDFLAGS
-   exit unless have_library("narray","na_make_object")
- end
- 
-diff --git a/kwarg.c b/kwarg.c
-index a03630c..0620ec2 100644
---- a/kwarg.c
-+++ b/kwarg.c
-@@ -9,6 +9,23 @@
-    NO WARRANTY.
- */
- #include <ruby.h>
-+#ifndef RUBY_19
-+#ifndef RSTRING_PTR
-+#define RSTRING_PTR(a) (RSTRING(a)->ptr)
-+#endif
-+#ifndef RSTRING_LEN
-+#define RSTRING_LEN(a) (RSTRING(a)->len)
-+#endif
-+#ifndef RARRAY_PTR
-+#define RARRAY_PTR(s) (RARRAY(s)->ptr)
-+#endif
-+#ifndef RARRAY_LEN
-+#define RARRAY_LEN(s) (RARRAY(s)->len)
-+#endif
-+#ifndef StringValuePtr
-+#define StringValuePtr(s) STR2CSTR(s)
-+#endif
-+#endif
- 
- /* void rb_scan_kw_args __((VALUE, ...)); */
- 
-@@ -18,7 +35,7 @@ kw_hash_i(i, tmp)
- {
-   VALUE key;
- 
--  key = RARRAY(i)->ptr[0];
-+  key = RARRAY_PTR(i)[0];
-   if (TYPE(key)==T_SYMBOL) {
-     key = rb_funcall(key, rb_intern("id2name"), 0);
-   } else
-@@ -26,7 +43,7 @@ kw_hash_i(i, tmp)
-     rb_raise(rb_eArgError, "keywords must be String or Symbol");
-   }
- 
--  rb_hash_aset(tmp, key, RARRAY(i)->ptr[1]);
-+  rb_hash_aset(tmp, key, RARRAY_PTR(i)[1]);
-   return Qnil;
- }
- 
-@@ -71,7 +88,7 @@ rb_scan_kw_args(hash, va_alist)
-   if (rb_funcall(tmp, rb_intern("empty?"), 0)==Qfalse) {
-     val = rb_funcall(tmp, rb_intern("keys"), 0);
-     val = rb_funcall(val, rb_intern("join"), 1, rb_str_new2(","));
--    rb_raise(rb_eArgError, "unknown keywords: %s",STR2CSTR(val));
-+    rb_raise(rb_eArgError, "unknown keywords: %s",StringValuePtr(val));
-   }
- 
-   va_end(vargs);
-diff --git a/rb_pgplot.c.in b/rb_pgplot.c.in
-index f9a8cfe..ded737f 100644
---- a/rb_pgplot.c.in
-+++ b/rb_pgplot.c.in
-@@ -11,6 +11,23 @@
- #include <stdio.h>
- #include <cpgplot.h>
- #include <ruby.h>
-+#ifndef RUBY_19
-+#ifndef RSTRING_PTR
-+#define RSTRING_PTR(a) (RSTRING(a)->ptr)
-+#endif
-+#ifndef RSTRING_LEN
-+#define RSTRING_LEN(a) (RSTRING(a)->len)
-+#endif
-+#ifndef RARRAY_PTR
-+#define RARRAY_PTR(s) (RARRAY(s)->ptr)
-+#endif
-+#ifndef RARRAY_LEN
-+#define RARRAY_LEN(s) (RARRAY(s)->len)
-+#endif
-+#ifndef StringValuePtr
-+#define StringValuePtr(s) STR2CSTR(s)
-+#endif
-+#endif
- #include "narray.h"
- 
- #define min(a,b) (((a)<(b))?(a):(b))
-@@ -89,7 +106,7 @@ static VALUE
-   char *dev="?";
- 
-   rb_scan_args(argc,argv, "01", &vdev);
--  if (vdev!=Qnil) dev = STR2CSTR(vdev);
-+  if (vdev!=Qnil) dev = StringValuePtr(vdev);
- 
-   return INT2NUM(cpgopen(dev));
- }
-@@ -104,7 +121,7 @@ static VALUE
-   char  *dev="?";
- 
-   rb_scan_args(argc, argv, "03", &vdev,&vnxs,&vnys);
--  if (vdev!=Qnil) dev  = STR2CSTR(vdev);
-+  if (vdev!=Qnil) dev  = StringValuePtr(vdev);
-   if (vnxs!=Qnil) nxsub = NUM2INT(vnxs);
-   if (vnys!=Qnil) nysub = NUM2INT(vnys);
- 
-@@ -124,7 +141,7 @@ static VALUE
-      just: if just=1, the x and y axes is scaled equally,
-            otherwise scaled independently.
-      axis: controls of axes.
--*/ 
-+*/
- static VALUE
-   rb_pgplot_pgenv( int argc, VALUE *argv, VALUE self )
- {
-@@ -309,14 +326,14 @@ static void
- /* PGERRB -- horizontal or vertical error bar
-    pgerrb, dir, x, y, err [,tlen]
- 
--   dir : direction to plot the error bar relative to the data point. 
-+   dir : direction to plot the error bar relative to the data point.
-          One-sided error bar:
-            DIR is 1 for +X (X to X+E);
-                   2 for +Y (Y to Y+E);
-                   3 for -X (X to X-E);
-                   4 for -Y (Y to Y-E).
-          Two-sided error bar:
--           DIR is 5 for +/-X (X-E to X+E); 
-+           DIR is 5 for +/-X (X-E to X+E);
-                   6 for +/-Y (Y-E to Y+E).
-    x   : world x-coordinates of the data.
-    y   : world y-coordinates of the data.
-@@ -500,9 +517,9 @@ static VALUE
-   return Qtrue;
- }
- 
--/* PGCONL -- label contour map of a 2D data array 
-+/* PGCONL -- label contour map of a 2D data array
-    pgconl, map, cont, label [,intval, minint, tr]
--   map    : 2-D array of map data 
-+   map    : 2-D array of map data
-    cont   : contour level tobe labeld
-    label  : label string
-    intval : spacing along the contour between labels, in grid cells.
-@@ -531,7 +548,7 @@ static VALUE
-   /* Show Contour */
-   cpgconl( NA_PTR_FLT(na_map), NA_SHAPE0(na_map), NA_SHAPE1(na_map),
- 	   1, NA_SHAPE0(na_map), 1, NA_SHAPE1(na_map),
--	   NUM2DBL(vcnt), tr, STR2CSTR(vlab), intval, minint);
-+	   NUM2DBL(vcnt), tr, StringValuePtr(vlab), intval, minint);
-   return Qtrue;
- }
- 
-@@ -624,7 +641,7 @@ static VALUE
-   else
-     cpggray( NA_PTR_FLT(na), NA_SHAPE0(na), NA_SHAPE1(na),
- 	     1, NA_SHAPE0(na), 1, NA_SHAPE1(na),
--	     range[0], range[1], tr );    
-+	     range[0], range[1], tr );
-   return Qtrue;
- }
- 
-@@ -774,7 +791,7 @@ static VALUE
-   int   value_len=20;
-   char *item, *value;
- 
--  item  = STR2CSTR(vitem);
-+  item  = StringValuePtr(vitem);
-   value = ALLOCA_N(char,value_len);
-   cpgqinf( item, value, &value_len );
- 
-@@ -819,7 +836,7 @@ static VALUE
-   VALUE vx,vy;
-   int i;
-   float xbox[4], ybox[4];
--  char *txt = STR2CSTR(text);
-+  char *txt = StringValuePtr(text);
- 
-   cpgqtxt( NUM2DBL(x),NUM2DBL(y),NUM2DBL(ang),NUM2DBL(fjust),txt,
- 	   xbox, ybox );
-@@ -979,7 +996,7 @@ static VALUE
-   if (NA_TYPE(x)!=NA_SFLOAT || NA_TYPE(y)!=NA_SFLOAT)
-     rb_raise(rb_eArgError, "Array must NArray.sfloat");
- 
--  cpgolin( min(NA_TOTAL(x),NA_TOTAL(y)), &npt, 
-+  cpgolin( min(NA_TOTAL(x),NA_TOTAL(y)), &npt,
- 	   NA_PTR_FLT(x), NA_PTR_FLT(y), sym );
- 
-   return INT2NUM(npt);
-@@ -1009,7 +1026,7 @@ static VALUE
-   if (NA_TYPE(x)!=NA_SFLOAT || NA_TYPE(y)!=NA_SFLOAT)
-     rb_raise(rb_eArgError, "Array must NArray.sfloat");
- 
--  cpgncur( min(NA_TOTAL(x),NA_TOTAL(y)), &npt, 
-+  cpgncur( min(NA_TOTAL(x),NA_TOTAL(y)), &npt,
- 	   NA_PTR_FLT(x), NA_PTR_FLT(y), sym );
- 
-   return INT2NUM(npt);
-@@ -1037,7 +1054,7 @@ static VALUE
-   if (NA_TYPE(x)!=NA_SFLOAT || NA_TYPE(y)!=NA_SFLOAT)
-     rb_raise(rb_eArgError, "Array must NArray.sfloat");
- 
--  cpglcur( min(NA_TOTAL(x),NA_TOTAL(y)), &npt, 
-+  cpglcur( min(NA_TOTAL(x),NA_TOTAL(y)), &npt,
- 	   NA_PTR_FLT(x), NA_PTR_FLT(y) );
- 
-   return INT2NUM(npt);
-@@ -1058,7 +1075,7 @@ void rb_scan_kw_args __((VALUE, ...));
-     baseline parallel to the axis and reading in the same direction as
-     the axis (from point 1 to point 2). Current line and text attributes
-     are used.
--   
-+
-     Arguments:
-      X1, Y1  : world coordinates of one endpoint of the axis.
-      X2, Y2  : world coordinates of the other endpoint of the axis.
-@@ -1095,7 +1112,7 @@ static VALUE
-   if (tickr ==Qnil)  tickr = INT2FIX(0);
-   if (disp  ==Qnil)  disp  = INT2FIX(1);
-   if (orient==Qnil)  orient= INT2FIX(0);
--  if (vstr  !=Qnil)  str   = STR2CSTR(vstr);
-+  if (vstr  !=Qnil)  str   = StringValuePtr(vstr);
- 
-   cpgtick( NUM2DBL(x1),NUM2DBL(y1),NUM2DBL(x2),NUM2DBL(y2),
- 	   NUM2DBL(v), NUM2DBL(tickl),NUM2DBL(tickr),
-@@ -1114,25 +1131,25 @@ static VALUE
- 
-     Draw a labelled graph axis from world-coordinate position (X1,Y1) to
-     (X2,Y2).
--   
-+
-     Normally, this routine draws a standard LINEAR axis with equal
-     subdivisions.   The quantity described by the axis runs from V1 to V2;
--    this may be, but need not be, the same as X or Y. 
--   
-+    this may be, but need not be, the same as X or Y.
-+
-     If the 'L' option is specified, the routine draws a LOGARITHMIC axis.
-     In this case, the quantity described by the axis runs from 10**V1 to
--    10**V2. A logarithmic axis always has major, labeled, tick marks 
-+    10**V2. A logarithmic axis always has major, labeled, tick marks
-     spaced by one or more decades. If the major tick marks are spaced
-     by one decade (as specified by the STEP argument), then minor
-     tick marks are placed at 2, 3, .., 9 times each power of 10;
-     otherwise minor tick marks are spaced by one decade. If the axis
-     spans less than two decades, numeric labels are placed at 1, 2, and
-     5 times each power of ten.
--   
-+
-     If the axis spans less than one decade, or if it spans many decades,
-     it is preferable to use a linear axis labeled with the logarithm of
-     the quantity of interest.
--   
-+
-     Arguments:
-      x1, y1  : world coordinates of one endpoint of the axis.
-      x2, y2  : world coordinates of the other endpoint of the axis.
-@@ -1180,7 +1197,7 @@ static VALUE
-   if (argc>0 && TYPE(argv[argc-1]) == T_HASH)
-     val = argv[--argc];
- 
--  rb_scan_kw_args( val, 
-+  rb_scan_kw_args( val,
- 		   "opt",&vopt, "step",&step, "nsub",&nsub,
- 		   "tickl",&tickl, "tickr",&tickr,
- 		   "frac",&vfrac, "disp",&disp, "orient",&orient, 0);
-@@ -1192,7 +1209,7 @@ static VALUE
-   if (tickr ==Qnil)  tickr = INT2FIX(0);
-   if (disp  ==Qnil)  disp  = INT2FIX(1);
-   if (orient==Qnil)  orient= INT2FIX(0);
--  if (vopt  !=Qnil)  opt   = STR2CSTR(vopt);
-+  if (vopt  !=Qnil)  opt   = StringValuePtr(vopt);
-   if (vfrac !=Qnil)  frac  = NUM2DBL(vfrac);
- 
-   cpgaxis( opt, NUM2DBL(x1),NUM2DBL(y1),NUM2DBL(x2),NUM2DBL(y2),
diff --git a/debian/patches/0002-Add-disable-extra-libs-option.patch b/debian/patches/0002-Add-disable-extra-libs-option.patch
new file mode 100644
index 0000000..f655449
--- /dev/null
+++ b/debian/patches/0002-Add-disable-extra-libs-option.patch
@@ -0,0 +1,146 @@
+From c1429180ca4edf03f10486bc7edda891a6205906 Mon Sep 17 00:00:00 2001
+From: David MacMahon <davidm at astro.berkeley.edu>
+Date: Sat, 2 Mar 2013 11:31:48 -0800
+Subject: [PATCH 2/9] Add --disable-extra-libs option
+
+Some PGPLOT installations have incompletely linked PGPLOT libraries so linking
+against libcpgplot requires also linking against other libraries such as
+libpgplot, libX11, libpng, etc.  These extra checks are mostly benign for
+PGPLOT installations that don't need them, but they can cause problems.
+For example, mkmf uses "gcc" when checking for the Fortran libraries, but the
+resulting Makefile uses "cc" when linking.  If "cc" uses a different library
+path than "gcc", it is possible for the check to succeed but the link to fail.
+This might have been due to a weird combination of factors in my system
+(e.g. custom Ruby build using gcc installed via MacPorts and MacOS's cc), but
+if it happened to me it could happen to others.  Adding the --disable-extra-lib
+option provides a solution for this case.
+---
+ ext/extconf.rb | 100 +++++++++++++++++++++++++++++++--------------------------
+ 1 file changed, 55 insertions(+), 45 deletions(-)
+
+--- ruby-pgplot.orig/ext/extconf.rb
++++ ruby-pgplot/ext/extconf.rb
+@@ -15,11 +15,18 @@
+ 
+ #$DEBUG = true
+ 
++# Allow user to pass --disable-extra-libs to prevent checking for some libs.
++# Some PGPLOT installations need these extra checks and the extra checks are
++# mostly benign for PGPLOT installations that don't need them so the extra
++# checks are enabled by default.  The extra checks can cause problems on some
++# installations where they are not necessary.
++check_extra_libs = enable_config('extra-libs', true)
++
+ # configure options:
+ #  --with-x11-dir=path
+ #  --with-x11-include=path
+ #  --with-x11-lib=path
+-dir_config("x11")
++dir_config("x11") if check_extra_libs
+ 
+ # configure options:
+ #  --with-pgplot-dir=path
+@@ -68,56 +75,59 @@
+   exit unless have_library("narray","na_make_object")
+ end
+ 
+-# Check FORTRAN Libraries
+-#
+-# SUN WorkShop FORTRAN 77 compiler ver5.0
+-# configure options: --with-sunws
+-if with_config("sunws")
+-  $libs = "-lM77 -lsunmath "+$libs
+-  exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
+-  $defs.push "-DSPARC_FORTRAN"
+-#
+-# GNU FORTRAN v4
+-elsif have_library("gfortran")
+-  $CFLAGS = "-Wall "+$CFLAGS
+-  $defs.push "-DGNU_FORTRAN"
+-#
+-# GNU FORTRAN v3
+-elsif have_library("g77")
+-  $CFLAGS = "-Wall "+$CFLAGS
+-  $defs.push "-DGNU_FORTRAN"
+-else
+-  puts "failed"
+-  exit
+-end
++if check_extra_libs
++  # Check FORTRAN Libraries
++  #
++  # SUN WorkShop FORTRAN 77 compiler ver5.0
++  # configure options: --with-sunws
++  if with_config("sunws")
++    $libs = "-lM77 -lsunmath "+$libs
++    exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
++    $defs.push "-DSPARC_FORTRAN"
++  #
++  # GNU FORTRAN v4
++  elsif have_library("gfortran")
++    $CFLAGS = "-Wall "+$CFLAGS
++    $defs.push "-DGNU_FORTRAN"
++  #
++  # GNU FORTRAN v3
++  elsif have_library("g77")
++    $CFLAGS = "-Wall "+$CFLAGS
++    $defs.push "-DGNU_FORTRAN"
++  else
++    puts "failed"
++    exit
++  end
+ 
+-# Check GrWin Library (for cygwin (and mingw32?))
+-#  configure options: --with-grwin
+-if with_config("grwin")
+-  #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
+-  if RUBY_PLATFORM =~ /cygwin|mingw/
+-    $libs += " -mwindows"
++  # Check GrWin Library (for cygwin (and mingw32?))
++  #  configure options: --with-grwin
++  if with_config("grwin")
++    #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
++    if RUBY_PLATFORM =~ /cygwin|mingw/
++      $libs += " -mwindows"
++    end
++    exit unless have_library("GrWin", "GWinit")
+   end
+-  exit unless have_library("GrWin", "GWinit")
+-end
+ 
+-$found_lib = []
++  $found_lib = []
+ 
+-# Check X11 Library
+-if have_library("X11", "XOpenDisplay")
+-  $found_lib << 'X11'
+-end
++  # Check X11 Library
++  if have_library("X11", "XOpenDisplay")
++    $found_lib << 'X11'
++  end
+ 
+-# Check PNG Library
+-libs_save = $libs
+-$libs = append_library($libs, "z")
+-if have_library("png","png_create_write_struct")
+-  $found_lib << 'png'
+-else
+-  $libs = libs_save
+-end
++  # Check PNG Library
++  libs_save = $libs
++  $libs = append_library($libs, "z")
++  if have_library("png","png_create_write_struct")
++    $found_lib << 'png'
++  else
++    $libs = libs_save
++  end
++
++  $libs = append_library($libs, "pgplot")
++end # check_extra_libs
+ 
+-$libs = append_library($libs, "pgplot")
+ $have_pgplot = false
+ 
+ # Check PGPLOT Header
diff --git a/debian/patches/0002-Fix-mkdoc-for-Ruby-1.9.2.patch b/debian/patches/0002-Fix-mkdoc-for-Ruby-1.9.2.patch
deleted file mode 100644
index 0ab151d..0000000
--- a/debian/patches/0002-Fix-mkdoc-for-Ruby-1.9.2.patch
+++ /dev/null
@@ -1,528 +0,0 @@
-From: Youhei SASAKI <uwabami at gfd-dennou.org>
-Date: Fri, 1 Jun 2012 18:23:04 +0900
-Subject: Fix mkdoc for Ruby 1.9.2
-
-Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
----
- doc/Makefile          |    6 +--
- doc/install.ja.rd     |  126 ++++++++++++++++++++++++-------------------------
- doc/method.ja.rd      |  124 ++++++++++++++++++++++++------------------------
- doc/tutorial-01.ja.rd |   90 +++++++++++++++++------------------
- 4 files changed, 173 insertions(+), 173 deletions(-)
-
-diff --git a/doc/Makefile b/doc/Makefile
-index 14d5770..14a8ed1 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -1,11 +1,11 @@
- .SUFFIXES: .ja.rd .html.ja .rd .html .rb $(SUFFIXES)
- 
- .ja.rd.html.ja:
--	rd2 -r rd2html-img-lib.rb --html-lang=ja --out-code=jis --with-css=css.css $< > $@
-+	ruby -I. /usr/bin/rd2 -r rd2html-img-lib.rb --html-lang=ja --out-code=jis --with-css=css.css $< > $@
- .rd.html:
--	rd2 -r rd2html-img-lib.rb --with-css=css.css -o $* $<
-+	ruby -I. /usr/bin/rd2 -r rd2html-img-lib.rb --with-css=css.css -o $* $<
- .rb.html:
--	rd2 -r rd2html-img-lib.rb --with-css=css.css -o $* $<
-+	ruby -I. /usr/bin/rd2 -r rd2html-img-lib.rb --with-css=css.css -o $* $<
- 
- targets_en=index.html \
-   pgline.html pgcont.html pgimag.html pghist.html \
-diff --git a/doc/install.ja.rd b/doc/install.ja.rd
-index 0bc7480..2aa97af 100644
---- a/doc/install.ja.rd
-+++ b/doc/install.ja.rd
-@@ -1,105 +1,105 @@
- =begin
--= PGPLOT�Υ��󥹥ȡ���
-+= PGPLOTのインストール
- 
--PGPLOT�� configure ��Ȥ�ʤ��Τǥ��󥹥ȡ��뤬�㴳���ݤǤ���
--�ʲ��� Solaris��GCC �Ȥ����Ķ���PGPLOT�򥳥�ѥ��롢
--���󥹥ȡ��뤹������������ޤ���
--¾��OS�Ǥ�UNIX�ʤ�ۤȤ��Ʊ���褦�ˤ��ƥ��󥹥ȡ���Ǥ���Ȼפ��ޤ���
--((<�ܲȤΥ��󥹥ȡ��������Υڡ���|URL:http://www.astro.caltech.edu/~tjp/pgplot/install.html>))
--�⤴����������
-+PGPLOTは configure を使わないのでインストールが若干面倒です。
-+以下は Solaris、GCC という環境でPGPLOTをコンパイル、
-+インストールする手順を説明します。
-+他のOSでもUNIXならほとんど同じようにしてインストールできると思います。
-+((<本家のインストール説明のページ|URL:http://www.astro.caltech.edu/~tjp/pgplot/install.html>))
-+もご覧下さい。
- 
--=== PGPLOT�Υ��������Ѱ�
--((<PGPLOT������|URL:http://www.astro.caltech.edu/~tjp/pgplot/>))
--����
--((<������������|URL:ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz>))
--���������ɡ�Ÿ������pgplot�Υǥ��쥯�ȥ�˰�ư���ޤ���
-+=== PGPLOTのソースを用意
-+((<PGPLOTのサイト|URL:http://www.astro.caltech.edu/~tjp/pgplot/>))
-+から
-+((<ソースコード|URL:ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz>))
-+をダウンロード、展開し、pgplotのディレクトリに移動します。
- 
-   gunzip -c pgplot5.2.tar.gz | tar xvf -
-   cd pgplot
- 
--=== ��ȥǥ��쥯�ȥ�����
--��ȥǥ��쥯�ȥ����ޤ��������Ǥ� build �Ȥ���̾���ˤ��ޤ���
-+=== 作業ディレクトリを作成
-+作業ディレクトリを作ります。ここでは build という名前にします。
- 
-   mkdir build
-   cd build
- 
--=== drivers.list���Խ�
--PGPLOT���������Ϥ���ɥ饤�Ф����򤷤ޤ���
--drivers.list �Ȥ����ե�����򥳥ԡ����ƥ��ǥ����dz�����
--�Ȥ������ɥ饤�ФιԤ�Ƭ�� ! ��ʸ���������ޤ���
-+=== drivers.listを編集
-+PGPLOTで描画を出力するドライバを選択します。
-+drivers.list というファイルをコピーしてエディタで開き、
-+使いたいドライバの行の頭の ! の文字を削除します。
- 
-   cp ../drivers.list .
-   vi drivers.list
- 
--�ɥ饤�ФϤ����ߤ�����Ǥ��ޤ�����UNIX�ʤ�
-+ドライバはお好みで選択できますが、UNIXなら
- PNG, PPM, Postscipt, XWD, XWINDOW, XSERVE, XTERM
--�����������Ǥ����Τ�����Ū�Ǥ��礦��
--PNG driver���Ȥ߹���ˤϡ�
--((<libpng|URL:http://www.libpng.org/pub/png/png.html>)) ��ɬ�פǤ���
--¾�ˤ⤿������Υɥ饤�Ф��ޤޤ�Ƥ��ޤ�����
--�ץ�󥿥ɥ饤�Ф���ˤϥ���ѥ���λ��˥��顼���Ф��Τ����ä��ꡢ
--GIF�ϥ饤���󥹤˰��óݤ��ä��ꤷ�ޤ���
--
--=== makefile ����
--���Υ��ޥ�ɤ� makefile ��������ޤ���
-+あたりを選んでおくのが一般的でしょう。
-+PNG driverを組み込むには、
-+((<libpng|URL:http://www.libpng.org/pub/png/png.html>)) が必要です。
-+他にもたくさんのドライバが含まれていますが、
-+プリンタドライバの中にはコンパイルの時にエラーが出るものがあったり、
-+GIFはライセンスに引っ掛かったりします。
-+
-+=== makefile 作成
-+次のコマンドで makefile を作成します。
-   ../makemake .. sol2 g77_gcc
--1���ܤΰ���ϥ������Τ���ǥ��쥯�ȥ�λ���Ǥ���
--�����Ǥϥ������ǥ��쥯�ȥ�β��ˤ���Τǡ�((%..%)) ����ꤷ�ޤ���
--2���ܤΰ����OS�μ���ǡ��������ǥ��쥯�ȥ�ˤ���
--((%sys_*%)) �Ȥ����ǥ��쥯�ȥ����� ((%*%)) ����ʬ����ꤷ�ޤ���
--3���ܤΰ���ϥ���ѥ���ʤɤ�����ǡ�sys_* �β��ˤ���
--((%*.conf%)) �Ȥ����ե������ ((%*%)) ����ʬ����ꤷ�ޤ���
--�⤷������ˤʤ���С��Ǥ�᤽���ʤ�Ĥ����Ӥޤ���
--
--makefile ����������顢���äȸ������꤬�������������å����ޤ���
--�����ǡ�PGPLOT ver 5.2.2 �� PNG driver��Ȥ���硢
--�Ǥ��Ф��줿 makefile �ϡ�
-+1番目の引数はソースのあるディレクトリの指定です。
-+ここではソースディレクトリの下にいるので、((%..%)) を指定します。
-+2番目の引数はOSの種類で、ソースディレクトリにある
-+((%sys_*%)) というディレクトリの中の ((%*%)) の部分を指定します。
-+3番目の引数はコンパイラなどの設定で、sys_* の下にある
-+((%*.conf%)) というファイルの ((%*%)) の部分を指定します。
-+もしこの中になければ、最も近そうなやつを選びます。
-+
-+makefile を作成したら、ざっと見て設定が正しいかチェックします。
-+ここで、PGPLOT ver 5.2.2 で PNG driverを使う場合、
-+吐き出された makefile は、
- 
-   pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h
- 
--�Ȥ����ޤ�������ˤʤäƤ���Τǡ����ιԤ������ޤ���
-+というまずい設定になっているので、この行を削除します。
- 
--=== ����ѥ���
--makefile ���Խ������顢�饤�֥��򥳥�ѥ��뤷�ޤ���
-+=== コンパイル
-+makefile を編集したら、ライブラリをコンパイルします。
- 
-   make
-   make cpg
- 
--=== ���󥹥ȡ���
--make install ���Ѱդ���Ƥ��ʤ��Τǡ���ư�ǥ��ԡ����ޤ���
--ɬ�פʤ� root �ˤʤäƤ���������
--�ޤ����󥹥ȡ�����Υǥ��쥯�ȥ��Ķ��ѿ�˥��åȤ��ޤ���
--csh�Ϥʤ顢
-+=== インストール
-+make install が用意されていないので、手動でコピーします。
-+必要なら root になってください。
-+まずインストール先のディレクトリを環境変数にセットします。
-+csh系なら、
- 
-   setenv PREFIX  /usr/local
-   setenv PGPLOT_DIR  ${PREFIX}/pgplot
- 
--���󥹥ȡ�����ϼ�ͳ�����٤ޤ�����
--����ѥ�����˥ѥ����꤬ɬ�פˤʤ뤫�⤷��ޤ���
--����ɬ�פʥե�����򥳥ԡ����ޤ���
-+インストール先は自由に選べますが、
-+コンパイル時にパス指定が必要になるかもしれません。
-+次に必要なファイルをコピーします。
- 
-   cp -p libpgplot.a libpgplot.so* libcpgplot.a ${PREFIX}/lib
-   cp -p cpgplot.h ${PREFIX}/include
-   mkdir ${PGPLOT_DIR}
-   cp -p grfont.dat rgb.txt pgxwin_server ${PGPLOT_DIR}
- 
--����ǥ��󥹥ȡ��뽪λ�Ǥ���
-+これでインストール終了です。
- 
--=== �ǥ�μ¹�
--����ѥ��뤬���ޤ����ä����ɤ����ǥ�ץ��������餻�Ƥߤޤ��礦��
--����ѥ��뤷���ǥ��쥯�ȥ�� pgdemo1 ���� pgdemo17 �ޤǤ� cpgdemo
--�Ȥ����¹ԥե����뤬�Ǥ��Ƥ���Ϥ��Ǥ���������¹ԤǤ����������
--����ѥ��뤵��Ƥ���Ϥ��Ǥ���
-+=== デモの実行
-+コンパイルがうまくいったかどうかデモプログラムを走らせてみましょう。
-+コンパイルしたディレクトリに pgdemo1 から pgdemo17 までと cpgdemo
-+という実行ファイルができているはずです。それらを実行できれば正しく
-+コンパイルされているはずです。
- 
--=== �桼������
--PGPLOT��Ȥ��桼���ϡ��Ķ��ѿ�ؼ������ꤷ�Ƥ����Ȥ褤�Ǥ��礦��
-+=== ユーザ設定
-+PGPLOTを使うユーザは、環境変数へ次の設定しておくとよいでしょう。
-   setenv PGPLOT_DIR  /usr/local/pgplot
-   setenv PGPLOT_DEV  /xwin
--PGPLOT_DIR �Ͼ�ǥ��󥹥ȡ��뤷���ǥ��쥯�ȥ��Ʊ����
--PGPLOT_DEV �ϥǥե���ȤΥǥХ����Ǥ���
--����¾�δĶ��ѿ���ä����ꤷ�ʤ��Ƥ⤤���Ȼפ��ޤ������ܤ�����
--((<����|URL:http://www.astro.caltech.edu/~tjp/pgplot/chapter1.html#ENV>))
--������������
-+PGPLOT_DIR は上でインストールしたディレクトリと同じ、
-+PGPLOT_DEV はデフォルトのデバイスです。
-+その他の環境変数は特に設定しなくてもいいと思いますが、詳しくは
-+((<ここ|URL:http://www.astro.caltech.edu/~tjp/pgplot/chapter1.html#ENV>))
-+をご覧下さい。
- 
- <<< trailer
- 
-diff --git a/doc/method.ja.rd b/doc/method.ja.rd
-index 161e563..46da15e 100644
---- a/doc/method.ja.rd
-+++ b/doc/method.ja.rd
-@@ -1,135 +1,135 @@
- =begin
- = module Pgplot
- 
--== �⥸�塼��᥽�å�
-+== モジュールメソッド
- 
--=== ���
-+=== 操作
- --- pgopen([device])
--PGPLOT���å����򳫻Ϥ��롣����ͤȤ��ƥ��ơ��������֤���
-+PGPLOTセッションを開始する。戻り値としてステータスを返す。
- 
- --- pgbeg([device, [nxsub, [nysub]]])
- (obsolete)
--PGPLOT���å����򳫻Ϥ��롣����ͤȤ��ƥ��ơ��������֤���
-+PGPLOTセッションを開始する。戻り値としてステータスを返す。
- 
- --- pgask( [true|false] )
- 
- --- pgenv( xmin,xmax,ymin,ymax [,just, axis] )
- 
--=== �����ޡ���������
-+=== 線・マーカの描画
- --- pgline( xarray, yarray )
--xarray, yarray ��������������
--xarray, yarray �Ϥ��줾�� X, Y ��ɸ������
-+xarray, yarray を結ぶ線を描く。
-+xarray, yarray はそれぞれ X, Y 座標の配列。
- 
- --- pgpt( xarray, yarray [,symbol] )
--xarray, yarray �ΰ��֤ˡ�symbol �Υޡ�����������
-+xarray, yarray の位置に、symbol のマーカを描く。
- 
- --- pgpnts( xarray, yarray, symarray )
--xarray, yarray �ΰ��֤ˡ��б����� symarray �Υޡ����򤽤줾��������
-+xarray, yarray の位置に、対応する symarray のマーカをそれぞれ描く。
- 
--=== �ҥ��ȥ����
-+=== ヒストグラム
- --- pgbin( xarray, yarray [,center] )
- 
- --- pghist( data, nbin [,range, flag] )
- 
--=== ���顼�С�
-+=== エラーバー
- --- pgerrb( dir, x, y, err [,tlen] )
--���顼�С���������
--tlen ��ü���������С���Ĺ������ꡣ
--+ ��¦���顼�С�:
-+エラーバーを描く。
-+tlen に端点に描くバーの長さを指定。
-++ 片側エラーバー:
-  * dir = 1 for +X (X to X+err)
-  * dir = 2 for +Y (Y to Y+err)
-  * dir = 3 for -X (X to X-err)
-  * dir = 4 for -Y (Y to Y-err)
--+ ξ¦���顼�С�:
-++ 両側エラーバー:
-  * dir = 5 for +/-X (X-err to X+err)
-  * dir = 6 for +/-Y (Y-err to Y+err)
- 
- --- pgerrx( x1, x2, y [,tlen] )
--x1 ���� x2 �ޤǤ��֥��顼�С���������
--tlen ��ü���������С���Ĺ������ꡣ
-+x1 から x2 までを結ぶエラーバーを描く。
-+tlen に端点に描くバーの長さを指定。
- 
- --- pgerry( x, y1, y2 [,tlen] )
--y1 ���� y2 �ޤǤ��֥��顼�С���������
--tlen ��ü���������С���Ĺ������ꡣ
-+y1 から y2 までを結ぶエラーバーを描く。
-+tlen に端点に描くバーの長さを指定。
- 
--=== ������
-+=== 等高線
- --- pgcont( map, cont [,tr] )
--map ��Ϳ�����������ޥåפ���������������
--cont �ˤ��������Υ�٥�ޤ��Ϥ��������Ϳ���롣
-+map で与えた2次元マップの等高線を描く。
-+cont には等高線のレベルまたはその配列を与える。
- 
- --- pgcons( map, cont [,tr] )
--PGCONT���®�����르�륺���������������ʡ�
-+PGCONTより速いアルゴルズムで描くんだそうな。
- 
- --- pgconb( map, cont [,blank, tr] )
--blank��Ϳ�����ͤ��»�ͤȤ�����������������
-+blankで与えた値を欠損値として等高線を描く。
- 
- --- pgconf( map, cont_range [,tr] )
--cont_range �� Range���饹���֥������Ȥ�Ϳ�����ϰϤΥ�٥���ɤ��٤���
-+cont_range に Rangeクラスオブジェクトで与えた範囲のレベルを塗り潰す。
- 
- --- pgconl( map, cont, label [,intval, minint, tr] )
--�������˥�٥��Ĥ��롣
-+等高線にラベルをつける。
- 
--=== ����
-+=== 画像
- --- pgimag( array [,range, tr] )
--���顼��������� array (����������) �β�����������
-+カラースケールで array (2次元配列) の画像を描く。
- 
- --- pgctab( l, r,g,b [,contra,bright] )
--pgimag �ǻ��Ѥ��륫�顼�ơ��֥�����ꤹ�롣
-+pgimag で使用するカラーテーブルを設定する。
- 
- --- pggray( array [,range, tr] )
--���졼��������� array (����������) �β�����������
-+グレースケールで array (2次元配列) の画像を描く。
- 
- --- pgpixl( array [,x1,x2,y1,y2] )
--array (����������) �β�����Ĺ������pixel 1��1�Ĥ�������
-+array (2次元配列) の画像を、長方形のpixel 1つ1つで描く。
- 
- --- pgvect( x, y [,scale, pos, tr, blank] )
--�٥��ȥ���������
-+ベクトル場を描く。
- 
--=== ��ɸ��������
-+=== 座標軸の描画
- --- pgtick( x1, y1, x2, y2, v, [str], {"tickl", "tickr", "disp", "orient"} )
- 
- --- pgaxis( x1, y1, x2, y2, v1, v2,
-          {"opt", "step", "nsub", "tickl", "tickr", "frac", "disp", "orient"} )
- 
--=== ������������
-+=== カーソル入力
- --- pgcurs([x,y])
--����å��ޤ��ϥ��������פΥ��٥�Ȥ�������롣
--x,y ����ꤹ��ȻϤ�ˤ��ΰ��֤˥���������ư���롣
--���٥�Ȥ���������
--�����������(WC)��ʸ���� PgCursor���饹�Υ��󥹥��󥹤��֤���
-+クリックまたはキータイプのイベントを取得する。
-+x,y を指定すると始めにその位置にカーソルを移動する。
-+イベントを取得すると
-+カーソル位置(WC)と文字を PgCursorクラスのインスタンスで返す。
- 
- --- pgband( mode, [ xref, yref, [x, y, [posn]]])
--����å��ޤ��ϥ��������פΥ��٥�Ȥ�������롣
--x,y ����ꤹ��ȻϤ�ˤ��ΰ��֤˥���������ư���롣
--xref, yref �ϥ��󥫡����ΰ���(���)�ǡ���ά����ȸ��߰��֤Ȥʤ롣
--���٥�Ȥ���������
--�����������(WC)��ʸ���� PgCursor���饹�Υ��󥹥��󥹤��֤���
--mode�ˤ�ꥫ�������������������ˡ�����Ǥ��롣
-- * mode=0 : ����ʤ���
-- * mode=1 : ���󥫡����ȥ��������������
-- * mode=2 : ���󥫡����ȥ���������гѤȤ���Ĺ������
-- * mode=3 : ���󥫡����ȥ���������֤��줾����̤룲�ܤο�ʿ����
-- * mode=4 : ���󥫡����ȥ���������֤��줾����̤룲�ܤο�ľ����
-- * mode=5 : ����������֤��̤��ʿ����
-- * mode=6 : ����������֤��̤��ľ����
-- * mode=7 : ����������֤��̤뽽������
-+クリックまたはキータイプのイベントを取得する。
-+x,y を指定すると始めにその位置にカーソルを移動する。
-+xref, yref はアンカー点の位置(後述)で、省略すると現在位置となる。
-+イベントを取得すると
-+カーソル位置(WC)と文字を PgCursorクラスのインスタンスで返す。
-+modeによりカーソル入力中の描画方法を指定できる。
-+ * mode=0 : 描画なし。
-+ * mode=1 : アンカー点とカーソルを結ぶ線。
-+ * mode=2 : アンカー点とカーソルを対角とする長方形。
-+ * mode=3 : アンカー点とカーソル位置それぞれを通る2本の水平線。
-+ * mode=4 : アンカー点とカーソル位置それぞれを通る2本の垂直線。
-+ * mode=5 : カーソル位置を通る水平線。
-+ * mode=6 : カーソル位置を通る垂直線。
-+ * mode=7 : カーソル位置を通る十字線。
- 
- --- pgolin( x, y, [sym, [npt]] )
--�ޥ�����������Ǻ�ɸ��Ϣ³�������Ϥ��롣
--x,y �ˤϤ��餫���� NArray::SFLOAT ���������Ϳ���Ƥ�����
--�����إ���å��������֤˺�ɸ��Ͽ���Ƥ�����
--���ϤǤ���Ŀ�Ϥ�������Υ����������¤���롣
--������������Ϥ������ϡ��ޡ��� sym �����褵��롣
--npt ����ꤹ��ȡ����餫���� npt �Ĥ��������Ϥ���Ƥ���Ȥߤʤ���
--����ͤ����Ϥ������ο�
-+マウスカーソルで座標を連続して入力する。
-+x,y にはあらかじめ NArray::SFLOAT 型の配列を与えておき、
-+そこへクリックした順番に座標を記録していく。
-+入力できる個数はこの配列のサイズで制限される。
-+カーソルで入力した点は、マーカ sym で描画される。
-+npt を指定すると、あらかじめ npt 個の点が入力されているとみなす。
-+戻り値は入力した点の数。
- 
- --- pgncur( x, y, [sym, [npt]] )
--x,y�˵�Ͽ�������֤� x �ξ�������Ǥ��뤳�Ȥ������pgolin ��Ʊ����
-+x,yに記録される順番が x の小さい順であることを除き、pgolin と同じ。
- 
- --- pglcur( x, y, [npt] )
--���Ϥ�������������������뤳�Ȥ�����ơ�pgolin ��Ʊ����
-+入力した点を結ぶ線が描かれることを除いて、pgolin と同じ。
- 
--=== ���ơ��������֤�
-+=== ステータスを返す
- --- pgqinf(item)
-   value = pgqinf(item)
- 
-diff --git a/doc/tutorial-01.ja.rd b/doc/tutorial-01.ja.rd
-index 4b0f112..7613c5e 100644
---- a/doc/tutorial-01.ja.rd
-+++ b/doc/tutorial-01.ja.rd
-@@ -1,72 +1,72 @@
- =begin
--= Ruby/PGPLOT Ƴ����
-+= Ruby/PGPLOT 導入編
- 
--== �ޤ�������դ�����
-+== 折れ線グラフを描く
- 
--Ruby/PGPLOT���ޤ�������դ������Ǿ��¤Υ�����ץȤϡ��ʲ��Τ褦�ˤʤ�ޤ���
-+Ruby/PGPLOTで折れ線グラフを描く最小限のスクリプトは、以下のようになります。
- 
-   require 'narray'
-   require 'pgplot'
-   include Pgplot
--  pgopen                           # �ǥХ����򳫤�
--  pgenv( 0, 5, 0, 5 )              # �Ȥ����������
--  pgline( [1,2,3,4], [1,4,1,4] )   # �ޤ���������
-+  pgopen                           # デバイスを開く
-+  pgenv( 0, 5, 0, 5 )              # 枠の設定と描画
-+  pgline( [1,2,3,4], [1,4,1,4] )   # 折れ線の描画
- 
--�ʲ����Υ�����ץȤˤĤ��ƾܤ����������ޤ���
--1���ܡ�2���ܤdz�ĥ�饤�֥�����ɤ��ޤ���
-+以下このスクリプトについて詳しく説明します。
-+1行目、2行目で拡張ライブラリをロードします。
- 
--3���ܤǤ� Pgplot�⥸�塼��򥤥󥯥롼�ɤ��Ƥ��ޤ���
--����򤷤ʤ��� Pgplot�Υ᥽�åɤ�Ƥ֤Ȥ���``Pgplot.pgopen'' �Ȥ����褦��
--�⥸�塼��̾��᥽�åɤ����˾�ά���ʤ��ǽ񤫤ʤ���Фʤ�ޤ���
--���󥯥롼�ɤ��뤫�ɤ����Ͼ��ˤ��ޤ���
--Pgplot�⥸�塼��Υ᥽�å�̾��(���ΤȤ���)�� ``pg'' �ǻϤޤäƤ���Τǡ�
--����Ĥ����̾�����֤Ĥ����Ψ���㤤�Ȼפ��ޤ�����
--�μ¤�����ʤ饤�󥯥롼�ɤ��ʤ������褤���⤷��ޤ���
-+3行目では Pgplotモジュールをインクルードしています。
-+これをしないと Pgplotのメソッドを呼ぶとき、``Pgplot.pgopen'' というように
-+モジュール名をメソッドの前に省略しないで書かなければなりません。
-+インクルードするかどうかは場合によります。
-+Pgplotモジュールのメソッド名は(今のところ)皆 ``pg'' で始まっているので、
-+気をつければ名前がぶつかる確率は低いと思いますが、
-+確実を期すならインクルードしない方がよいかもしれません。
- 
--4���ܤ� pgopen �� PGPLOT �Υ���ե������ǥХ����򳫤��ޤ���
--�����ǰ����񤫤ʤ��Ȼ��Ѥ���ǥХ�����ʹ���Ƥ��ޤ���
-+4行目の pgopen で PGPLOT のグラフィクスデバイスを開きます。
-+ここで引数を書かないと使用するデバイスを聞いてきます。
- 
--  Graphics device/type (? to see list, default /xwin): 
-+  Graphics device/type (? to see list, default /xwin):
- 
--�ǥե���ȤΤޤޤ��ɤ����ñ�˥꥿���󥭡��򲡤��ޤ���
--�ǥե���ȤΥǥХ����ϴĶ��ѿ� PGPLOT_DEV �����ꤷ����ΤˤʤäƤ��ޤ���
--`?'�ȥ꥿������Ǥ�����ȡ����ѤǤ���ǥХ����ΰ�����ɽ�������Τǡ�
--�����椫���̤ΥǥХ��������򤹤뤳�Ȥ�Ǥ��ޤ���
--�㤨�С�PNG�Ȥ��ƥե�����˽񤭽Ф������Ȥ��ϡ�
--``plot1.png/png'' �Τ褦�ˡ֥ե�����̾/�ǥХ���̾�פȤ����褦�˻��ꤷ�ޤ���
-+デフォルトのままで良ければ単にリターンキーを押します。
-+デフォルトのデバイスは環境変数 PGPLOT_DEV で設定したものになっています。
-+`?'とリターンを打ち込むと、使用できるデバイスの一覧が表示されるので、
-+その中から別のデバイスを選択することもできます。
-+例えば、PNGとしてファイルに書き出したいときは、
-+``plot1.png/png'' のように「ファイル名/デバイス名」というように指定します。
- 
--5���ܤ�
-+5行目の
- 
-   pgenv( 0, 5, 0, 5 )
- 
--�ˤ�ꡢ����դμ�����ꤷ���Ȥ����������褷�ޤ���
--����� x-min, x-max, y-min, y-max �ν�Ǥ���
--�����Ǥ�X����0����5��Y����0����5�ޤǤ��ϰϤ��Ȥ������ޤ���
--�ʹߤϤ��������ꤵ�줿��ɸ���Ȥ����褷�ޤ���
-+により、グラフの軸を決定し、枠と目盛を描画します。
-+引数は x-min, x-max, y-min, y-max の順です。
-+ここではX軸が0から5、Y軸が0から5までの範囲の枠を描きます。
-+以降はここで設定された座標をもとに描画します。
- 
--�����Ƥ��褤�衢6���ܤ�
-+そしていよいよ、6行目の
- 
-   pgline( [1,2,3,4], [1,4,1,4] )
- 
--�ǡ��ޤ�������դ������ޤ���
--����ˤ�����������X��ɸ��Y��ɸ�򤽤줾��������Ϥ��ޤ���
-+で、折れ線グラフを描きます。
-+引数には線を結ぶ点のX座標とY座標をそれぞれ配列で渡します。
- 
--�����ޤ���������С����Τ褦�ʥ���դ�������Ƥ���Ϥ��Ǥ���
-+ここまで成功すれば、このようなグラフが描かれているはずです。
- <<< plot1.png
- 
--�ʾ夬�ޤ�������դ������Τ˺����ɬ�פʥ᥽�åɤǤ���
-+以上が折れ線グラフを描くのに最低限必要なメソッドです。
- 
--�Ȥ���ǡ����Υ�����ץȤˤϥǥХ������Ĥ���᥽�åɤ�����ޤ���
--C��FORTRAN�Ǥ�PGPLOT�Ǥ���С�
--�����ǺǸ�� pgend ��Ƥ�ǥǥХ������Ĥ���ɬ�פ�����ޤ���
--�������ʤ��ȡ��ǥХ����� Postscript �ʤɤΤȤ���
--��λ����������ʤ��Τǡ��Դ����ʥե����뤬�Ǥ��Ƥ��ޤ��ޤ���
--������ Ruby/PGPLOT�Ǥϡ�Ruby���󥿥ץ꥿��λ����
--pgend ��ưŪ�˸Ƥ֤褦�ˤʤäƤ���Τǡ�
--ɬ������Ǹ�� pgend ��Ƥ�ɬ�פϤ���ޤ���
--������Ruby�μ¹������PGPLOT��λ�������Ȥ��Τ����
--Ruby�ǤǤ� pgend �᥽�åɤ��Ѱդ��Ƥ���ޤ���
-+ところで、このスクリプトにはデバイスを閉じるメソッドがありません。
-+CかFORTRAN版のPGPLOTであれば、
-+ここで最後に pgend を呼んでデバイスを閉じる必要があります。
-+そうしないと、デバイスが Postscript などのとき、
-+終了処理がされないので、不完全なファイルができてしまいます。
-+しかし Ruby/PGPLOTでは、Rubyインタプリタ終了時に
-+pgend を自動的に呼ぶようになっているので、
-+必ずしも最後に pgend を呼ぶ必要はありません。
-+ただしRubyの実行途中でPGPLOTを終了したいときのために
-+Ruby版でも pgend メソッドは用意してあります。
- 
--�ʲ�³��(���⤷��ʤ�)
-+以下続く(かもしれない)
- <<< trailer
- =end
diff --git a/debian/patches/0003-Close-files-in-cogen.rb.patch b/debian/patches/0003-Close-files-in-cogen.rb.patch
new file mode 100644
index 0000000..46c1cc7
--- /dev/null
+++ b/debian/patches/0003-Close-files-in-cogen.rb.patch
@@ -0,0 +1,29 @@
+From 7d4f2b015b42d7feaba081693c070777e97b648d Mon Sep 17 00:00:00 2001
+From: David MacMahon <davidm at astro.berkeley.edu>
+Date: Sun, 3 Mar 2013 11:03:03 -0800
+Subject: [PATCH 3/9] Close files in cogen.rb
+
+This is important for running cogen.rb from within Rakefile.  Without
+explicitly closing the output file, a truncated version of rb_pgplot.c
+may be packaged in the gem file before the rb_pgplot.c file gets closed
+when the rake process exits.
+---
+ ext/cogen.rb | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/ext/cogen.rb b/ext/cogen.rb
+index aabbae4..d5cebdc 100644
+--- a/ext/cogen.rb
++++ b/ext/cogen.rb
+@@ -153,6 +153,8 @@ def cogen_pgplot
+       fout.print
+     end
+   end
++  fout.close
++  fin.close
+ end
+ 
+ cogen_pgplot if $0 == __FILE__
+-- 
+2.1.0
+
diff --git a/debian/patches/0003-Update-Cogen-for-Ruby1.9.2.patch b/debian/patches/0003-Update-Cogen-for-Ruby1.9.2.patch
deleted file mode 100644
index 70b4b0b..0000000
--- a/debian/patches/0003-Update-Cogen-for-Ruby1.9.2.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From: Youhei SASAKI <uwabami at gfd-dennou.org>
-Date: Fri, 1 Jun 2012 18:57:48 +0900
-Subject: Update Cogen for Ruby1.9.2
-
-Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
----
- cogen.rb |   10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
-
-diff --git a/cogen.rb b/cogen.rb
-index 2494f5f..15c4174 100644
---- a/cogen.rb
-+++ b/cogen.rb
-@@ -120,6 +120,10 @@ def pgfuncgen(name, inp, out)
-     retn = "rb_ary_new3(#{nout},"+retn.join(",")+")"
-   end
- 
-+  unless retn.class == String
-+    retn = retn.join(" ")
-+  end
-+
-   prot = prot.join(",")
-   pass = pass.join(",")
- 
-@@ -127,7 +131,7 @@ def pgfuncgen(name, inp, out)
- static VALUE
-   rb_pgplot_#{name}(#{prot})
- {
--  #{vars}
-+  #{vars.join(" ")}
-   c#{name}(#{pass});
-   return #{retn};
- }
-@@ -143,8 +147,8 @@ def cogen_pgplot
-       $pgfuncs.each{|x| fout.print pgfuncgen(*x)}
-     elsif /--- auto-generated defs will be placed here ---/  =~ l
-       $pgfuncs.each{|x|
--	n = x[1].split(",").size
--	fout.print "  rb_define_module_function(mPgplot,\"#{x[0]}\",rb_pgplot_#{x[0]},#{n});\n"}
-+        n = x[1].split(",").size
-+        fout.print "  rb_define_module_function(mPgplot,\"#{x[0]}\",rb_pgplot_#{x[0]},#{n});\n"}
-     else
-       fout.print
-     end
diff --git a/debian/patches/0004-Be-smart-about-extra-library-checks.patch b/debian/patches/0004-Be-smart-about-extra-library-checks.patch
new file mode 100644
index 0000000..abe689e
--- /dev/null
+++ b/debian/patches/0004-Be-smart-about-extra-library-checks.patch
@@ -0,0 +1,171 @@
+From e298079fb35e4b6ad3dd38b7745f4409816f5691 Mon Sep 17 00:00:00 2001
+From: David MacMahon <davidm at astro.berkeley.edu>
+Date: Sun, 3 Mar 2013 11:04:45 -0800
+Subject: [PATCH 4/9] Be smart about extra library checks
+
+Try to find libcpgplot before looking for extra libs like x11, gfortran,
+png, etc.  If the initial check for libcpgplot fails, then look for the
+extra libraries and re-check for libcpgplot.  This removes the need for
+the --enable-extra-libs option.
+---
+ ext/extconf.rb | 132 ++++++++++++++++++++++++++++-----------------------------
+ 1 file changed, 66 insertions(+), 66 deletions(-)
+
+--- ruby-pgplot.orig/ext/extconf.rb
++++ ruby-pgplot/ext/extconf.rb
+@@ -15,19 +15,6 @@
+ 
+ #$DEBUG = true
+ 
+-# Allow user to pass --disable-extra-libs to prevent checking for some libs.
+-# Some PGPLOT installations need these extra checks and the extra checks are
+-# mostly benign for PGPLOT installations that don't need them so the extra
+-# checks are enabled by default.  The extra checks can cause problems on some
+-# installations where they are not necessary.
+-check_extra_libs = enable_config('extra-libs', true)
+-
+-# configure options:
+-#  --with-x11-dir=path
+-#  --with-x11-include=path
+-#  --with-x11-lib=path
+-dir_config("x11") if check_extra_libs
+-
+ # configure options:
+ #  --with-pgplot-dir=path
+ #  --with-pgplot-include=path
+@@ -75,68 +62,81 @@
+   exit unless have_library("narray","na_make_object")
+ end
+ 
+-if check_extra_libs
+-  # Check FORTRAN Libraries
+-  #
+-  # SUN WorkShop FORTRAN 77 compiler ver5.0
+-  # configure options: --with-sunws
+-  if with_config("sunws")
+-    $libs = "-lM77 -lsunmath "+$libs
+-    exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
+-    $defs.push "-DSPARC_FORTRAN"
+-  #
+-  # GNU FORTRAN v4
+-  elsif have_library("gfortran")
+-    $CFLAGS = "-Wall "+$CFLAGS
+-    $defs.push "-DGNU_FORTRAN"
+-  #
+-  # GNU FORTRAN v3
+-  elsif have_library("g77")
+-    $CFLAGS = "-Wall "+$CFLAGS
+-    $defs.push "-DGNU_FORTRAN"
+-  else
+-    puts "failed"
+-    exit
+-  end
+-
+-  # Check GrWin Library (for cygwin (and mingw32?))
+-  #  configure options: --with-grwin
+-  if with_config("grwin")
+-    #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
+-    if RUBY_PLATFORM =~ /cygwin|mingw/
+-      $libs += " -mwindows"
+-    end
+-    exit unless have_library("GrWin", "GWinit")
+-  end
+-
+-  $found_lib = []
+-
+-  # Check X11 Library
+-  if have_library("X11", "XOpenDisplay")
+-    $found_lib << 'X11'
+-  end
+-
+-  # Check PNG Library
+-  libs_save = $libs
+-  $libs = append_library($libs, "z")
+-  if have_library("png","png_create_write_struct")
+-    $found_lib << 'png'
+-  else
+-    $libs = libs_save
+-  end
+-
+-  $libs = append_library($libs, "pgplot")
+-end # check_extra_libs
+-
+ $have_pgplot = false
+ 
+ # Check PGPLOT Header
+ if have_header("cpgplot.h")
+ 
+-  # Check PGPLOT Library
++  # Check PGPLOT Library without extra libs
+   if find_library("cpgplot","cpgbeg", "/usr/lib",
+ 		  "/usr/local/lib", "/usr/local/pgplot" )
+     $have_pgplot = true
++  else
++    # Check for extra libs then re-check for PGPLOT library
++    puts "First check for PGPLOT library failed,"
++    puts "checking for auxiliary libraries and retrying."
++
++    # Check FORTRAN Libraries
++    #
++    # SUN WorkShop FORTRAN 77 compiler ver5.0
++    # configure options: --with-sunws
++    if with_config("sunws")
++      $libs = "-lM77 -lsunmath "+$libs
++      exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
++      $defs.push "-DSPARC_FORTRAN"
++    #
++    # GNU FORTRAN v4
++    elsif have_library("gfortran")
++      $CFLAGS = "-Wall "+$CFLAGS
++      $defs.push "-DGNU_FORTRAN"
++    #
++    # GNU FORTRAN v3
++    elsif have_library("g77")
++      $CFLAGS = "-Wall "+$CFLAGS
++      $defs.push "-DGNU_FORTRAN"
++    else
++      puts "failed"
++      exit
++    end
++
++    # Check GrWin Library (for cygwin (and mingw32?))
++    #  configure options: --with-grwin
++    if with_config("grwin")
++      #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
++      if RUBY_PLATFORM =~ /cygwin|mingw/
++        $libs += " -mwindows"
++      end
++      exit unless have_library("GrWin", "GWinit")
++    end
++
++    $found_lib = []
++
++    # configure options:
++    #  --with-x11-dir=path
++    #  --with-x11-include=path
++    #  --with-x11-lib=path
++    dir_config("x11")
++
++    # Check X11 Library
++    if have_library("X11", "XOpenDisplay")
++      $found_lib << 'X11'
++    end
++
++    # Check PNG Library
++    libs_save = $libs
++    $libs = append_library($libs, "z")
++    if have_library("png","png_create_write_struct")
++      $found_lib << 'png'
++    else
++      $libs = libs_save
++    end
++
++    $libs = append_library($libs, "pgplot")
++
++    if find_library("cpgplot","cpgbeg", "/usr/lib",
++        "/usr/local/lib", "/usr/local/pgplot" )
++      $have_pgplot = true
++    end
+   end
+ end
+ 
diff --git a/debian/patches/0005-extconf.rb.patch b/debian/patches/0005-extconf.rb.patch
new file mode 100644
index 0000000..80b0f7d
--- /dev/null
+++ b/debian/patches/0005-extconf.rb.patch
@@ -0,0 +1,327 @@
+From a60b9e464fdfb6e200d81eaa29c242f5eb619a9e Mon Sep 17 00:00:00 2001
+From: Masahiro TANAKA <masa16.tanaka at gmail.com>
+Date: Tue, 5 Mar 2013 18:46:58 +0900
+Subject: [PATCH 5/9] extconf.rb: * need to check extra-libs before auto-build.
+ * need to define $found_lib. * define methods to make program structure
+ clear. * merge extconf-auto.rb.
+
+---
+ ext/extconf.rb | 278 +++++++++++++++++++++++++++++++++++----------------------
+ 1 file changed, 170 insertions(+), 108 deletions(-)
+
+--- ruby-pgplot.orig/ext/extconf.rb
++++ ruby-pgplot/ext/extconf.rb
+@@ -1,30 +1,67 @@
+-# extconf.rb : Configure script for Ruby/PGPLOT
+-#
+-#   Copyright (c) 2000,2001 Masahiro TANAKA <masa at ir.isas.ac.jp>
+-#
+-#   This program is free software.
+-#   You can distribute/modify this program
+-#   under the same terms as Ruby itself.
+-#   NO WARRANTY.
+-#
+-# usage: ruby extconf.rb [configure options]
+-
+-# Narray is now Gem based, so require rubygems
+-# so that we can use Gem class to find narray.
+ require "mkmf"
+ 
+-#$DEBUG = true
++def main
++  extconf_start
++  check_narray
++
++  $objs = %w(rb_pgplot.o kwarg.o)
++  $enable_autobuild = enable_config('autobuild', false)
++  $found_lib = []
++
++  # Check PGPLOT Header
++  if have_header("cpgplot.h")
++    if have_library("cpgplot","cpgbeg")
++      create_makefile("pgplot")
++      exit
++    end
++
++    # Check for extra libs then re-check for PGPLOT library
++    puts "First check for PGPLOT library failed."
++    check_extra_libs
++    $libs = append_library($libs, "pgplot")
++
++    if have_library("cpgplot","cpgbeg")
++      create_makefile("pgplot")
++      exit
++    end
++  elsif $enable_autobuild
++    check_extra_libs
++  end
++
++  if $enable_autobuild
++    autobuild_pgplot
++  else
++    puts "
++The PGPLOT library was not found.  To auto-build PGPLOT library
++as part of installing Ruby/PGPLOT, pass the --enable-autobuild option.
++
++Examples:
++     Gem install:  gem install pgplot -- --enable-autobuild
++  Manual install:  ruby extconf.rb --enable-autobuild
++"
++  end
++end
++
++
++def extconf_start
++  # configure options:
++  #  --with-pgplot-dir=path
++  #  --with-pgplot-include=path
++  #  --with-pgplot-lib=path
++  dir_config("pgplot")
++
++  # configure options:
++  #  --with-x11-dir=path
++  #  --with-x11-include=path
++  #  --with-x11-lib=path
++  dir_config("x11")
++
++  # Otherwise you can also specify:
++  #  --with-opt-dir=path
++  #  --with-opt-include=path
++  #  --with-opt-lib=path
++end
+ 
+-# configure options:
+-#  --with-pgplot-dir=path
+-#  --with-pgplot-include=path
+-#  --with-pgplot-lib=path
+-dir_config("pgplot")
+-
+-# Otherwise you can also specify:
+-#  --with-opt-dir=path
+-#  --with-opt-include=path
+-#  --with-opt-lib=path
+ 
+ def find_dir_w_file(d,h)
+   g = Dir.glob(RbConfig.expand(d+"/"+h))
+@@ -42,107 +79,132 @@
+   nil
+ end
+ 
+-# Check NArray
+-gems_dir="$(rubylibprefix)/gems/$(ruby_version)/gems/"
+-narray_d="narray-0.[56].*"
+-narray_h="narray.h"
+-if narray_h_dir =
+-    find_dir_in_gemspec ||
+-    find_dir_w_file("../"+narray_d,narray_h) ||
+-    find_dir_w_file(gems_dir+narray_d,narray_h) ||
+-    find_dir_w_file(CONFIG['vendorarchdir'],narray_h) ||
+-    find_dir_w_file(CONFIG['sitearchdir'],narray_h) ||
+-    find_dir_w_file(CONFIG['archdir'],narray_h) 
+-  $CPPFLAGS = " -I#{narray_h_dir} " + $CPPFLAGS
+-end
+-exit unless have_header("narray.h")
+-
+-if RUBY_PLATFORM =~ /cygwin|mingw/
+-  $LDFLAGS = " -L#{CONFIG['sitearchdir']} "+$LDFLAGS
+-  exit unless have_library("narray","na_make_object")
+-end
+-
+-$have_pgplot = false
+-
+-# Check PGPLOT Header
+-if have_header("cpgplot.h")
+-
+-  # Check PGPLOT Library without extra libs
+-  if find_library("cpgplot","cpgbeg", "/usr/lib",
+-		  "/usr/local/lib", "/usr/local/pgplot" )
+-    $have_pgplot = true
+-  else
+-    # Check for extra libs then re-check for PGPLOT library
+-    puts "First check for PGPLOT library failed,"
+-    puts "checking for auxiliary libraries and retrying."
+ 
+-    # Check FORTRAN Libraries
+-    #
+-    # SUN WorkShop FORTRAN 77 compiler ver5.0
+-    # configure options: --with-sunws
+-    if with_config("sunws")
+-      $libs = "-lM77 -lsunmath "+$libs
+-      exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
+-      $defs.push "-DSPARC_FORTRAN"
+-    #
+-    # GNU FORTRAN v4
+-    elsif have_library("gfortran")
+-      $CFLAGS = "-Wall "+$CFLAGS
+-      $defs.push "-DGNU_FORTRAN"
+-    #
+-    # GNU FORTRAN v3
+-    elsif have_library("g77")
+-      $CFLAGS = "-Wall "+$CFLAGS
+-      $defs.push "-DGNU_FORTRAN"
+-    else
+-      puts "failed"
+-      exit
+-    end
++def check_narray
++  gems_dir="$(rubylibprefix)/gems/$(ruby_version)/gems/"
++  narray_d="narray-0.[56].*"
++  narray_h="narray.h"
++  if narray_h_dir =
++      find_dir_in_gemspec ||
++      find_dir_w_file("../"+narray_d,narray_h) ||
++      find_dir_w_file(gems_dir+narray_d,narray_h) ||
++      find_dir_w_file(CONFIG['vendorarchdir'],narray_h) ||
++      find_dir_w_file(CONFIG['sitearchdir'],narray_h) ||
++      find_dir_w_file(CONFIG['archdir'],narray_h)
++    $CPPFLAGS = " -I#{narray_h_dir} " + $CPPFLAGS
++  end
++  exit unless have_header("narray.h")
+ 
+-    # Check GrWin Library (for cygwin (and mingw32?))
+-    #  configure options: --with-grwin
+-    if with_config("grwin")
+-      #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
+-      if RUBY_PLATFORM =~ /cygwin|mingw/
+-        $libs += " -mwindows"
+-      end
+-      exit unless have_library("GrWin", "GWinit")
+-    end
++  if RUBY_PLATFORM =~ /cygwin|mingw/
++    $LDFLAGS = " -L#{CONFIG['sitearchdir']} "+$LDFLAGS
++    exit unless have_library("narray","na_make_object")
++  end
++end
+ 
+-    $found_lib = []
+ 
+-    # configure options:
+-    #  --with-x11-dir=path
+-    #  --with-x11-include=path
+-    #  --with-x11-lib=path
+-    dir_config("x11")
+-
+-    # Check X11 Library
+-    if have_library("X11", "XOpenDisplay")
+-      $found_lib << 'X11'
+-    end
++def check_extra_libs
++  # Check FORTRAN Libraries
++  #
++  # SUN WorkShop FORTRAN 77 compiler ver5.0
++  # configure options: --with-sunws
++  if with_config("sunws")
++    $libs = "-lM77 -lsunmath "+$libs
++    exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
++    $defs.push "-DSPARC_FORTRAN"
++  #
++  # GNU FORTRAN v4
++  elsif have_library("gfortran")
++    $CFLAGS = "-Wall "+$CFLAGS
++    $defs.push "-DGNU_FORTRAN"
++  #
++  # GNU FORTRAN v3
++  elsif have_library("g77")
++    $CFLAGS = "-Wall "+$CFLAGS
++    $defs.push "-DGNU_FORTRAN"
++  else
++    puts "failed"
++    exit
++  end
+ 
+-    # Check PNG Library
+-    libs_save = $libs
+-    $libs = append_library($libs, "z")
+-    if have_library("png","png_create_write_struct")
+-      $found_lib << 'png'
+-    else
+-      $libs = libs_save
++  # Check GrWin Library (for cygwin (and mingw32?))
++  #  configure options: --with-grwin
++  if with_config("grwin")
++    #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
++    if RUBY_PLATFORM =~ /cygwin|mingw/
++      $libs += " -mwindows"
+     end
++    exit unless have_library("GrWin", "GWinit")
++  end
+ 
+-    $libs = append_library($libs, "pgplot")
++  # Check X11 Library
++  if have_library("X11", "XOpenDisplay")
++    $found_lib << 'X11'
++  end
+ 
+-    if find_library("cpgplot","cpgbeg", "/usr/lib",
+-        "/usr/local/lib", "/usr/local/pgplot" )
+-      $have_pgplot = true
+-    end
++  # Check PNG Library
++  libs_save = $libs
++  $libs = append_library($libs, "z")
++  if have_library("png","png_create_write_struct")
++    $found_lib << 'png'
++  else
++    $libs = libs_save
+   end
+ end
+ 
+-$objs = %w(rb_pgplot.o kwarg.o)
+ 
+-if $have_pgplot
++def autobuild_pgplot
++  # Exit unless a fortran compiler was found
++  exit unless %w[gfortran g77].any?{|cmd| system("which #{cmd}")}
++  puts "enabling auto-build PGPLOT Library..."
++
++  $subdir = 'build_lib'
++  $CFLAGS = "-I#{$subdir}/build "+$CFLAGS
++  $LDFLAGS = "-L#{$subdir}/build "+$LDFLAGS
++  $libs = append_library($libs, "cpgplot")
++  $defs.push '-DPGPLOT_DIR=\\"$(PGPLOT_DIR)\\"'
++
+   # Generate Makefile
+   create_makefile("pgplot")
++
++  # Append PGPLOT install task to Makefile
++  exit unless $makefile_created
++  puts "appending extra install tasks to Makefile"
++  File.open("Makefile","a") do |w|
++    w.print "
++PGPLOT_DIR = $(RUBYARCHDIR)/pgplot
++PGPLOT_BUILD = #{$subdir}/build
++
++$(PGPLOT_BUILD)/libcpgplot.a:
++	(cd #{$subdir}; make build/libcpgplot.a)
++$(PGPLOT_BUILD)/cpgplot.h: $(PGPLOT_BUILD)/libcpgplot.a
++rb_pgplot.o: $(PGPLOT_BUILD)/cpgplot.h
++$(DLLIB): $(PGPLOT_BUILD)/libcpgplot.a
++
++install: install-pgplot
++install-pgplot:
++	$(MAKEDIRS) $(PGPLOT_DIR)
++	$(INSTALL_DATA) $(PGPLOT_BUILD)/grfont.dat $(PGPLOT_DIR)
++	$(INSTALL_DATA) $(PGPLOT_BUILD)/rgb.txt $(PGPLOT_DIR)
++"
++    if $found_lib.include? "X11"
++      w.print \
++"	$(INSTALL_PROG) $(PGPLOT_BUILD)/pgxwin_server $(PGPLOT_DIR)
++
++$(PGPLOT_BUILD)/pgxwin_server: $(PGPLOT_BUILD)/cpgplot.h
++	(cd #{$subdir}; make build/pgxwin_server)
++$(DLLIB): $(PGPLOT_BUILD)/pgxwin_server
++"
++    end
++  end
++
++  puts "creating #{$subdir}/drivers.conf"
++  File.open("#{$subdir}/drivers.conf","w") do |w|
++    w.puts "GIDRIV PPDRIV PSDRIV"
++    w.puts "PNDRIV" if $found_lib.include? "png"
++    w.puts "WDDRIV XWDRIV" if $found_lib.include? "X11"
++  end
++
++  puts "Ready to download and auto-build PGPLOT !!"
+ end
++
++main
diff --git a/debian/patches/0006-rm-extconf-auto.rb.patch b/debian/patches/0006-rm-extconf-auto.rb.patch
new file mode 100644
index 0000000..591746e
--- /dev/null
+++ b/debian/patches/0006-rm-extconf-auto.rb.patch
@@ -0,0 +1,138 @@
+From 313ac1b4e97bb5720a888f6006e3965e711aaff3 Mon Sep 17 00:00:00 2001
+From: Masahiro TANAKA <masa16.tanaka at gmail.com>
+Date: Tue, 5 Mar 2013 18:48:57 +0900
+Subject: [PATCH 6/9] rm extconf-auto.rb
+
+---
+ ext/extconf-auto.rb | 89 -----------------------------------------------------
+ pgplot.gemspec      |  4 +--
+ 2 files changed, 1 insertion(+), 92 deletions(-)
+ delete mode 100644 ext/extconf-auto.rb
+
+diff --git a/ext/extconf-auto.rb b/ext/extconf-auto.rb
+deleted file mode 100644
+index 5891862..0000000
+--- a/ext/extconf-auto.rb
++++ /dev/null
+@@ -1,89 +0,0 @@
+-# extconf.rb : Configure script for Ruby/PGPLOT
+-#
+-#   Copyright (c) 2000,2001 Masahiro TANAKA <masa at ir.isas.ac.jp>
+-#
+-#   This program is free software.
+-#   You can distribute/modify this program
+-#   under the same terms as Ruby itself.
+-#   NO WARRANTY.
+-#
+-# usage: ruby extconf.rb [configure options]
+-
+-# Narray is now Gem based, so require rubygems
+-# so that we can use Gem class to find narray.
+-
+-load "./extconf.rb"
+-
+-# Exit if user did not specify "--enable-autobuild"
+-if !enable_config('autobuild', false)
+-  # Print reminder about --enable-autobuild option if pgplot was not found
+-  if !$have_pgplot
+-    puts
+-    puts "The PGPLOT library was not found.  To auto-build it as part of"
+-    puts "installing Ruby/PGLOT, pass the --enable-autobuild option."
+-    puts
+-    puts "Examples:"
+-    puts
+-    puts "   Gem install:  gem install pgplot -- --enable-autobuild"
+-    puts "Manual install:  ruby extconf.rb --enable-autobuild"
+-  end
+-  exit
+-end
+-# Exit if pgplot library was found
+-exit if $have_pgplot
+-# Exit unless a fortran compiler was found
+-exit unless %w[gfortran g77].any?{|cmd| system("which #{cmd}")}
+-
+-puts "enabling auto-build PGPLOT Library..."
+-
+-$subdir = 'build_lib'
+-
+-$CFLAGS = "-I#{$subdir}/build "+$CFLAGS
+-$LDFLAGS = "-L#{$subdir}/build "+$LDFLAGS
+-
+-$libs = append_library($libs, "pgplot")
+-$libs = append_library($libs, "cpgplot")
+-$defs.push '-DPGPLOT_DIR=\\"$(PGPLOT_DIR)\\"'
+-
+-# Generate Makefile
+-create_makefile("pgplot")
+-
+-# Append PGPLOT install task to Makefile
+-if $makefile_created
+-  puts "appending extra install tasks to Makefile"
+-  File.open("Makefile","a") do |w|
+-    w.print <<EOL
+-
+-PGPLOT_DIR = $(RUBYARCHDIR)/pgplot
+-PGPLOT_BUILD = #{$subdir}/build
+-
+-$(PGPLOT_BUILD)/libcpgplot.a:
+-	(cd #{$subdir}; make build/libcpgplot.a)
+-$(PGPLOT_BUILD)/cpgplot.h: $(PGPLOT_BUILD)/libcpgplot.a
+-rb_pgplot.o: $(PGPLOT_BUILD)/cpgplot.h
+-$(DLLIB): $(PGPLOT_BUILD)/libcpgplot.a
+-
+-install: install-pgplot
+-install-pgplot:
+-	$(MAKEDIRS) $(PGPLOT_DIR)
+-	$(INSTALL_DATA) $(PGPLOT_BUILD)/grfont.dat $(PGPLOT_DIR)
+-	$(INSTALL_DATA) $(PGPLOT_BUILD)/rgb.txt $(PGPLOT_DIR)
+-EOL
+-    if $found_lib.include? "X11"
+-      w.print <<EOL
+-	$(INSTALL_PROG) $(PGPLOT_BUILD)/pgxwin_server $(PGPLOT_DIR)
+-
+-$(PGPLOT_BUILD)/pgxwin_server: $(PGPLOT_BUILD)/cpgplot.h
+-	(cd #{$subdir}; make build/pgxwin_server)
+-$(DLLIB): $(PGPLOT_BUILD)/pgxwin_server
+-EOL
+-    end
+-  end
+-
+-  puts "creating #{$subdir}/drivers.conf"
+-  File.open("#{$subdir}/drivers.conf","w") do |w|
+-    w.puts "GIDRIV PPDRIV PSDRIV"
+-    w.puts "PNDRIV" if $found_lib.include? "png"
+-    w.puts "WDDRIV XWDRIV" if $found_lib.include? "X11"
+-  end
+-end
+diff --git a/pgplot.gemspec b/pgplot.gemspec
+index d7b48ad..88f23e2 100644
+--- a/pgplot.gemspec
++++ b/pgplot.gemspec
+@@ -16,7 +16,7 @@ PGPLOT_GEMSPEC = Gem::Specification.new do |s|
+   s.date = Time.now.strftime("%F")
+   s.description = "PGPLOT wrapper for Ruby"
+   s.email = "masa16.tanaka at gmail.com"
+-  s.extensions = ["ext/extconf-auto.rb"]
++  s.extensions = ["ext/extconf.rb"]
+   s.homepage = "http://pgplot.rubyforge.org/"
+   s.require_paths = ["."]
+   s.rubyforge_project = "pgplot"
+@@ -35,7 +35,6 @@ PGPLOT_GEMSPEC = Gem::Specification.new do |s|
+     ext/cogen.rb
+     ext/depend
+     ext/extconf.rb
+-    ext/extconf-auto.rb
+     ext/kwarg.c
+     ext/rb_pgplot.c.in
+     ext/version.h
+@@ -78,7 +77,6 @@ PGPLOT_GEMSPEC = Gem::Specification.new do |s|
+     --exclude ext/cpgplot.h
+     --exclude ext/depend
+     --exclude ext/extconf.rb
+-    --exclude ext/extconf-auto.rb
+     --exclude ext/kwarg.c
+     --exclude ext/rb_pgplot.c.in
+     --exclude ext/version.h
+-- 
+2.1.0
+
diff --git a/debian/patches/0007-s.add_dependency-narray-0.7.0.patch b/debian/patches/0007-s.add_dependency-narray-0.7.0.patch
new file mode 100644
index 0000000..80b6999
--- /dev/null
+++ b/debian/patches/0007-s.add_dependency-narray-0.7.0.patch
@@ -0,0 +1,25 @@
+From 42e98bf9d7db8bd60822a67c381233ad0c31ac83 Mon Sep 17 00:00:00 2001
+From: Masahiro TANAKA <masa16.tanaka at gmail.com>
+Date: Wed, 30 Oct 2013 20:59:01 +0900
+Subject: [PATCH 7/9] s.add_dependency('narray', '< 0.7.0')
+
+---
+ pgplot.gemspec | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pgplot.gemspec b/pgplot.gemspec
+index 88f23e2..4e41bc4 100644
+--- a/pgplot.gemspec
++++ b/pgplot.gemspec
+@@ -52,7 +52,7 @@ PGPLOT_GEMSPEC = Gem::Specification.new do |s|
+     test/pgtick.rb
+   ]
+ 
+-  s.add_dependency('narray', '>= 0.5.0')
++  s.add_dependency('narray', '< 0.7.0')
+ 
+   if s.respond_to? :specification_version then
+     s.specification_version = 2
+-- 
+2.1.0
+
diff --git a/debian/patches/0008-mv-homepage.patch b/debian/patches/0008-mv-homepage.patch
new file mode 100644
index 0000000..f9b2159
--- /dev/null
+++ b/debian/patches/0008-mv-homepage.patch
@@ -0,0 +1,25 @@
+From 8844f14b454d9d32b1b9069f96c14a7d9d0ded14 Mon Sep 17 00:00:00 2001
+From: Masahiro TANAKA <masa16.tanaka at gmail.com>
+Date: Fri, 16 May 2014 10:23:43 +0900
+Subject: [PATCH 8/9] mv homepage
+
+---
+ pgplot.gemspec | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pgplot.gemspec b/pgplot.gemspec
+index 4e41bc4..05bc3ec 100644
+--- a/pgplot.gemspec
++++ b/pgplot.gemspec
+@@ -17,7 +17,7 @@ PGPLOT_GEMSPEC = Gem::Specification.new do |s|
+   s.description = "PGPLOT wrapper for Ruby"
+   s.email = "masa16.tanaka at gmail.com"
+   s.extensions = ["ext/extconf.rb"]
+-  s.homepage = "http://pgplot.rubyforge.org/"
++  s.homepage = "http://masa16.github.io/ruby-pgplot/"
+   s.require_paths = ["."]
+   s.rubyforge_project = "pgplot"
+   s.rubygems_version = "2.0.0"
+-- 
+2.1.0
+
diff --git a/debian/patches/0009-fix-docs.patch b/debian/patches/0009-fix-docs.patch
new file mode 100644
index 0000000..9d6f949
--- /dev/null
+++ b/debian/patches/0009-fix-docs.patch
@@ -0,0 +1,86 @@
+From 4c6750b05d09d71fb6ed5fb610ac722fd9aed2b3 Mon Sep 17 00:00:00 2001
+From: Masahiro TANAKA <masa16.tanaka at gmail.com>
+Date: Fri, 16 May 2014 11:22:23 +0900
+Subject: [PATCH 9/9] fix docs
+
+---
+ doc/Makefile | 4 ++--
+ doc/index.rd | 4 ++--
+ doc/mkdoc.rb | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+--- ruby-pgplot.orig/doc/Makefile
++++ ruby-pgplot/doc/Makefile
+@@ -1,6 +1,6 @@
+ .SUFFIXES: .rd .html .ja.rd .html.ja .rb $(SUFFIXES)
+ 
+-rd2=ruby myrd2html.rb
++rd2=ruby -Ku myrd2html.rb
+ 
+ .rd.html:
+ 	$(rd2) --lang=en --kw="Ruby,PGPLOT,NArray" $(opt) $< > $@
+@@ -42,8 +42,8 @@
+ 
+ # Method description
+ rbpgplot.html: mkdoc.rb
+-	#ruby -Kn mkdoc.rb $(HOME)/2012/src/pgplot/src rbpgplot.html
+-	ruby mkdoc.rb rbpgplot.html
++	ruby -Kn mkdoc.rb /data/masa/2013/src/pgplot/src rbpgplot.html
++	#ruby mkdoc.rb rbpgplot.html
+ 
+ # Method index categolized
+ rbpg-ind.rd: rbpg-ind.txt mkind.rb trailer.html
+--- ruby-pgplot.orig/doc/index.rd
++++ ruby-pgplot/doc/index.rd
+@@ -11,11 +11,11 @@
+ 
+ * ((<PGPLOT Library|URL:http://www.astro.caltech.edu/~tjp/pgplot/>))
+ * GNU FORTRAN compiler
+-* ((<NArray|URL:http://narray.rubyforge.org/>)) version 0.5/0.6
++* ((<NArray|URL:http://masa16.github.io/narray/>)) version 0.5 or 0.6 (no plan to support narray-devel)
+ 
+ == Download
+ 
+-* ((<version 0.1.6|URL:https://github.com/masa16/ruby-pgplot/tarball/0.1.6>))
++* ((<Releases|URL:https://github.com/masa16/ruby-pgplot/releases>))
+ 
+ == Installation
+ 
+--- ruby-pgplot.orig/doc/mkdoc.rb
++++ ruby-pgplot/doc/mkdoc.rb
+@@ -1,3 +1,5 @@
++# -*- coding: utf-8 -*-
++
+ class Formatter
+   def initialize(stream)
+     @stream = stream
+@@ -276,7 +278,7 @@
+   def manualfunclist
+     @manualfunc={}
+     curfunc=nil
+-    File.open("../rb_pgplot.c.in").each do |line|
++    File.open("../ext/rb_pgplot.c.in").each do |line|
+       case line
+       when %r'^/\* (PG\w+)'
+ 	curfunc = $1.downcase
+--- ruby-pgplot.orig/doc/myrd2html.rb
++++ ruby-pgplot/doc/myrd2html.rb
+@@ -1,3 +1,6 @@
++# -*- coding: utf-8 -*-
++
++
+ while /^--/ =~ ARGV[0]
+   a = ARGV.shift
+   case a
+@@ -17,9 +20,9 @@
+ 
+ case $lang
+ when 'ja'
+-  rd2 = 'rd2 -r ./rd2html-img-lib.rb --html-lang=ja --with-css=./css.css --out-code=utf8'
++  rd2 = '/usr/bin/ruby -Ku /usr/bin/rd2 -r ./rd2html-img-lib.rb --html-lang=ja --with-css=./css.css --out-code=utf8'
+ else
+-  rd2 = 'rd2 -r ./rd2html-img-lib.rb --html-lang=en --with-css=./css.css'
++  rd2 = '/usr/bin/ruby -Ku /usr/bin/rd2 -r ./rd2html-img-lib.rb --html-lang=en --with-css=./css.css'
+ end
+ 
+ rd2 << " --html-title='#{$title}'"  if $title
diff --git a/debian/patches/series b/debian/patches/series
index e2e94be..3179ecd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,10 @@
-0001-Update-extconf-and-Add-support-for-Ruby-1.9.2.patch
-0002-Fix-mkdoc-for-Ruby-1.9.2.patch
-0003-Update-Cogen-for-Ruby1.9.2.patch
+0000-Update-NArray-PATH.patch
+0001-Add-enable-autobuild-option.patch
+0002-Add-disable-extra-libs-option.patch
+0003-Close-files-in-cogen.rb.patch
+0004-Be-smart-about-extra-library-checks.patch
+0005-extconf.rb.patch
+0006-rm-extconf-auto.rb.patch
+0007-s.add_dependency-narray-0.7.0.patch
+0008-mv-homepage.patch
+0009-fix-docs.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-pgplot.git



More information about the Pkg-ruby-extras-commits mailing list