pgplot 0.1.9 → 0.2.0

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
- SHA1:
3
- metadata.gz: b44a1a4ec2013849e2c49505431632f19d4e23de
4
- data.tar.gz: 93aa0e6a84a0eb7e5adda60f664156239f4ae26a
2
+ SHA256:
3
+ metadata.gz: 4fc81664bfcb9e98f2a1d7c1fcbcf64f9b0e4ecaf296f10dc07dcf37b44eeb93
4
+ data.tar.gz: 0d59f1606548424591b15e80411beddf9e87dbe0b4abe336ce43efca249b15a5
5
5
  SHA512:
6
- metadata.gz: e1bef91baee3cb87ff596e67c0106ef37e2b95b9f5d56ca15a6633cb165cae5fb66d63d2022099b1e09df9a822d10207586778b6de130598527ede24d99f067b
7
- data.tar.gz: a24bbb7c5d86bb29e3874b45f17360e8bbc464e801d0fd94ce12264dddd76f3b9ae7dd08df221fed672156b8a8ec628b483f79498fe6271f3c6757e4ca1043ba
6
+ metadata.gz: f5a213ab4f4cb5a927423a0c2b988c75f1bf21ed458a1733135d2fc64b67181f98d8d901533fa58d0b848a3c43bd9dbda5356515ef64c36f47a4346c432431c9
7
+ data.tar.gz: 101cf7efa5bd01166fc5aa230d3c3927ba2ceb3593e7b91d1fffe1d9596ec3847d7eecc165a784d4bfd9495ef5d994b1f5f34ffa1a2348de6a02b2ef153eb548
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -12,6 +12,7 @@ $(pkg):
12
12
  $(sd)/drivers.list: $(pkg)
13
13
  gunzip -c $(pkg) | tar xf -
14
14
  touch $(sd)/drivers.list
15
+ ruby patch.rb $(sd)
15
16
 
16
17
  $(bd)/drivers.list: drivers.conf $(sd)/drivers.list
17
18
  ruby drivers.rb $(sd) $(bd)
@@ -0,0 +1,16 @@
1
+ require 'fileutils'
2
+
3
+ $src_dir = ARGV[0] || 'pgplot'
4
+
5
+ fnw = File.join($src_dir,"drivers/pndriv.c")
6
+ fnr = fnw + ".orig"
7
+
8
+ FileUtils.mv(fnw,fnr)
9
+
10
+ open(fnr,"rt") do |r|
11
+ open(fnw,"wt") do |w|
12
+ while s = r.gets
13
+ w.print s.sub(/png_ptr->jmpbuf/,"png_jmpbuf(png_ptr)")
14
+ end
15
+ end
16
+ end
data/ext/cogen.rb CHANGED
@@ -153,6 +153,8 @@ def cogen_pgplot
153
153
  fout.print
154
154
  end
155
155
  end
156
+ fout.close
157
+ fin.close
156
158
  end
157
159
 
158
160
  cogen_pgplot if $0 == __FILE__
data/ext/extconf.rb CHANGED
@@ -1,137 +1,210 @@
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
1
  require "mkmf"
15
2
 
16
- #$DEBUG = true
3
+ def main
4
+ extconf_start
5
+ check_narray
17
6
 
18
- # configure options:
19
- # --with-x11-dir=path
20
- # --with-x11-include=path
21
- # --with-x11-lib=path
22
- dir_config("x11")
7
+ $objs = %w(rb_pgplot.o kwarg.o)
8
+ $enable_autobuild = enable_config('autobuild', false)
9
+ $found_lib = []
23
10
 
24
- # configure options:
25
- # --with-pgplot-dir=path
26
- # --with-pgplot-include=path
27
- # --with-pgplot-lib=path
28
- dir_config("pgplot")
29
-
30
- # Otherwise you can also specify:
31
- # --with-opt-dir=path
32
- # --with-opt-include=path
33
- # --with-opt-lib=path
11
+ # Check PGPLOT Header
12
+ if have_header("cpgplot.h")
13
+ if have_library("cpgplot","cpgbeg")
14
+ create_makefile("pgplot")
15
+ exit
16
+ end
34
17
 
35
- def find_dir_w_file(d,h)
36
- g = Dir.glob(RbConfig.expand(d+"/"+h))
37
- File.dirname(g.last) if g and !g.empty?
38
- end
18
+ # Check for extra libs then re-check for PGPLOT library
19
+ puts "First check for PGPLOT library failed."
20
+ check_extra_libs
21
+ $libs = append_library($libs, "pgplot")
39
22
 
