proj4rb 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
File without changes
data/Rakefile ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "rake/extensiontask"
5
+ require "rake/testtask"
6
+ require "rubygems/package_task"
7
+ require "rdoc/task"
8
+ require "yaml"
9
+
10
+ # Read the spec file
11
+ GEM_NAME = "proj4rb"
12
+ SO_NAME = "proj4_ruby"
13
+ spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
14
+
15
+ # Setup compile tasks
16
+ Rake::ExtensionTask.new do |ext|
17
+ ext.gem_spec = spec
18
+ ext.name = SO_NAME
19
+ ext.ext_dir = "ext"
20
+ ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
21
+ ext.config_options << "--with-proj-dir=C:/MinGW/local"
22
+ end
23
+
24
+ # Setup generic gem
25
+ Gem::PackageTask.new(spec) do |pkg|
26
+ pkg.package_dir = 'pkg'
27
+ pkg.need_tar = false
28
+ end
29
+
30
+ # Setup Windows Gem
31
+ if RUBY_PLATFORM.match(/win32|mingw32/)
32
+ binaries = (FileList['lib/**/*.so',
33
+ 'lib/**/*dll'])
34
+
35
+ # Windows specification
36
+ win_spec = spec.clone
37
+ win_spec.instance_variable_set(:@cache_file, nil)
38
+ win_spec.platform = Gem::Platform::CURRENT
39
+ win_spec.files += binaries.to_a
40
+
41
+ # Unset extensions
42
+ win_spec.extensions = nil
43
+
44
+ # Rake task to build the windows package
45
+ Gem::PackageTask.new(win_spec) do |pkg|
46
+ pkg.package_dir = 'pkg'
47
+ pkg.need_tar = false
48
+ end
49
+ end
50
+
51
+ # RDoc Task
52
+ desc "Generate rdoc documentation"
53
+ RDoc::Task.new("rdoc") do |rdoc|
54
+ rdoc.rdoc_dir = 'doc'
55
+ rdoc.title = "Proj4rb"
56
+ # Show source inline with line numbers
57
+ rdoc.options << "--line-numbers"
58
+ # Make the readme file the start page for the generated html
59
+ rdoc.main = 'README.rdoc'
60
+ rdoc.rdoc_files.include('doc/*.rdoc',
61
+ 'ext/projrb.c',
62
+ 'README',
63
+ 'proj4rb.gemspec',
64
+ 'Changelog',
65
+ 'MIT-LICENSE')
66
+ end
67
+
68
+ # Test Task
69
+ Rake::TestTask.new do |t|
70
+ t.libs << "test"
71
+ t.verbose = true
72
+ end
data/ext/Makefile ADDED
@@ -0,0 +1,212 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ # V=0 quiet, V=1 verbose. other values don't work.
5
+ V = 0
6
+ Q1 = $(V:1=)
7
+ Q = $(Q1:0=@)
8
+ ECHO1 = $(V:1=@:)
9
+ ECHO = $(ECHO1:0=@echo)
10
+
11
+ #### Start of system configuration section. ####
12
+
13
+ srcdir = .
14
+ topdir = /c/MinGW/local/ruby/include/ruby-1.9.1
15
+ hdrdir = /c/MinGW/local/ruby/include/ruby-1.9.1
16
+ arch_hdrdir = c:/MinGW/local/ruby/include/ruby-1.9.1/$(arch)
17
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
18
+
19
+ DESTDIR = c:
20
+ prefix = $(DESTDIR)/MinGW/local/ruby
21
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
22
+ exec_prefix = $(prefix)
23
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
24
+ sitehdrdir = $(rubyhdrdir)/site_ruby
25
+ rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
26
+ vendordir = $(rubylibprefix)/vendor_ruby
27
+ sitedir = $(rubylibprefix)/site_ruby
28
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
29
+ mandir = $(datarootdir)/man
30
+ localedir = $(datarootdir)/locale
31
+ libdir = $(exec_prefix)/lib
32
+ psdir = $(docdir)
33
+ pdfdir = $(docdir)
34
+ dvidir = $(docdir)
35
+ htmldir = $(docdir)
36
+ infodir = $(datarootdir)/info
37
+ docdir = $(datarootdir)/doc/$(PACKAGE)
38
+ oldincludedir = $(DESTDIR)/usr/include
39
+ includedir = $(prefix)/include
40
+ localstatedir = $(prefix)/var
41
+ sharedstatedir = $(prefix)/com
42
+ sysconfdir = $(prefix)/etc
43
+ datadir = $(datarootdir)
44
+ datarootdir = $(prefix)/share
45
+ libexecdir = $(exec_prefix)/libexec
46
+ sbindir = $(exec_prefix)/sbin
47
+ bindir = $(exec_prefix)/bin
48
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
49
+ archdir = $(rubylibdir)/$(arch)
50
+ sitelibdir = $(sitedir)/$(ruby_version)
51
+ sitearchdir = $(sitelibdir)/$(sitearch)
52
+ vendorlibdir = $(vendordir)/$(ruby_version)
53
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
54
+
55
+ CC = gcc
56
+ CXX = g++
57
+ LIBRUBY = lib$(RUBY_SO_NAME).dll.a
58
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
59
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
60
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
61
+ OUTFLAG = -o
62
+ COUTFLAG = -o
63
+
64
+ RUBY_EXTCONF_H =
65
+ cflags = $(optflags) $(debugflags) $(warnflags)
66
+ optflags = -O3
67
+ debugflags = -g
68
+ warnflags = -Wall -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
69
+ CFLAGS = $(cflags)
70
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
71
+ DEFS =
72
+ CPPFLAGS = -DHAVE_PROJ_API_H -Ic:/MinGW/local/include $(DEFS) $(cppflags)
73
+ CXXFLAGS = $(CFLAGS) $(cxxflags)
74
+ ldflags = -L. -Lc:/MinGW/local/lib
75
+ dldflags = -Wl,--enable-auto-image-base,--enable-auto-import $(DEFFILE)
76
+ ARCH_FLAG =
77
+ DLDFLAGS = $(ldflags) $(dldflags)
78
+ LDSHARED = $(CC) -shared $(if $(filter-out -g -g0,$(debugflags)),,-s)
79
+ LDSHAREDXX = $(CXX) -shared $(if $(filter-out -g -g0,$(debugflags)),,-s)
80
+ AR = ar
81
+ EXEEXT = .exe
82
+
83
+ RUBY_BASE_NAME = ruby
84
+ RUBY_INSTALL_NAME = ruby
85
+ RUBY_SO_NAME = msvcrt-ruby191
86
+ arch = i386-mingw32
87
+ sitearch = i386-msvcrt
88
+ ruby_version = 1.9.1
89
+ ruby = c:/MinGW/local/ruby/bin/ruby
90
+ RUBY = $(ruby)
91
+ RM = rm -f
92
+ RM_RF = $(RUBY) -run -e rm -- -rf
93
+ RMDIRS = rmdir --ignore-fail-on-non-empty -p
94
+ MAKEDIRS = /bin/mkdir -p
95
+ INSTALL = /bin/install -c
96
+ INSTALL_PROG = $(INSTALL) -m 0755
97
+ INSTALL_DATA = $(INSTALL) -m 644
98
+ COPY = cp
99
+
100
+ #### End of system configuration section. ####
101
+
102
+ preload =
103
+
104
+ libpath = . $(libdir)
105
+ LIBPATH = -L. -L$(libdir)
106
+ DEFFILE = $(TARGET)-$(arch).def
107
+
108
+ CLEANFILES = mkmf.log $(DEFFILE)
109
+ DISTCLEANFILES =
110
+ DISTCLEANDIRS =
111
+
112
+ extout =
113
+ extout_prefix =
114
+ target_prefix =
115
+ LOCAL_LIBS =
116
+ LIBS = $(LIBRUBYARG_SHARED) -lproj -lshell32 -lws2_32 -limagehlp
117
+ SRCS = projrb.c
118
+ OBJS = projrb.o
119
+ TARGET = proj4_ruby
120
+ DLLIB = $(TARGET).so
121
+ EXTSTATIC =
122
+ STATIC_LIB =
123
+
124
+ BINDIR = $(bindir)
125
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
126
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
127
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
128
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
129
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
130
+
131
+ TARGET_SO = $(DLLIB)
132
+ CLEANLIBS = $(TARGET).so
133
+ CLEANOBJS = *.o *.bak
134
+
135
+ all: $(DLLIB)
136
+ static: $(STATIC_LIB)
137
+ .PHONY: all install static install-so install-rb
138
+ .PHONY: clean clean-so clean-rb
139
+
140
+ clean-rb-default::
141
+ clean-rb::
142
+ clean-so::
143
+ clean: clean-so clean-rb-default clean-rb
144
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
145
+
146
+ distclean-rb-default::
147
+ distclean-rb::
148
+ distclean-so::
149
+ distclean: clean distclean-so distclean-rb-default distclean-rb
150
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
151
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
152
+ @-$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
153
+
154
+ realclean: distclean
155
+ install: install-so install-rb
156
+
157
+ install-so: $(RUBYARCHDIR)
158
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
159
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
160
+ @-$(MAKEDIRS) $(@D)
161
+ $(INSTALL_PROG) $(DLLIB) $(@D)
162
+ install-rb: pre-install-rb install-rb-default
163
+ install-rb-default: pre-install-rb-default
164
+ pre-install-rb: Makefile
165
+ pre-install-rb-default: Makefile
166
+ pre-install-rb-default:
167
+ $(ECHO) installing default proj4_ruby libraries
168
+ $(RUBYARCHDIR):
169
+ $(Q) $(MAKEDIRS) $@
170
+
171
+ site-install: site-install-so site-install-rb
172
+ site-install-so: install-so
173
+ site-install-rb: install-rb
174
+
175
+ .SUFFIXES: .c .m .cc .mm .cxx .cpp .o
176
+
177
+ .cc.o:
178
+ $(ECHO) compiling $(<)
179
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
180
+
181
+ .mm.o:
182
+ $(ECHO) compiling $(<)
183
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
184
+
185
+ .cxx.o:
186
+ $(ECHO) compiling $(<)
187
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
188
+
189
+ .cpp.o:
190
+ $(ECHO) compiling $(<)
191
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
192
+
193
+ .c.o:
194
+ $(ECHO) compiling $(<)
195
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
196
+
197
+ .m.o:
198
+ $(ECHO) compiling $(<)
199
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
200
+
201
+ $(DLLIB): $(DEFFILE) $(OBJS) Makefile
202
+ $(ECHO) linking shared-object $(DLLIB)
203
+ @-$(RM) $(@)
204
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
205
+
206
+
207
+
208
+ $(DEFFILE):
209
+ $(ECHO) generating $(@)
210
+ $(Q) $(RUBY) -e "puts 'EXPORTS', '' + 'Init_$(TARGET)'.sub(/\..*\z/,'')" > $@
211
+
212
+ $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
data/ext/mkmf.log ADDED
@@ -0,0 +1,25 @@
1
+ have_header: checking for proj_api.h... -------------------- no
2
+
3
+ "gcc -o conftest -Ic:/MinGW/local/ruby/include/ruby-1.9.1/i386-mingw32 -Ic:/MinGW/local/ruby/include/ruby-1.9.1/ruby/backward -Ic:/MinGW/local/ruby/include/ruby-1.9.1 -I. -O3 -g -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long conftest.c -L. -Lc:/MinGW/local/ruby/lib -L. -lmsvcrt-ruby191-static -lshell32 -lws2_32 "
4
+ checked program was:
5
+ /* begin */
6
+ 1: #include "ruby.h"
7
+ 2:
8
+ 3: #include <winsock2.h>
9
+ 4: #include <windows.h>
10
+ 5: int main() {return 0;}
11
+ /* end */
12
+
13
+ "gcc -E -Ic:/MinGW/local/ruby/include/ruby-1.9.1/i386-mingw32 -Ic:/MinGW/local/ruby/include/ruby-1.9.1/ruby/backward -Ic:/MinGW/local/ruby/include/ruby-1.9.1 -I. -O3 -g -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long conftest.c -o conftest.i"
14
+ conftest.c:5:22: proj_api.h: No such file or directory
15
+ checked program was:
16
+ /* begin */
17
+ 1: #include "ruby.h"
18
+ 2:
19
+ 3: #include <winsock2.h>
20
+ 4: #include <windows.h>
21
+ 5: #include <proj_api.h>
22
+ /* end */
23
+
24
+ --------------------
25
+
data/ext/projrb.c CHANGED
@@ -73,7 +73,7 @@ static VALUE proj_error_message(VALUE self, VALUE rerrno) {
73
73
  static VALUE proj_initialize(VALUE self, VALUE params){
74
74
  _wrap_pj* wpj;
75
75
  VALUE proj_params = rb_funcall(cProjection, idParseInitParameters, 1, params);
76
- int size = RARRAY(proj_params)->len;
76
+ int size = RARRAY_LEN(proj_params);
77
77
  char** c_params = (char **) malloc(size*sizeof(char *));
78
78
  int i;
79
79
 
metadata CHANGED
@@ -1,29 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proj4rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ hash: 15
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Guilhem Vellut
14
+ - Jochen Topf
15
+ - Charlie Savage
8
16
  autorequire:
9
17
  bindir: bin
10
18
  cert_chain: []
11
19
 
12
- date: 2009-12-24 00:00:00 -07:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description: " Proj4rb is a ruby binding for the Proj.4 Carthographic Projection library, that supports conversions between a very large number of geographic coordinate systems and datums.\n"
17
- email: guilhem.vellut@gmail.com
20
+ date: 2011-07-30 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: rake-compiler
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :development
35
+ version_requirements: *id001
36
+ description: " Proj4rb is a ruby binding for the Proj.4 Carthographic Projection library, that supports conversions between a very large number of geographic coordinate systems and datumspec.\n"
37
+ email:
18
38
  executables: []
19
39
 
20
40
  extensions:
21
41
  - ext/extconf.rb
22
- extra_rdoc_files:
23
- - README
42
+ extra_rdoc_files: []
43
+
24
44
  files:
25
- - rakefile.rb
26
- - README
45
+ - Rakefile
46
+ - README.rdoc
27
47
  - MIT-LICENSE
28
48
  - data/conus
29
49
  - data/epsg
@@ -57,37 +77,55 @@ files:
57
77
  - example/list-units.rb
58
78
  - example/version.rb
59
79
  - ext/extconf.rb
80
+ - ext/Makefile
81
+ - ext/mkmf.log
60
82
  - ext/projrb.c
61
- - ext/mingw/rakefile.rb
62
83
  - ext/vc/proj4_ruby.sln
63
84
  - ext/vc/proj4_ruby.vcproj
64
85
  - lib/proj4.rb
65
- has_rdoc: true
86
+ - test/test_constants.rb
87
+ - test/test_create_projection.rb
88
+ - test/test_datums.rb
89
+ - test/test_ellipsoids.rb
90
+ - test/test_errors.rb
91
+ - test/test_init_projection.rb
92
+ - test/test_prime_meridians.rb
93
+ - test/test_projection_type.rb
94
+ - test/test_simple_projection.rb
95
+ - test/test_transform.rb
96
+ - test/test_units.rb
66
97
  homepage: http://proj4rb.rubyforge.org/
67
98
  licenses: []
68
99
 
69
100
  post_install_message:
70
- rdoc_options:
71
- - --main
72
- - README
101
+ rdoc_options: []
102
+
73
103
  require_paths:
74
104
  - lib
75
105
  required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
76
107
  requirements:
77
108
  - - ">="
78
109
  - !ruby/object:Gem::Version
79
- version: 1.8.4
80
- version:
110
+ hash: 57
111
+ segments:
112
+ - 1
113
+ - 8
114
+ - 7
115
+ version: 1.8.7
81
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
82
118
  requirements:
83
119
  - - ">="
84
120
  - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
85
124
  version: "0"
86
- version:
87
125
  requirements:
88
126
  - Proj.4 C library
89
127
  rubyforge_project: proj4rb
90
- rubygems_version: 1.3.5
128
+ rubygems_version: 1.8.6
91
129
  signing_key:
92
130
  specification_version: 3
93
131
  summary: Ruby bindings for the Proj.4 Carthographic Projection library
@@ -1,38 +0,0 @@
1
- # We can't use Ruby's standard build procedures
2
- # on Windows because the Ruby executable is
3
- # built with VC++ while here we want to build
4
- # with MingW. So just roll our own...
5
-
6
- require 'rake/clean'
7
- require 'rbconfig'
8
-
9
- RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
10
- RUBY_BIN_DIR = Config::CONFIG["bindir"]
11
- RUBY_LIB_DIR = Config::CONFIG["libdir"]
12
- RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
13
- RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
14
-
15
- EXTENSION_NAME = "proj4_ruby.#{Config::CONFIG["DLEXT"]}"
16
-
17
- CLEAN.include('*.o')
18
- CLOBBER.include(EXTENSION_NAME)
19
-
20
- task :default => "projrb"
21
-
22
- SRC = FileList['../*.c']
23
- OBJ = SRC.collect do |file_name|
24
- File.basename(file_name).ext('o')
25
- end
26
-
27
- SRC.each do |srcfile|
28
- objfile = File.basename(srcfile).ext('o')
29
- file objfile => srcfile do
30
- command = "gcc -c -fPIC -O2 -Wall -mms-bitfields -o #{objfile} #{srcfile} -I#{RUBY_INCLUDE_DIR} -I/local/include"
31
- sh "sh -c '#{command}'"
32
- end
33
- end
34
-
35
- file "projrb" => OBJ do
36
- command = "gcc -shared -o #{EXTENSION_NAME} #{OBJ} -lproj #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL} -L/local/lib"
37
- sh "sh -c '#{command}'"
38
- end
data/rakefile.rb DELETED
@@ -1,130 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'rake/rdoctask'
5
- require 'rake/gempackagetask'
6
- require 'rake/clean'
7
- require 'date'
8
- require 'ftools'
9
-
10
- CLOBBER.include('pkg/*', 'proj4rb-doc/**/*', 'lib/*.so', 'lib/*.bundle', 'lib/*.dll', 'ext/*.o', 'ext/*.so', 'ext/*.bundle', 'ext/*.dll', 'ext/Makefile', 'ext/mkmf.log')
11
-
12
- desc "Create Makefile"
13
- file 'ext/Makefile' => ['ext/extconf.rb'] do
14
- sh 'cd ext; ruby extconf.rb'
15
- end
16
-
17
- desc "Build from C library"
18
- task :build => ['ext/Makefile', 'ext/projrb.c'] do
19
- sh 'cd ext; make'
20
- end
21
-
22
- # ------- Default Package ----------
23
- FILES = FileList[
24
- 'rakefile.rb',
25
- 'README',
26
- 'MIT-LICENSE',
27
- 'data/**/*',
28
- 'doc/**/*',
29
- 'example/**/*',
30
- 'ext/*',
31
- 'ext/mingw/rakefile.rb',
32
- 'ext/vc/*.sln',
33
- 'ext/vc/*.vcproj',
34
- 'lib/**/*.rb'
35
- ]
36
-
37
- # Default GEM Specification
38
- default_spec = Gem::Specification::new do |s|
39
- s.name = 'proj4rb'
40
- s.version = "0.3.1"
41
- s.summary = "Ruby bindings for the Proj.4 Carthographic Projection library"
42
- s.description = <<-EOF
43
- Proj4rb is a ruby binding for the Proj.4 Carthographic Projection library, that supports conversions between a very large number of geographic coordinate systems and datums.
44
- EOF
45
- s.author = 'Guilhem Vellut'
46
- s.email = 'guilhem.vellut@gmail.com'
47
- s.homepage = 'http://proj4rb.rubyforge.org/'
48
- s.rubyforge_project = 'proj4rb'
49
- s.required_ruby_version = '>= 1.8.4'
50
- s.date = DateTime.now
51
-
52
- s.platform = Gem::Platform::RUBY
53
- s.requirements << 'Proj.4 C library'
54
- s.require_path = 'lib'
55
- s.extensions = ["ext/extconf.rb"]
56
- s.files = FILES.to_a
57
- s.test_files = FileList['test/test*.rb']
58
-
59
- s.has_rdoc = true
60
- s.extra_rdoc_files = ["README"]
61
- s.rdoc_options.concat ['--main', 'README']
62
- end
63
-
64
- desc "Package the library as a gem"
65
- Rake::GemPackageTask.new(default_spec) do |pkg|
66
- # pkg.need_zip = true
67
- pkg.need_tar = true
68
- end
69
-
70
-
71
- # ------- Windows Package ----------
72
- binaries = (FileList['ext/mingw/*.so',
73
- 'ext/mingw/*.dll*'])
74
-
75
- win_spec = default_spec.clone
76
- win_spec.extensions = []
77
- win_spec.platform = Gem::Platform::CURRENT
78
- win_spec.files += binaries.map {|binaryname| "lib/#{File.basename(binaryname)}"}
79
-
80
- desc "Create Windows Gem"
81
- task :create_win32_gem do
82
- # Copy the win32 extension built by MingW - easier to install
83
- # since there are no dependencies of msvcr80.dll
84
- current_dir = File.expand_path(File.dirname(__FILE__))
85
-
86
- binaries.each do |binaryname|
87
- target = File.join(current_dir, 'lib', File.basename(binaryname))
88
- cp(binaryname, target)
89
- end
90
-
91
- # Create the gem, then move it to admin/pkg
92
- Gem::Builder.new(win_spec).build
93
- gem_file = "#{win_spec.name}-#{win_spec.version}-#{win_spec.platform}.gem"
94
- mv(gem_file, "pkg/#{gem_file}")
95
-
96
- # Remove win extension from top level directory
97
- binaries.each do |binaryname|
98
- target = File.join(current_dir, 'lib', File.basename(binaryname))
99
- rm(target)
100
- end
101
- end
102
-
103
-
104
- # --------- Test Task ---------
105
- Rake::TestTask.new do |t|
106
- t.libs << "test"
107
- t.libs << "lib"
108
- end
109
-
110
- # --------- RDoc Documentation ---------
111
- desc "Generate rdoc documentation"
112
- Rake::RDocTask.new("rdoc") do |rdoc|
113
- rdoc.rdoc_dir = 'doc/rdoc'
114
- rdoc.title = "Proj4rb Documentation"
115
- # Show source inline with line numbers
116
- rdoc.options << "--inline-source" << "--line-numbers"
117
- # Make the readme file the start page for the generated html
118
- rdoc.options << '--main' << 'README'
119
- rdoc.rdoc_files.include('doc/*.rdoc',
120
- 'ext/**/*.c',
121
- 'lib/**/*.rb',
122
- 'README',
123
- 'MIT-LICENSE')
124
- end
125
-
126
- task :default => :package
127
-
128
- if RUBY_PLATFORM.match(/win32/)
129
- task :package => :create_win32_gem
130
- end