sqlanywhere 0.1.0-i386-mswin32 → 0.1.1-i386-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,7 +1,16 @@
1
1
  =CHANGE LOG
2
2
 
3
+ =====0.1.1 -- 2008/11/06
4
+ - Created a source gem rake task
5
+ - Created a 'hint' file if the source gem is used directly
6
+ - Changed file permissions on archives
7
+ - Changed archives to be specific to platform (.zip on windows, .tar.gz
8
+ otherwise)
9
+ - Changed default rake task to only build library, not gem
10
+ - Added a gem rake task
11
+
3
12
  =====0.1.0 -- 2008/10/15
4
13
  - Initial Release
5
- - Wraps DBCAPI funcationality
14
+ - Wraps DBCAPI functionality
6
15
  - Includes a simple unit test suite
7
16
 
data/README CHANGED
@@ -19,9 +19,13 @@ This driver is licensed under the Apache License, Version 2.
19
19
 
20
20
  ===All Platforms
21
21
 
22
- To build and install the gem, use:
22
+ To build the library (.so), use:
23
23
 
24
24
  rake
25
+
26
+ To build and install the gem, use:
27
+
28
+ rake gem
25
29
  rake install
26
30
 
27
31
  The other rake tasks are
data/Rakefile ADDED
@@ -0,0 +1,207 @@
1
+ #====================================================
2
+ #
3
+ # Copyright 2008 iAnywhere Solutions, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ #
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ # While not a requirement of the license, if you do modify this file, we
20
+ # would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
21
+ #
22
+ #
23
+ #====================================================
24
+
25
+ require 'ftools'
26
+ require 'rbconfig'
27
+ require 'rake/clean'
28
+ require 'rake/rdoctask'
29
+ require 'rubygems'
30
+ require 'rubygems/builder'
31
+
32
+ # By default, windows will try to use nmake instead of make. If you are on windows but using
33
+ # a different compiler that uses standard make, set this to false.
34
+ USE_NMAKE_ON_WIN = true
35
+
36
+ # By default on windows, ruby expects to be compiled by Visual Studio C++ 6.0. If you are using
37
+ # a newer version of Visual Studio, you will need to apply a manifest to the dll. To apply the
38
+ # manifest set this to true.
39
+ APPLY_MANIFEST = false
40
+
41
+ PACKAGE_NAME = "sqlanywhere"
42
+ ARCH=Config::CONFIG['arch']
43
+
44
+ pkg_version = ""
45
+
46
+ # The package version of determined by parsing the c source file. This ensures the version is
47
+ # only ever specified ins a single place.
48
+ File.open(File.join("ext", "sqlanywhere.c") ) do |f|
49
+ f.grep( /const char\* VERSION/ ) do |line|
50
+ pkg_version = /\s*const char\* VERSION\s*=\s*["|']([^"']*)["|'];\s*/.match(line)[1]
51
+ end
52
+ end
53
+
54
+ # If we can't determine the version, throw up your hands and exit
55
+ raise RuntimeError, "Could not determine current package version!" if pkg_version.empty?
56
+
57
+ # The hint file will be automatically added to a souce_gem builds. If someone installs the source gem and
58
+ # tries to run it, they will get a LoadError telling them that they must compile the software. This file
59
+ # ONLY exists in a source gem
60
+ hint_file = "raise LoadError, \"You need to compile the sqlanywhere package for this particular platform. To compile the package, change to the sqlanywhere package directory and run rake:\n cd $GEM_HOME/sqlanywhere-#{pkg_version}\n rake\nFor more information on compiling, please read $GEM_HOME/sqlanywhere-#{pkg_version}/README\""
61
+
62
+ MAKE = (ARCH =~ /win32/ and USE_NMAKE_ON_WIN) ? 'nmake' : 'make'
63
+
64
+ spec = Gem::Specification.new do |spec|
65
+ spec.authors = ["Eric Farrar"]
66
+ spec.email = 'eric.farrar@ianywhere.com'
67
+ spec.name = 'sqlanywhere'
68
+ spec.summary = 'SQL Anywhere library for Ruby'
69
+ spec.description = <<-EOF
70
+ SQL Anywhere Driver for Ruby
71
+ EOF
72
+ spec.version = pkg_version
73
+ spec.autorequire = 'sqlanywhere'
74
+ spec.has_rdoc = true
75
+ spec.rubyforge_project = 'sqlanywhere'
76
+ spec.homepage = 'http://sqlanywhere.rubyforge.org'
77
+ spec.platform = Gem::Platform::CURRENT
78
+ spec.required_ruby_version = '>= 1.8.6'
79
+ spec.require_paths = ['lib']
80
+ spec.test_file = 'test/sqlanywhere_test.rb'
81
+ spec.rdoc_options << '--title' << 'SQL Anywhere Ruby Driver' <<
82
+ '--main' << 'README' <<
83
+ '--line-numbers'
84
+ spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'ext/sqlanywhere.c']
85
+ end
86
+
87
+ # The default task is to build the library (.dll or .so)
88
+ desc "Build the library"
89
+ task :default => ["lib/sqlanywhere.so"]
90
+
91
+ # Builds the binary gem for this platform
92
+ desc "Build the gem"
93
+ task :gem => ["sqlanywhere-#{pkg_version}-#{spec.platform}.gem"]
94
+
95
+ file "sqlanywhere-#{pkg_version}-#{spec.platform}.gem" => ["Rakefile",
96
+ "test/test.sql",
97
+ "test/sqlanywhere_test.rb",
98
+ "README",
99
+ "CHANGELOG",
100
+ "LICENSE",
101
+ "lib/sqlanywhere.so"] do
102
+ # Get the updated list of files to include in the gem
103
+ spec.files = Dir['ext/**/*'] + Dir['lib/**/*'] + Dir['test/**/*'] + Dir['CHANGELOG'] + Dir['LICENSE'] + Dir['README'] + Dir['Rakefile']
104
+ # Set the gem to be platform specific since it includes compiled binaries
105
+ spec.platform = Gem::Platform::CURRENT
106
+ Gem::Builder.new(spec).build
107
+ end
108
+
109
+ # Builds the source gem for any platform
110
+ desc "Build the source gem"
111
+ task :source_gem => ["sqlanywhere-#{pkg_version}.gem"]
112
+
113
+ file "sqlanywhere-#{pkg_version}.gem" => ["Rakefile",
114
+ "test/test.sql",
115
+ "test/sqlanywhere_test.rb",
116
+ "README",
117
+ "CHANGELOG",
118
+ "LICENSE"] do
119
+ # Create the hint file in the lib directory
120
+ File.open(File.join("lib", "sqlanywhere.rb"), "w") do |f|
121
+ f.puts hint_file
122
+ end
123
+ # Get the updated list of files to include in the gem
124
+ spec.files = Dir['ext/**/*'] + Dir['lib/**/*'] + Dir['test/**/*'] + Dir['CHANGELOG'] + Dir['LICENSE'] + Dir['README'] + Dir['Rakefile']
125
+ # Since this contains no compilked binaries, set it to be platform RUBY
126
+ spec.platform = Gem::Platform::RUBY
127
+ Gem::Builder.new(spec).build
128
+ # Delete the hint file
129
+ File.unlink(File.join("lib", "sqlanywhere.rb"))
130
+ end
131
+
132
+
133
+ file "lib/sqlanywhere.so" => ["ext/sqlanywhere.so"] do
134
+ # If the hint file exists, delete it
135
+ File.unlink(File.join("lib", "sqlanywhere.rb")) if File.exists?(File.join("lib", "sqlanywhere.rb"))
136
+ File.copy(File.join("ext", "sqlanywhere.so"), "lib")
137
+ end
138
+
139
+ file "ext/sqlanywhere.so" => ["ext/sqlanywhere.c"] do
140
+ sh "cd ext && ruby extconf.rb"
141
+ sh "cd ext && #{MAKE}"
142
+ sh "cd ext && mt -outputresource:sqlanywhere.so;2 -manifest sqlanywhere.so.manifest" if APPLY_MANIFEST
143
+ end
144
+
145
+ desc "Install the gem"
146
+ task :install => [:gem] do
147
+ sh "gem install sqlanywhere-#{pkg_version}-#{spec.platform}.gem"
148
+ end
149
+
150
+ # This builds the distributables. On windows it builds a platform specific gem, a source gem, and a souce zip archive.
151
+ # On other platforms this builds a platform specific gem, a source gem, and a source tar.gz archive.
152
+ desc "Build distributables (src zip, src tar.gz, gem)"
153
+ task :dist do |t|
154
+ puts "Cleaning Build Environment..."
155
+ Rake.application['clobber'].invoke
156
+
157
+ files = Dir.glob('*')
158
+
159
+ puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version} directory..."
160
+ FileUtils.mkdir_p "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
161
+
162
+ puts "Copying files to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}..."
163
+ FileUtils.cp_r files, "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
164
+
165
+ if( ARCH =~ /win32/ ) then
166
+ system "attrib -R #{File.join('build', PACKAGE_NAME)}-#{pkg_version} /S"
167
+ else
168
+ system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type d -exec chmod 755 {} \\;"
169
+ system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type f -exec chmod 644 {} \\;"
170
+ end
171
+
172
+ if( ARCH =~ /win32/ ) then
173
+ puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.zip..."
174
+ system "cd build && zip -q -r #{PACKAGE_NAME}-#{pkg_version}.zip #{PACKAGE_NAME}-#{pkg_version}"
175
+ else
176
+ puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar..."
177
+ system "tar cf #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar -C build #{PACKAGE_NAME}-#{pkg_version}"
178
+
179
+ puts "GZipping to create #{File.join('build', PACKAGE_NAME, PACKAGE_NAME)}-#{pkg_version}.tar.gz..."
180
+ system "gzip #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar"
181
+ end
182
+
183
+ puts "Building GEM source distributable..."
184
+ Rake.application['source_gem'].invoke
185
+
186
+ puts "Copying source GEM to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.gem..."
187
+ FileUtils.cp "#{PACKAGE_NAME}-#{pkg_version}.gem", "build"
188
+
189
+ puts "Building GEM binary distributable..."
190
+ Rake.application['gem'].invoke
191
+
192
+ puts "Copying binary GEM to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}-#{spec.platform}.gem..."
193
+ FileUtils.cp "#{PACKAGE_NAME}-#{pkg_version}-#{spec.platform}.gem", "build"
194
+ end
195
+
196
+ Rake::RDocTask.new do |rd|
197
+ rd.title = "SQL Anywhere Ruby Driver"
198
+ rd.main = "README"
199
+ rd.rdoc_files.include('README', 'CHANGELOG', 'LICENSE', 'ext/sqlanywhere.c')
200
+ end
201
+
202
+ desc "Publish the RDOCs on RubyForge"
203
+ task :publish_rdoc => ["html/index.html"] do
204
+ system "pscp -r html/* efarrar@rubyforge.org:/var/www/gforge-projects/sqlanywhere/sqlanywhere"
205
+ end
206
+
207
+ CLOBBER.include("sqlanywhere-#{pkg_version}-#{spec.platform}.gem", "sqlanywhere-#{pkg_version}.gem", "lib/*", "ext/*.obj", "ext/*.def", "ext/*.so", "ext/*.log", "ext/*.exp", "ext/*.lib", "ext/*.pdb", "ext/Makefile", "ext/*.so.manifest", "ext/*.o", "build/**/*", "build")
data/ext/Makefile ADDED
@@ -0,0 +1,180 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = c:/programs/ruby/lib/ruby/1.8/i386-mswin32
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir);$(topdir);$(hdrdir)
10
+
11
+ DESTDIR = c:
12
+ prefix = $(DESTDIR)/programs/ruby
13
+ exec_prefix = $(prefix)
14
+ sitedir = $(prefix)/lib/ruby/site_ruby
15
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
16
+ archdir = $(rubylibdir)/$(arch)
17
+ sbindir = $(exec_prefix)/sbin
18
+ datadir = $(prefix)/share
19
+ includedir = $(prefix)/include
20
+ infodir = $(prefix)/info
21
+ sysconfdir = $(prefix)/etc
22
+ mandir = $(prefix)/man
23
+ libdir = $(exec_prefix)/lib
24
+ sharedstatedir = $(DESTDIR)/etc
25
+ oldincludedir = $(DESTDIR)/usr/include
26
+ sitearchdir = $(sitelibdir)/$(sitearch)
27
+ localstatedir = $(DESTDIR)/var
28
+ bindir = $(exec_prefix)/bin
29
+ sitelibdir = $(sitedir)/$(ruby_version)
30
+ libexecdir = $(exec_prefix)/libexec
31
+
32
+ CC = cl -nologo
33
+ LIBRUBY = $(RUBY_SO_NAME).lib
34
+ LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
35
+ LIBRUBYARG_SHARED = $(LIBRUBY)
36
+ LIBRUBYARG_STATIC = $(LIBRUBY_A)
37
+
38
+ RUBY_EXTCONF_H =
39
+ CFLAGS = -MD -Zi -O2b2xg- -G6
40
+ INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
41
+ CPPFLAGS =
42
+ CXXFLAGS = $(CFLAGS)
43
+ DLDFLAGS = -link -incremental:no -debug -opt:ref -opt:icf -dll $(LIBPATH) -def:$(DEFFILE) -implib:$(*F:.so=)-$(arch).lib -pdb:$(*F:.so=)-$(arch).pdb
44
+ LDSHARED = cl -nologo -LD
45
+ AR = lib -nologo
46
+ EXEEXT = .exe
47
+
48
+ RUBY_INSTALL_NAME = ruby
49
+ RUBY_SO_NAME = msvcrt-ruby18
50
+ arch = i386-mswin32
51
+ sitearch = i386-msvcrt
52
+ ruby_version = 1.8
53
+ ruby = c:/programs/ruby/bin/ruby
54
+ RUBY = $(ruby:/=\)
55
+ RM = $(RUBY) -run -e rm -- -f
56
+ MAKEDIRS = @$(RUBY) -run -e mkdir -- -p
57
+ INSTALL = @$(RUBY) -run -e install -- -vp
58
+ INSTALL_PROG = $(INSTALL) -m 0755
59
+ INSTALL_DATA = $(INSTALL) -m 0644
60
+ COPY = copy > nul
61
+
62
+ #### End of system configuration section. ####
63
+
64
+ preload =
65
+
66
+ libpath = . $(libdir)
67
+ LIBPATH = -libpath:"." -libpath:"$(libdir)"
68
+ DEFFILE = $(TARGET)-$(arch).def
69
+
70
+ CLEANFILES = mkmf.log
71
+ DISTCLEANFILES = vc*.pdb $(DEFFILE)
72
+
73
+ extout =
74
+ extout_prefix =
75
+ target_prefix =
76
+ LOCAL_LIBS =
77
+ LIBS = $(LIBRUBYARG_SHARED) oldnames.lib user32.lib advapi32.lib ws2_32.lib
78
+ SRCS = sacapidll.c sqlanywhere.c
79
+ OBJS = sacapidll.obj sqlanywhere.obj
80
+ TARGET = sqlanywhere
81
+ DLLIB = $(TARGET).so
82
+ EXTSTATIC =
83
+ STATIC_LIB =
84
+
85
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
86
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
87
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
88
+
89
+ TARGET_SO = $(DLLIB)
90
+ CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
91
+ CLEANOBJS = *.obj *.lib *.s[ol] *.pdb *.exp *.bak
92
+
93
+ all: $(DLLIB)
94
+ static: $(STATIC_LIB)
95
+
96
+ clean:
97
+ @-$(RM) $(CLEANLIBS:/=\) $(CLEANOBJS:/=\) $(CLEANFILES:/=\)
98
+
99
+ distclean: clean
100
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
101
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES:/=\)
102
+
103
+ realclean: distclean
104
+ install: install-so install-rb
105
+
106
+ install-so: $(RUBYARCHDIR)
107
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
108
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
109
+ $(INSTALL_PROG) $(DLLIB:/=\) $(RUBYARCHDIR:/=\)
110
+ install-rb: pre-install-rb install-rb-default
111
+ install-rb-default: pre-install-rb-default
112
+ pre-install-rb: Makefile
113
+ pre-install-rb-default: Makefile
114
+ $(RUBYARCHDIR):
115
+ $(MAKEDIRS) $@
116
+
117
+ site-install: site-install-so site-install-rb
118
+ site-install-so: install-so
119
+ site-install-rb: install-rb
120
+
121
+ .SUFFIXES: .c .m .cc .cxx .cpp .obj
122
+
123
+ {$(srcdir)}.cc{}.obj:
124
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
125
+
126
+ {$(topdir)}.cc{}.obj:
127
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
128
+
129
+ {$(hdrdir)}.cc{}.obj:
130
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
131
+
132
+ .cc.obj:
133
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
134
+
135
+ {$(srcdir)}.cxx{}.obj:
136
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
137
+
138
+ {$(topdir)}.cxx{}.obj:
139
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
140
+
141
+ {$(hdrdir)}.cxx{}.obj:
142
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
143
+
144
+ .cxx.obj:
145
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
146
+
147
+ {$(srcdir)}.cpp{}.obj:
148
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
149
+
150
+ {$(topdir)}.cpp{}.obj:
151
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
152
+
153
+ {$(hdrdir)}.cpp{}.obj:
154
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
155
+
156
+ .cpp.obj:
157
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
158
+
159
+ {$(srcdir)}.c{}.obj:
160
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
161
+
162
+ {$(topdir)}.c{}.obj:
163
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
164
+
165
+ {$(hdrdir)}.c{}.obj:
166
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
167
+
168
+ .c.obj:
169
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
170
+
171
+ $(DLLIB): $(DEFFILE) $(OBJS)
172
+ @-$(RM) $@
173
+ $(LDSHARED) -Fe$(@) $(OBJS) $(LIBS) $(LOCAL_LIBS) $(DLDFLAGS)
174
+
175
+
176
+
177
+ $(DEFFILE):
178
+ $(RUBY) -e "puts 'EXPORTS', 'Init_$(TARGET)'" > $@
179
+
180
+ $(OBJS): {.;$(srcdir);$(topdir);$(hdrdir)}ruby.h {.;$(srcdir);$(topdir);$(hdrdir)}defines.h
data/ext/extconf.rb ADDED
@@ -0,0 +1,30 @@
1
+ #====================================================
2
+ #
3
+ # Copyright 2008 iAnywhere Solutions, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ #
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ # While not a requirement of the license, if you do modify this file, we
20
+ # would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
21
+ #
22
+ #
23
+ #====================================================
24
+
25
+ require 'mkmf'
26
+
27
+ dir_config('SQLANY')
28
+
29
+ create_makefile("sqlanywhere")
30
+