40
- def find_dir_in_gemspec
41
- begin
42
- require 'rubygems'
43
- if gemspec=Gem::Specification.find_by_path('narray')
44
- return File.join(gemspec.full_gem_path, gemspec.require_path)
23
+ if have_library("cpgplot","cpgbeg")
24
+ create_makefile("pgplot")
25
+ exit
45
26
  end
46
- rescue
27
+ elsif $enable_autobuild
28
+ check_extra_libs
47
29
  end
48
- nil
49
- end
50
30
 
51
- # Check NArray
52
- gems_dir="$(rubylibprefix)/gems/$(ruby_version)/gems/"
53
- narray_d="narray-0.[56].*"
54
- narray_h="narray.h"
55
- if narray_h_dir =
56
- find_dir_in_gemspec ||
57
- find_dir_w_file("../"+narray_d,narray_h) ||
58
- find_dir_w_file(gems_dir+narray_d,narray_h) ||
59
- find_dir_w_file(CONFIG['sitearchdir'],narray_h) ||
60
- find_dir_w_file(CONFIG['archdir'],narray_h)
61
- $CPPFLAGS = " -I#{narray_h_dir} " + $CPPFLAGS
31
+ if $enable_autobuild
32
+ autobuild_pgplot
33
+ else
34
+ puts "
35
+ The PGPLOT library was not found. To auto-build PGPLOT library
36
+ as part of installing Ruby/PGPLOT, pass the --enable-autobuild option.
37
+
38
+ Examples:
39
+ Gem install: gem install pgplot -- --enable-autobuild
40
+ Manual install: ruby extconf.rb --enable-autobuild
41
+
42
+ "
43
+ end
62
44
  end
63
- exit unless have_header("narray.h")
64
45
 
65
- if RUBY_PLATFORM =~ /cygwin|mingw/
66
- $LDFLAGS = " -L#{CONFIG['sitearchdir']} "+$LDFLAGS
67
- exit unless have_library("narray","na_make_object")
46
+
47
+ def extconf_start
48
+ # configure options:
49
+ # --with-pgplot-dir=path
50
+ # --with-pgplot-include=path
51
+ # --with-pgplot-lib=path
52
+ dir_config("pgplot")
53
+
54
+ # configure options:
55
+ # --with-x11-dir=path
56
+ # --with-x11-include=path
57
+ # --with-x11-lib=path
58
+ dir_config("x11")
59
+
60
+ # Otherwise you can also specify:
61
+ # --with-opt-dir=path
62
+ # --with-opt-include=path
63
+ # --with-opt-lib=path
68
64
  end
69
65
 
70
- # Check FORTRAN Libraries
71
- #
72
- # SUN WorkShop FORTRAN 77 compiler ver5.0
73
- # configure options: --with-sunws
74
- if with_config("sunws")
75
- $libs = "-lM77 -lsunmath "+$libs
76
- exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
77
- $defs.push "-DSPARC_FORTRAN"
78
- #
79
- # GNU FORTRAN v4
80
- elsif have_library("gfortran")
81
- $CFLAGS = "-Wall "+$CFLAGS
82
- $defs.push "-DGNU_FORTRAN"
83
- #
84
- # GNU FORTRAN v3
85
- elsif have_library("g77")
86
- $CFLAGS = "-Wall "+$CFLAGS
87
- $defs.push "-DGNU_FORTRAN"
88
- else
89
- puts "failed"
90
- exit
66
+ def find_narray_h
67
+ $LOAD_PATH.each do |x|
68
+ p x
69
+ if File.exist? File.join(x,'narray.h')
70
+ $INCFLAGS = "-I#{x} " + $INCFLAGS
71
+ break
72
+ end
73
+ end
91
74
  end
92
75
 
93
- # Check GrWin Library (for cygwin (and mingw32?))
94
- # configure options: --with-grwin
95
- if with_config("grwin")
96
- #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
97
- if RUBY_PLATFORM =~ /cygwin|mingw/
98
- $libs += " -mwindows"
76
+ def find_libnarray_a
77
+ $LOAD_PATH.each do |x|
78
+ if File.exist? File.join(x,'libnarray.a')
79
+ $LDFLAGS = "-L#{x} " + $LDFLAGS
80
+ break
81
+ end
99
82
  end
100
- exit unless have_library("GrWin", "GWinit")
101
83
  end
102
84
 
