pgplot 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00063843df119f6f4b32281e29ff3c2bba9dc0da
4
- data.tar.gz: 0c4f21010d99906637494418eaace8ecaee33a09
3
+ metadata.gz: 0596b1a3b10296b574adf396ef7d4dd14cc14fdf
4
+ data.tar.gz: f5b33d1f459d56410c6ec84d2820a2b801c546a5
5
5
  SHA512:
6
- metadata.gz: a6481908be3f77382819eb882d2f7a31f9cee64e217f6523bbd35a6e85ae9aba9e371cf8bf5e0f2c6036f1e03fc957382957a123a7edfecb09aa192bb02cb688
7
- data.tar.gz: 90d7147f8e88ff7fa4aa8be392b125c06d791961b7fe9e7f6fab456e510ceb1cca02b9277443a83ccd1799c53800f2cfc48f4d8fc813432828be60b99a0d723d
6
+ metadata.gz: e8feadd7d237e54229f5b894095b88923b775a94224d2cd522f3ea7bd771bf7d5281078e87d63bc81017b9f0d4b9867963473b68973e88365371d7000e15e44b
7
+ data.tar.gz: 7b6910ff00c7d0a30c1d05346886e6496987cdc49587cf7060feb476df68df6e006e36bfa4c75b6c0b0cf6447cad11a48cb724af869d85a550da07834776b405
@@ -0,0 +1,29 @@
1
+ pkg=pgplot5.2.tar.gz
2
+ uri=ftp://ftp.astro.caltech.edu/pub/pgplot/$(pkg)
3
+ sd=pgplot
4
+ bd=build
5
+
6
+ all: $(bd)/makefile
7
+ (cd $(bd); make all cpg)
8
+
9
+ $(pkg):
10
+ ruby download.rb $(uri)
11
+
12
+ $(sd)/drivers.list: $(pkg)
13
+ gunzip -c $(pkg) | tar xf -
14
+ touch $(sd)/drivers.list
15
+
16
+ $(bd)/drivers.list: drivers.conf $(sd)/drivers.list
17
+ ruby drivers.rb $(sd) $(bd)
18
+
19
+ $(bd)/makefile: $(bd)/drivers.list
20
+ ruby makefile.rb $(sd) $(bd)
21
+
22
+ $(bd)/libpgplot.a: $(bd)/makefile
23
+ (cd $(bd); make libpgplot.a grfont.dat)
24
+
25
+ $(bd)/pgxwin_server: $(bd)/makefile
26
+ (cd $(bd); make pgxwin_server)
27
+
28
+ $(bd)/libcpgplot.a: $(bd)/libpgplot.a
29
+ (cd $(bd); make libcpgplot.a)
@@ -0,0 +1,14 @@
1
+ require 'uri'
2
+ require 'net/ftp'
3
+
4
+ pkg_uri = ARGV[0] || "ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz"
5
+
6
+ uri = URI.parse(pkg_uri)
7
+ tar_file = File.basename(uri.path)
8
+
9
+ Net::FTP.open(uri.host) do |ftp|
10
+ ftp.login
11
+ ftp.passive = true
12
+ puts "downloading #{tar_file} ..."
13
+ ftp.getbinaryfile(uri.path, tar_file, 1024)
14
+ end
@@ -0,0 +1,24 @@
1
+ require 'fileutils'
2
+
3
+ $src_dir = ARGV[0] || 'pgplot'
4
+ $build_dir = ARGV[1] || 'build'
5
+
6
+ FileUtils.rm_rf $build_dir
7
+ Dir.mkdir $build_dir
8
+
9
+ drivers = File.read('drivers.conf').split(/\s+/)
10
+
11
+ File.open(File.join($build_dir,"drivers.list"),"w") do |w|
12
+ File.open(File.join($src_dir,"drivers.list"),"r") do |r|
13
+ r.each_line do |l|
14
+ l.chomp!
15
+ drivers.each do |d|
16
+ if /^!( #{d} .*)$/ =~ l
17
+ l = $1
18
+ break
19
+ end
20
+ end
21
+ w.puts l
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,54 @@
1
+ $src_dir = ARGV[0] || 'pgplot'
2
+ $build_dir = ARGV[1] || 'build'
3
+
4
+ case RUBY_PLATFORM
5
+ when /-linux$/
6
+ os='linux'
7
+ when /-cygwin$/
8
+ os='cygwin'
9
+ when /-freebsd$/
10
+ os='freebsd'
11
+ when /-bsd$/
12
+ os='bsd'
13
+ when /sparc-solaris$/
14
+ os='sol2'
15
+ when /x86-solaris$/
16
+ os='solx86'
17
+ else
18
+ raise "RUBY_PLATFORM=#{RUBY_PLATFORM}: not supported"
19
+ end
20
+ puts "Platform = "+os
21
+
22
+
23
+ def find_cmd(a)
24
+ a.each do |cmd|
25
+ if system("which #{cmd}")
26
+ return cmd
27
+ end
28
+ end
29
+ raise "No FORTRAN compiler found in: [#{a.join(' ')}]"
30
+ end
31
+
32
+ fc = find_cmd %w[gfortran g77]
33
+ puts "FORTRAN compiler = "+fc
34
+ puts
35
+
36
+ Dir.chdir $build_dir do
37
+ cmd="../#{$src_dir}/makemake ../#{$src_dir} #{os} g77_gcc"
38
+ puts cmd+' ...'
39
+ s=system cmd
40
+ raise "failed: #{cmd}" if !s
41
+
42
+ File.rename "makefile", "makefile.orig"
43
+ File.open("makefile","w") do |w|
44
+ File.open("makefile.orig","r") do |r|
45
+ r.each_line do |l|
46
+ l.chomp!
47
+ l.sub!(/g77/,"gfortran") if fc=='gfortran'
48
+ if /^pndriv\.o : / !~ l
49
+ w.puts l
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
data/ext/cogen.rb CHANGED
@@ -155,4 +155,4 @@ def cogen_pgplot
155
155
  end
156
156
  end
157
157
 
158
- cogen_pgplot
158
+ cogen_pgplot if $0 == __FILE__
@@ -0,0 +1,72 @@
1
+ # extconf.rb : Configure script for Ruby/PGPLOT
2
+ #
3
+ # Copyright (c) 2000,2001 Masahiro TANAKA <masa@ir.isas.ac.jp>
4
+ #
5
+ # This program is free software.
6
+ # You can distribute/modify this program
7
+ # under the same terms as Ruby itself.
8
+ # NO WARRANTY.
9
+ #
10
+ # usage: ruby extconf.rb [configure options]
11
+
12
+ # Narray is now Gem based, so require rubygems
13
+ # so that we can use Gem class to find narray.
14
+
15
+ load "./extconf.rb"
16
+
17
+ exit if $have_pgplot
18
+ exit unless %w[gfortran g77].any?{|cmd| system("which #{cmd}")}
19
+
20
+ puts "enabling auto-build PGPLOT Library..."
21
+
22
+ $subdir = 'build_lib'
23
+
24
+ $CFLAGS = "-I#{$subdir}/build "+$CFLAGS
25
+ $LDFLAGS = "-L#{$subdir}/build "+$LDFLAGS
26
+
27
+ $libs = append_library($libs, "pgplot")
28
+ $libs = append_library($libs, "cpgplot")
29
+ $defs.push '-DPGPLOT_DIR=\\"$(PGPLOT_DIR)\\"'
30
+
31
+ # Generate Makefile
32
+ create_makefile("pgplot")
33
+
34
+ # Append PGPLOT install task to Makefile
35
+ if $makefile_created
36
+ puts "appending extra install tasks to Makefile"
37
+ File.open("Makefile","a") do |w|
38
+ w.print <<EOL
39
+
40
+ PGPLOT_DIR = $(RUBYARCHDIR)/pgplot
41
+ PGPLOT_BUILD = #{$subdir}/build
42
+
43
+ $(PGPLOT_BUILD)/libcpgplot.a:
44
+ (cd #{$subdir}; make build/libcpgplot.a)
45
+ $(PGPLOT_BUILD)/cpgplot.h: $(PGPLOT_BUILD)/libcpgplot.a
46
+ rb_pgplot.o: $(PGPLOT_BUILD)/cpgplot.h
47
+ $(DLLIB): $(PGPLOT_BUILD)/libcpgplot.a
48
+
49
+ install: install-pgplot
50
+ install-pgplot:
51
+ $(MAKEDIRS) $(PGPLOT_DIR)
52
+ $(INSTALL_DATA) $(PGPLOT_BUILD)/grfont.dat $(PGPLOT_DIR)
53
+ $(INSTALL_DATA) $(PGPLOT_BUILD)/rgb.txt $(PGPLOT_DIR)
54
+ EOL
55
+ if $found_lib.include? "X11"
56
+ w.print <<EOL
57
+ $(INSTALL_PROG) $(PGPLOT_BUILD)/pgxwin_server $(PGPLOT_DIR)
58
+
59
+ $(PGPLOT_BUILD)/pgxwin_server: $(PGPLOT_BUILD)/cpgplot.h
60
+ (cd #{$subdir}; make build/pgxwin_server)
61
+ $(DLLIB): $(PGPLOT_BUILD)/pgxwin_server
62
+ EOL
63
+ end
64
+ end
65
+
66
+ puts "creating #{$subdir}/drivers.conf"
67
+ File.open("#{$subdir}/drivers.conf","w") do |w|
68
+ w.puts "GIDRIV PPDRIV PSDRIV"
69
+ w.puts "PNDRIV" if $found_lib.include? "png"
70
+ w.puts "WDDRIV XWDRIV" if $found_lib.include? "X11"
71
+ end
72
+ end
data/ext/extconf.rb CHANGED
@@ -32,9 +32,6 @@ dir_config("pgplot")
32
32
  # --with-opt-include=path
33
33
  # --with-opt-lib=path
34
34
 
35
- # Check PGPLOT Header
36
- exit unless have_header("cpgplot.h")
37
-
38
35
  def find_dir_w_file(d,h)
39
36
  g = Dir.glob(RbConfig.expand(d+"/"+h))
40
37
  File.dirname(g.last) if g and !g.empty?
@@ -102,23 +99,39 @@ if with_config("grwin")
102
99
  end
103
100
  exit unless have_library("GrWin", "GWinit")
104
101
  end
105
- #
102
+
103
+ $found_lib = []
104
+
106
105
  # Check X11 Library
107
- have_library("X11", "XOpenDisplay")
106
+ if have_library("X11", "XOpenDisplay")
107
+ $found_lib << 'X11'
108
+ end
108
109
 
109
110
  # Check PNG Library
110
111
  libs_save = $libs
111
112
  $libs = append_library($libs, "z")
112
- if !have_library("png","png_create_write_struct")
113
+ if have_library("png","png_create_write_struct")
114
+ $found_lib << 'png'
115
+ else
113
116
  $libs = libs_save
114
117
  end
115
118
 
116
- # Check PGPLOT Library
117
119
  $libs = append_library($libs, "pgplot")
118
- exit unless find_library( "cpgplot", "cpgbeg", "/usr/lib",
119
- "/usr/local/lib", "/usr/local/pgplot" )
120
+ $have_pgplot = false
121
+
122
+ # Check PGPLOT Header
123
+ if have_header("cpgplot.h")
124
+
125
+ # Check PGPLOT Library
126
+ if find_library("cpgplot","cpgbeg", "/usr/lib",
127
+ "/usr/local/lib", "/usr/local/pgplot" )
128
+ $have_pgplot = true
129
+ end
130
+ end
120
131
 
121
132
  $objs = %w(rb_pgplot.o kwarg.o)
122
133
 
123
- # Generate Makefile
124
- create_makefile("pgplot")
134
+ if $have_pgplot
135
+ # Generate Makefile
136
+ create_makefile("pgplot")
137
+ end
data/ext/rb_pgplot.c CHANGED
@@ -1765,10 +1765,14 @@ static VALUE
1765
1765
  return rb_ary_new3(4,rb_float_new(var0),rb_float_new(var1),rb_float_new(var2),rb_float_new(var3));
1766
1766
  }
1767
1767
 
1768
+ void ruby_setenv(const char *name, const char *value);
1768
1769
 
1769
1770
  void
1770
1771
  Init_pgplot()
1771
1772
  {
1773
+ #ifdef PGPLOT_DIR
1774
+ ruby_setenv("PGPLOT_DIR",PGPLOT_DIR);
1775
+ #endif
1772
1776
  mPgplot = rb_define_module("Pgplot");
1773
1777
  rb_define_const(mPgplot, "VERSION", rb_str_new2(RUBY_PGPLOT_VERSION));
1774
1778
 
@@ -1853,44 +1857,3 @@ void
1853
1857
  rb_define_module_function(mPgplot,"pgshls",rb_pgplot_pgshls,4);
1854
1858
  rb_define_module_function(mPgplot,"pgsah",rb_pgplot_pgsah,3);
1855
1859
  rb_define_module_function(mPgplot,"pgscrl",rb_pgplot_pgscrl,2);
1856
- rb_define_module_function(mPgplot,"pgscir",rb_pgplot_pgscir,2);
1857
- rb_define_module_function(mPgplot,"pgscrn",rb_pgplot_pgscrn,2);
1858
- rb_define_module_function(mPgplot,"pgshs",rb_pgplot_pgshs,3);
1859
- rb_define_module_function(mPgplot,"pgsvp",rb_pgplot_pgsvp,4);
1860
- rb_define_module_function(mPgplot,"pgswin",rb_pgplot_pgswin,4);
1861
- rb_define_module_function(mPgplot,"pgqch",rb_pgplot_pgqch,0);
1862
- rb_define_module_function(mPgplot,"pgqcf",rb_pgplot_pgqcf,0);
1863
- rb_define_module_function(mPgplot,"pgqci",rb_pgplot_pgqci,0);
1864
- rb_define_module_function(mPgplot,"pgqcs",rb_pgplot_pgqcs,1);
1865
- rb_define_module_function(mPgplot,"pgqfs",rb_pgplot_pgqfs,0);
1866
- rb_define_module_function(mPgplot,"pgqls",rb_pgplot_pgqls,0);
1867
- rb_define_module_function(mPgplot,"pgqlw",rb_pgplot_pgqlw,0);
1868
- rb_define_module_function(mPgplot,"pgqclp",rb_pgplot_pgqclp,0);
1869
- rb_define_module_function(mPgplot,"pgqid",rb_pgplot_pgqid,0);
1870
- rb_define_module_function(mPgplot,"pgqitf",rb_pgplot_pgqitf,0);
1871
- rb_define_module_function(mPgplot,"pgqndt",rb_pgplot_pgqndt,0);
1872
- rb_define_module_function(mPgplot,"pgqtbg",rb_pgplot_pgqtbg,0);
1873
- rb_define_module_function(mPgplot,"pgqcr",rb_pgplot_pgqcr,1);
1874
- rb_define_module_function(mPgplot,"pgqvp",rb_pgplot_pgqvp,1);
1875
- rb_define_module_function(mPgplot,"pgqwin",rb_pgplot_pgqwin,0);
1876
- rb_define_module_function(mPgplot,"pgqcol",rb_pgplot_pgqcol,0);
1877
- rb_define_module_function(mPgplot,"pgqcir",rb_pgplot_pgqcir,0);
1878
- rb_define_module_function(mPgplot,"pgqpos",rb_pgplot_pgqpos,0);
1879
- rb_define_module_function(mPgplot,"pgqvsz",rb_pgplot_pgqvsz,1);
1880
-
1881
- rb_set_end_proc((void(*)(VALUE))(cpgend), Qnil);
1882
- id_beg = rb_intern("begin");
1883
- id_end = rb_intern("end");
1884
- id_x = rb_intern("@x");
1885
- id_y = rb_intern("@y");
1886
- id_char = rb_intern("@char");
1887
-
1888
- /*--- PgCursor ---*/
1889
- cPgCursor = rb_define_class_under(mPgplot, "PgCursor", rb_cObject);
1890
- rb_define_method(cPgCursor, "initialize", pgcursor_initialize, -1);
1891
- rb_define_method(cPgCursor, "to_ary", pgcursor_to_ary, 0);
1892
- rb_attr(cPgCursor, rb_intern("x"), 1, 0, Qtrue);
1893
- rb_attr(cPgCursor, rb_intern("y"), 1, 0, Qtrue);
1894
- rb_attr(cPgCursor, rb_intern("char"), 1, 0, Qtrue);
1895
- ePgCursorError = rb_define_class("PgCursorError", rb_eStandardError);
1896
- }
data/ext/rb_pgplot.c.in CHANGED
@@ -1206,10 +1206,14 @@ static VALUE
1206
1206
 
1207
1207
  /*--- auto-generated funcs will be placed here ---*/
1208
1208
 
1209
+ void ruby_setenv(const char *name, const char *value);
1209
1210
 
1210
1211
  void
1211
1212
  Init_pgplot()
1212
1213
  {
1214
+ #ifdef PGPLOT_DIR
1215
+ ruby_setenv("PGPLOT_DIR",PGPLOT_DIR);
1216
+ #endif
1213
1217
  mPgplot = rb_define_module("Pgplot");
1214
1218
  rb_define_const(mPgplot, "VERSION", rb_str_new2(RUBY_PGPLOT_VERSION));
1215
1219
 
data/ext/version.h CHANGED
@@ -1 +1 @@
1
- #define RUBY_PGPLOT_VERSION "0.1.7"
1
+ #define RUBY_PGPLOT_VERSION "0.1.8"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgplot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Tanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-02-27 00:00:00.000000000 Z
11
+ date: 2013-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: narray
@@ -28,7 +28,7 @@ description: PGPLOT wrapper for Ruby
28
28
  email: masa16.tanaka@gmail.com
29
29
  executables: []
30
30
  extensions:
31
- - ext/extconf.rb
31
+ - ext/extconf-auto.rb
32
32
  extra_rdoc_files:
33
33
  - README
34
34
  - README.ja
@@ -46,9 +46,15 @@ files:
46
46
  - ext/cogen.rb
47
47
  - ext/depend
48
48
  - ext/extconf.rb
49
+ - ext/extconf-auto.rb
49
50
  - ext/kwarg.c
51
+ - ext/rb_pgplot.c
50
52
  - ext/rb_pgplot.c.in
51
53
  - ext/version.h
54
+ - ext/build_lib/Makefile
55
+ - ext/build_lib/download.rb
56
+ - ext/build_lib/drivers.rb
57
+ - ext/build_lib/makefile.rb
52
58
  - test/pgband.rb
53
59
  - test/pgcurs.rb
54
60
  - test/pggray.rb
@@ -57,7 +63,6 @@ files:
57
63
  - test/pgncur.rb
58
64
  - test/pgolin.rb
59
65
  - test/pgtick.rb
60
- - ext/rb_pgplot.c
61
66
  homepage: http://pgplot.rubyforge.org/
62
67
  licenses: []
63
68
  metadata: {}
@@ -72,11 +77,33 @@ rdoc_options:
72
77
  - --exclude
73
78
  - test/
74
79
  - --exclude
75
- - ext/
80
+ - pgplot/
76
81
  - --exclude
77
- - pgplot\.so
82
+ - ext/build_lib/
83
+ - --exclude
84
+ - ext/Makefile
85
+ - --exclude
86
+ - ext/build-pgplot.rb
87
+ - --exclude
88
+ - ext/cogen.rb
89
+ - --exclude
90
+ - ext/cpgplot.h
91
+ - --exclude
92
+ - ext/depend
78
93
  - --exclude
79
- - libpgplot\.*
94
+ - ext/extconf.rb
95
+ - --exclude
96
+ - ext/extconf-auto.rb
97
+ - --exclude
98
+ - ext/kwarg.c
99
+ - --exclude
100
+ - ext/rb_pgplot.c.in
101
+ - --exclude
102
+ - ext/version.h
103
+ - --exclude
104
+ - .*\.o
105
+ - --exclude
106
+ - pgplot\.so
80
107
  require_paths:
81
108
  - .
82
109
  required_ruby_version: !ruby/object:Gem::Requirement