103
- $found_lib = []
85
+ def check_narray
86
+ require "narray"
87
+ find_narray_h
88
+ if !have_header("narray.h")
89
+ puts "
90
+ Header numo/narray.h was not found. Give pathname as follows:
91
+ % ruby extconf.rb --with-narray-include=narray_h_dir"
92
+ exit(1)
93
+ end
104
94
 
105
- # Check X11 Library
106
- if have_library("X11", "XOpenDisplay")
107
- $found_lib << 'X11'
95
+ if RUBY_PLATFORM =~ /mswin|cygwin|mingw/
96
+ find_libnarray_a
97
+ unless have_library("narray","na_make_object")
98
+ puts "libnarray.a not found"
99
+ exit(1)
100
+ end
101
+ end
108
102
  end
109
103
 
110
- # Check PNG Library
111
- libs_save = $libs
112
- $libs = append_library($libs, "z")
113
- if have_library("png","png_create_write_struct")
114
- $found_lib << 'png'
115
- else
116
- $libs = libs_save
117
- end
118
104
 
119
- $libs = append_library($libs, "pgplot")
120
- $have_pgplot = false
105
+ def check_extra_libs
106
+ # Check FORTRAN Libraries
107
+ #
108
+ # SUN WorkShop FORTRAN 77 compiler ver5.0
109
+ # configure options: --with-sunws
110
+ if with_config("sunws")
111
+ $libs = "-lM77 -lsunmath "+$libs
112
+ exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
113
+ $defs.push "-DSPARC_FORTRAN"
114
+ #
115
+ # GNU FORTRAN v4
116
+ elsif have_library("gfortran")
117
+ $CFLAGS = "-Wall "+$CFLAGS
118
+ $defs.push "-DGNU_FORTRAN"
119
+ #
120
+ # GNU FORTRAN v3
121
+ elsif have_library("g77")
122
+ $CFLAGS = "-Wall "+$CFLAGS
123
+ $defs.push "-DGNU_FORTRAN"
124
+ else
125
+ puts "failed"
126
+ exit
127
+ end
128
+
129
+ # Check GrWin Library (for cygwin (and mingw32?))
130
+ # configure options: --with-grwin
131
+ if with_config("grwin")
132
+ #$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
133
+ if RUBY_PLATFORM =~ /cygwin|mingw/
134
+ $libs += " -mwindows"
135
+ end
136
+ exit unless have_library("GrWin", "GWinit")
137
+ end
121
138
 
122
- # Check PGPLOT Header
123
- if have_header("cpgplot.h")
139
+ # Check X11 Library
140
+ if have_library("X11", "XOpenDisplay")
141
+ $found_lib << 'X11'
142
+ end
124
143
 
125
- # Check PGPLOT Library
126
- if find_library("cpgplot","cpgbeg", "/usr/lib",
127
- "/usr/local/lib", "/usr/local/pgplot" )
128
- $have_pgplot = true
144
+ # Check PNG Library
145
+ libs_save = $libs
146
+ $libs = append_library($libs, "z")
147
+ if have_library("png","png_create_write_struct")
148
+ $found_lib << 'png'
149
+ else
150
+ $libs = libs_save
129
151
  end
130
152
  end
131
153
 
132
- $objs = %w(rb_pgplot.o kwarg.o)
133
154
 
134
- if $have_pgplot
155
+ def autobuild_pgplot
156
+ # Exit unless a fortran compiler was found
157
+ exit unless %w[gfortran g77].any?{|cmd| system("which #{cmd}")}
158
+ puts "enabling auto-build PGPLOT Library..."
159
+
160
+ $subdir = 'build_lib'
161
+ $CFLAGS = "-I#{$subdir}/build "+$CFLAGS
162
+ $LDFLAGS = "-L#{$subdir}/build "+$LDFLAGS
163
+ $libs = append_library($libs, "cpgplot")
164
+ $defs.push '-DPGPLOT_DIR=\\"$(PGPLOT_DIR)\\"'
165
+
135
166
  # Generate Makefile
136
167
  create_makefile("pgplot")
168
+
169
+ # Append PGPLOT install task to Makefile
170
+ exit unless $makefile_created
171
+ puts "appending extra install tasks to Makefile"
172
+ File.open("Makefile","a") do |w|
173
+ w.print "
174
+ PGPLOT_DIR = $(RUBYARCHDIR)/pgplot
175
+ PGPLOT_BUILD = #{$subdir}/build
176
+
177
+ $(PGPLOT_BUILD)/libcpgplot.a:
178
+ (cd #{$subdir}; make build/libcpgplot.a)
179
+ $(PGPLOT_BUILD)/cpgplot.h: $(PGPLOT_BUILD)/libcpgplot.a
180
+ rb_pgplot.o: $(PGPLOT_BUILD)/cpgplot.h
181
+ $(DLLIB): $(PGPLOT_BUILD)/libcpgplot.a
182
+
183
+ install: install-pgplot
184
+ install-pgplot:
185
+ $(MAKEDIRS) $(PGPLOT_DIR)
186
+ $(INSTALL_DATA) $(PGPLOT_BUILD)/grfont.dat $(PGPLOT_DIR)
187
+ $(INSTALL_DATA) $(PGPLOT_BUILD)/rgb.txt $(PGPLOT_DIR)
188
+ "
189
+ if $found_lib.include? "X11"
190
+ w.print \
191
+ " $(INSTALL_PROG) $(PGPLOT_BUILD)/pgxwin_server $(PGPLOT_DIR)
192
+
193
+ $(PGPLOT_BUILD)/pgxwin_server: $(PGPLOT_BUILD)/cpgplot.h
194
+ (cd #{$subdir}; make build/pgxwin_server)
195
+ $(DLLIB): $(PGPLOT_BUILD)/pgxwin_server
196
+ "
197
+ end
198
+ end
199
+
200
+ puts "creating #{$subdir}/drivers.conf"
201
+ File.open("#{$subdir}/drivers.conf","w") do |w|
202
+ w.puts "GIDRIV PPDRIV PSDRIV"
203
+ w.puts "PNDRIV" if $found_lib.include? "png"
204
+ w.puts "WDDRIV XWDRIV" if $found_lib.include? "X11"
205
+ end
206
+
207
+ puts "Ready to download and auto-build PGPLOT !!"
137
208
  end
209
+
210
+ main
data/ext/version.h CHANGED
@@ -1 +1 @@
1
- #define RUBY_PGPLOT_VERSION "0.1.9"
1
+ #define RUBY_PGPLOT_VERSION "0.2.0"
data/pgplot.gemspec ADDED
@@ -0,0 +1,61 @@
1
+ open("ext/version.h") do |f|
2
+ f.each_line do |l|
3
+ if /RUBY_PGPLOT_VERSION "([\d.]+)"/ =~ l
4
+ PKG_VERSION=$1
5
+ break
6
+ end
7
+ end
8
+ end
9
+
10
+ PGPLOT_GEMSPEC = Gem::Specification.new do |s|
11
+ s.name = "pgplot"
12
+ s.version = PKG_VERSION
13
+
14
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
15
+ s.authors = ["Masahiro Tanaka"]
16
+ s.date = Time.now.strftime("%F")
17
+ s.description = "PGPLOT wrapper for Ruby"
18
+ s.email = "masa16.tanaka@gmail.com"
19
+ s.extensions = ["ext/extconf.rb"]
20
+ s.homepage = "http://masa16.github.io/ruby-pgplot/"
21
+ s.require_paths = ["."]
22
+ s.rubyforge_project = "pgplot"
23
+ s.rubygems_version = "2.0.0"
24
+ s.summary = "PGPLOT wrapper for Ruby. The PGPLOT library needs to be " \
25
+ "installed in advance using GNU FORTRAN compiler"
26
+ s.files = `git ls-files FuncUsage README README.ja Rakefile demo ext pgplot.gemspec test`.split($/)
27
+
28
+ s.add_dependency('narray', '< 0.7.0')
29
+
30
+ if s.respond_to? :specification_version then
31
+ s.specification_version = 2
32
+
33
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
34
+ else
35
+ end
36
+ else
37
+ end
38
+
39
+ # Documentation TODO
40
+ s.rdoc_options = %w[
41
+ --title Ruby/PGPLOT
42
+ --main README
43
+ --exclude demo/
44
+ --exclude test/
45
+ --exclude pgplot/
46
+ --exclude ext/build_lib/
47
+ --exclude ext/Makefile
48
+ --exclude ext/build-pgplot.rb
49
+ --exclude ext/cogen.rb
50
+ --exclude ext/cpgplot.h
51
+ --exclude ext/depend
52
+ --exclude ext/extconf.rb
53
+ --exclude ext/kwarg.c
54
+ --exclude ext/rb_pgplot.c.in
55
+ --exclude ext/version.h
56
+ --exclude .*\.o
57
+ --exclude pgplot\.so
58
+ ]
59
+ s.has_rdoc = true
60
+ s.extra_rdoc_files = %w[README README.ja FuncUsage ext/rb_pgplot.c]
61
+ end
metadata CHANGED
@@ -1,59 +1,62 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgplot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
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-03-02 00:00:00.000000000 Z
11
+ date: 2018-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: narray
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: 0.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.0
26
+ version: 0.7.0
27
27
  description: PGPLOT wrapper for Ruby
28
28
  email: masa16.tanaka@gmail.com
29
29
  executables: []
30
30
  extensions:
31
- - ext/extconf-auto.rb
31
+ - ext/extconf.rb
32
32
  extra_rdoc_files:
33
33
  - README
34
34
  - README.ja
35
35
  - FuncUsage
36
36
  - ext/rb_pgplot.c
37
37
  files:
38
+ - FuncUsage
38
39
  - README
39
40
  - README.ja
40
- - FuncUsage
41
+ - Rakefile
41
42
  - demo/pgdemo1.rb
42
43
  - demo/pgdemo15.rb
43
44
  - demo/pgdemo3.rb
44
45
  - demo/pgdemo4.rb
45
46
  - demo/pgdemo9.rb
47
+ - ext/build_lib/Makefile
48
+ - ext/build_lib/download.rb
49
+ - ext/build_lib/drivers.rb
50
+ - ext/build_lib/makefile.rb
51
+ - ext/build_lib/patch.rb
46
52
  - ext/cogen.rb
47
53
  - ext/depend
48
54
  - ext/extconf.rb
49
- - ext/extconf-auto.rb
50
55
  - ext/kwarg.c
56
+ - ext/rb_pgplot.c
51
57
  - ext/rb_pgplot.c.in
52
58
  - ext/version.h
53
- - ext/build_lib/Makefile
54
- - ext/build_lib/download.rb
55
- - ext/build_lib/drivers.rb
56
- - ext/build_lib/makefile.rb
59
+ - pgplot.gemspec
57
60
  - test/pgband.rb
58
61
  - test/pgcurs.rb
59
62
  - test/pggray.rb
@@ -62,63 +65,60 @@ files:
62
65
  - test/pgncur.rb
63
66
  - test/pgolin.rb
64
67
  - test/pgtick.rb
65
- - ext/rb_pgplot.c
66
- homepage: http://pgplot.rubyforge.org/
68
+ homepage: http://masa16.github.io/ruby-pgplot/
67
69
  licenses: []
68
70
  metadata: {}
69
71
  post_install_message:
70
72
  rdoc_options:
71
- - --title
73
+ - "--title"
72
74
  - Ruby/PGPLOT
73
- - --main
75
+ - "--main"
74
76
  - README
75
- - --exclude
77
+ - "--exclude"
76
78
  - demo/
77
- - --exclude
79
+ - "--exclude"
78
80
  - test/
79
- - --exclude
81
+ - "--exclude"
80
82
  - pgplot/
81
- - --exclude
83
+ - "--exclude"
82
84
  - ext/build_lib/
83
- - --exclude
85
+ - "--exclude"
84
86
  - ext/Makefile
85
- - --exclude
87
+ - "--exclude"
86
88
  - ext/build-pgplot.rb
87
- - --exclude
89
+ - "--exclude"
88
90
  - ext/cogen.rb
89
- - --exclude
91
+ - "--exclude"
90
92
  - ext/cpgplot.h
91
- - --exclude
93
+ - "--exclude"
92
94
  - ext/depend
93
- - --exclude
95
+ - "--exclude"
94
96
  - ext/extconf.rb
95
- - --exclude
96
- - ext/extconf-auto.rb
97
- - --exclude
97
+ - "--exclude"
98
98
  - ext/kwarg.c
99
- - --exclude
99
+ - "--exclude"
100
100
  - ext/rb_pgplot.c.in
101
- - --exclude
101
+ - "--exclude"
102
102
  - ext/version.h
103
- - --exclude
104
- - .*\.o
105
- - --exclude
103
+ - "--exclude"
104
+ - ".*\\.o"
105
+ - "--exclude"
106
106
  - pgplot\.so
107
107
  require_paths:
108
- - .
108
+ - "."
109
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project: pgplot
121
- rubygems_version: 2.0.0
121
+ rubygems_version: 2.7.3
122
122
  signing_key:
123
123
  specification_version: 2
124
124
  summary: PGPLOT wrapper for Ruby. The PGPLOT library needs to be installed in advance
data/ext/extconf-auto.rb DELETED
@@ -1,72 +0,0 @@
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