pg 1.5.8-x64-mingw-ucrt → 1.6.0.rc1-x64-mingw-ucrt
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Gemfile +7 -4
- data/History.md +37 -0
- data/README-Windows.rdoc +1 -1
- data/README.ja.md +3 -3
- data/README.md +4 -4
- data/Rakefile +56 -13
- data/ext/errorcodes.def +4 -5
- data/ext/errorcodes.txt +2 -5
- data/ext/extconf.rb +119 -13
- data/ext/gvl_wrappers.c +13 -2
- data/ext/gvl_wrappers.h +33 -0
- data/ext/pg.c +16 -5
- data/ext/pg.h +8 -9
- data/ext/pg_binary_decoder.c +150 -0
- data/ext/pg_binary_encoder.c +203 -7
- data/ext/pg_cancel_connection.c +360 -0
- data/ext/pg_coder.c +3 -5
- data/ext/pg_connection.c +337 -148
- data/ext/pg_copy_coder.c +2 -2
- data/ext/pg_record_coder.c +1 -1
- data/ext/pg_result.c +9 -11
- data/ext/pg_text_encoder.c +2 -2
- data/ext/pg_tuple.c +2 -2
- data/ext/pg_type_map.c +1 -1
- data/ext/pg_type_map_all_strings.c +1 -1
- data/ext/pg_type_map_by_class.c +1 -1
- data/ext/pg_type_map_by_column.c +1 -1
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +1 -1
- data/ext/pg_type_map_in_ruby.c +1 -1
- data/lib/3.1/pg_ext.so +0 -0
- data/lib/3.2/pg_ext.so +0 -0
- data/lib/3.3/pg_ext.so +0 -0
- data/lib/pg/basic_type_registry.rb +2 -2
- data/lib/pg/cancel_connection.rb +30 -0
- data/lib/pg/connection.rb +187 -133
- data/lib/pg/version.rb +1 -1
- data/lib/pg.rb +13 -8
- data/pg.gemspec +5 -3
- data/{lib/x64-mingw-ucrt → ports/x64-mingw-ucrt/lib}/libpq.dll +0 -0
- data.tar.gz.sig +0 -0
- metadata +10 -19
- metadata.gz.sig +0 -0
- data/.appveyor.yml +0 -42
- data/.gems +0 -6
- data/.gemtest +0 -0
- data/.github/workflows/binary-gems.yml +0 -117
- data/.github/workflows/source-gem.yml +0 -152
- data/.gitignore +0 -22
- data/.hgsigs +0 -34
- data/.hgtags +0 -41
- data/.irbrc +0 -23
- data/.pryrc +0 -23
- data/.tm_properties +0 -21
- data/.travis.yml +0 -49
- data/Rakefile.cross +0 -298
data/Rakefile.cross
DELETED
@@ -1,298 +0,0 @@
|
|
1
|
-
# -*- rake -*-
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
require 'tempfile'
|
5
|
-
require 'rbconfig'
|
6
|
-
require 'rake/clean'
|
7
|
-
require 'rake/extensiontask'
|
8
|
-
require 'rake/extensioncompiler'
|
9
|
-
require 'ostruct'
|
10
|
-
require_relative 'rakelib/task_extension'
|
11
|
-
|
12
|
-
MISCDIR = BASEDIR + 'misc'
|
13
|
-
|
14
|
-
NUM_CPUS = if File.exist?('/proc/cpuinfo')
|
15
|
-
File.read('/proc/cpuinfo').scan('processor').length
|
16
|
-
elsif RUBY_PLATFORM.include?( 'darwin' )
|
17
|
-
`system_profiler SPHardwareDataType | grep 'Cores' | awk '{print $5}'`.chomp
|
18
|
-
else
|
19
|
-
1
|
20
|
-
end
|
21
|
-
|
22
|
-
class CrossLibrary < OpenStruct
|
23
|
-
include Rake::DSL
|
24
|
-
prepend TaskExtension
|
25
|
-
|
26
|
-
def initialize(for_platform, openssl_config, toolchain)
|
27
|
-
super()
|
28
|
-
|
29
|
-
self.for_platform = for_platform
|
30
|
-
self.openssl_config = openssl_config
|
31
|
-
self.host_platform = toolchain
|
32
|
-
|
33
|
-
# Cross-compilation constants
|
34
|
-
self.openssl_version = ENV['OPENSSL_VERSION'] || '3.3.2'
|
35
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '16.4'
|
36
|
-
|
37
|
-
# Check if symlinks work in the current working directory.
|
38
|
-
# This fails, if rake-compiler-dock is running on a Windows box.
|
39
|
-
begin
|
40
|
-
FileUtils.rm_f '.test_symlink'
|
41
|
-
FileUtils.ln_s '/', '.test_symlink'
|
42
|
-
rescue NotImplementedError, SystemCallError
|
43
|
-
# Symlinks don't work -> use home directory instead
|
44
|
-
self.compile_home = Pathname( "~/.ruby-pg-build" ).expand_path
|
45
|
-
else
|
46
|
-
self.compile_home = Pathname( "./build" ).expand_path
|
47
|
-
end
|
48
|
-
self.static_sourcesdir = compile_home + 'sources'
|
49
|
-
self.static_builddir = compile_home + 'builds' + for_platform
|
50
|
-
CLOBBER.include( static_sourcesdir )
|
51
|
-
CLEAN.include( static_builddir )
|
52
|
-
|
53
|
-
# Static OpenSSL build vars
|
54
|
-
self.static_openssl_builddir = static_builddir + "openssl-#{openssl_version}"
|
55
|
-
self.openssl_source_uri =
|
56
|
-
URI( "https://github.com/openssl/openssl/releases/download/openssl-#{openssl_version}/openssl-#{openssl_version}.tar.gz" )
|
57
|
-
self.openssl_tarball = static_sourcesdir + File.basename( openssl_source_uri.path )
|
58
|
-
self.openssl_makefile = static_openssl_builddir + 'Makefile'
|
59
|
-
|
60
|
-
self.libssl = static_openssl_builddir + 'libssl.a'
|
61
|
-
self.libcrypto = static_openssl_builddir + 'libcrypto.a'
|
62
|
-
|
63
|
-
self.openssl_patches = Rake::FileList[ (MISCDIR + "openssl-#{openssl_version}.*.patch").to_s ]
|
64
|
-
|
65
|
-
# Static PostgreSQL build vars
|
66
|
-
self.static_postgresql_builddir = static_builddir + "postgresql-#{postgresql_version}"
|
67
|
-
self.postgresql_source_uri = begin
|
68
|
-
uristring = "http://ftp.postgresql.org/pub/source/v%s/postgresql-%s.tar.bz2" %
|
69
|
-
[ postgresql_version, postgresql_version ]
|
70
|
-
URI( uristring )
|
71
|
-
end
|
72
|
-
self.postgresql_tarball = static_sourcesdir + File.basename( postgresql_source_uri.path )
|
73
|
-
|
74
|
-
self.static_postgresql_srcdir = static_postgresql_builddir + 'src'
|
75
|
-
self.static_postgresql_libdir = static_postgresql_srcdir + 'interfaces/libpq'
|
76
|
-
self.static_postgresql_incdir = static_postgresql_srcdir + 'include'
|
77
|
-
|
78
|
-
self.postgresql_global_makefile = static_postgresql_srcdir + 'Makefile.global'
|
79
|
-
self.postgresql_shlib_makefile = static_postgresql_srcdir + 'Makefile.shlib'
|
80
|
-
self.postgresql_shlib_mf_orig = static_postgresql_srcdir + 'Makefile.shlib.orig'
|
81
|
-
self.postgresql_lib = static_postgresql_libdir + 'libpq.dll'
|
82
|
-
self.postgresql_patches = Rake::FileList[ (MISCDIR + "postgresql-#{postgresql_version}.*.patch").to_s ]
|
83
|
-
|
84
|
-
# clean intermediate files and folders
|
85
|
-
CLEAN.include( static_builddir.to_s )
|
86
|
-
|
87
|
-
#####################################################################
|
88
|
-
### C R O S S - C O M P I L A T I O N - T A S K S
|
89
|
-
#####################################################################
|
90
|
-
|
91
|
-
|
92
|
-
directory static_sourcesdir.to_s
|
93
|
-
|
94
|
-
#
|
95
|
-
# Static OpenSSL build tasks
|
96
|
-
#
|
97
|
-
directory static_openssl_builddir.to_s
|
98
|
-
|
99
|
-
# openssl source file should be stored there
|
100
|
-
file openssl_tarball => static_sourcesdir do |t|
|
101
|
-
download( openssl_source_uri, t.name )
|
102
|
-
end
|
103
|
-
|
104
|
-
# Extract the openssl builds
|
105
|
-
file static_openssl_builddir => openssl_tarball do |t|
|
106
|
-
puts "extracting %s to %s" % [ openssl_tarball, static_openssl_builddir.parent ]
|
107
|
-
static_openssl_builddir.mkpath
|
108
|
-
run 'tar', '-xzf', openssl_tarball.to_s, '-C', static_openssl_builddir.parent.to_s
|
109
|
-
openssl_makefile.unlink if openssl_makefile.exist?
|
110
|
-
|
111
|
-
openssl_patches.each do |patchfile|
|
112
|
-
puts " applying patch #{patchfile}..."
|
113
|
-
run 'patch', '-Np1', '-d', static_openssl_builddir.to_s,
|
114
|
-
'-i', File.expand_path( patchfile, BASEDIR )
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
self.cmd_prelude = [
|
119
|
-
"env",
|
120
|
-
"CROSS_COMPILE=#{host_platform}-",
|
121
|
-
"CFLAGS=-DDSO_WIN32",
|
122
|
-
]
|
123
|
-
|
124
|
-
|
125
|
-
# generate the makefile in a clean build location
|
126
|
-
file openssl_makefile => static_openssl_builddir do |t|
|
127
|
-
chdir( static_openssl_builddir ) do
|
128
|
-
cmd = cmd_prelude.dup
|
129
|
-
cmd << "./Configure" << "-static" << openssl_config
|
130
|
-
|
131
|
-
run( *cmd )
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
desc "compile static openssl libraries"
|
136
|
-
task "openssl_libs:#{for_platform}" => [ libssl, libcrypto ]
|
137
|
-
|
138
|
-
task "compile_static_openssl:#{for_platform}" => openssl_makefile do |t|
|
139
|
-
chdir( static_openssl_builddir ) do
|
140
|
-
cmd = cmd_prelude.dup
|
141
|
-
cmd << 'make' << "-j#{NUM_CPUS}" << 'build_libs'
|
142
|
-
|
143
|
-
run( *cmd )
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
desc "compile static #{libssl}"
|
148
|
-
file libssl => "compile_static_openssl:#{for_platform}"
|
149
|
-
|
150
|
-
desc "compile static #{libcrypto}"
|
151
|
-
file libcrypto => "compile_static_openssl:#{for_platform}"
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
#
|
156
|
-
# Static PostgreSQL build tasks
|
157
|
-
#
|
158
|
-
directory static_postgresql_builddir.to_s
|
159
|
-
|
160
|
-
|
161
|
-
# postgresql source file should be stored there
|
162
|
-
file postgresql_tarball => static_sourcesdir do |t|
|
163
|
-
download( postgresql_source_uri, t.name )
|
164
|
-
end
|
165
|
-
|
166
|
-
# Extract the postgresql sources
|
167
|
-
file static_postgresql_builddir => postgresql_tarball do |t|
|
168
|
-
puts "extracting %s to %s" % [ postgresql_tarball, static_postgresql_builddir.parent ]
|
169
|
-
static_postgresql_builddir.mkpath
|
170
|
-
run 'tar', '-xjf', postgresql_tarball.to_s, '-C', static_postgresql_builddir.parent.to_s
|
171
|
-
|
172
|
-
postgresql_patches.each do |patchfile|
|
173
|
-
puts " applying patch #{patchfile}..."
|
174
|
-
run 'patch', '-Np1', '-d', static_postgresql_builddir.to_s,
|
175
|
-
'-i', File.expand_path( patchfile, BASEDIR )
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
# generate the makefile in a clean build location
|
180
|
-
file postgresql_global_makefile => [ static_postgresql_builddir, "openssl_libs:#{for_platform}" ] do |t|
|
181
|
-
options = [
|
182
|
-
"--target=#{host_platform}",
|
183
|
-
"--host=#{host_platform}",
|
184
|
-
'--with-openssl',
|
185
|
-
'--without-zlib',
|
186
|
-
'--without-icu',
|
187
|
-
]
|
188
|
-
|
189
|
-
chdir( static_postgresql_builddir ) do
|
190
|
-
configure_path = static_postgresql_builddir + 'configure'
|
191
|
-
cmd = [ configure_path.to_s, *options ]
|
192
|
-
cmd << "CFLAGS=-L#{static_openssl_builddir}"
|
193
|
-
cmd << "LDFLAGS=-L#{static_openssl_builddir}"
|
194
|
-
cmd << "LDFLAGS_SL=-L#{static_openssl_builddir}"
|
195
|
-
cmd << "LIBS=-lwsock32 -lgdi32 -lws2_32 -lcrypt32"
|
196
|
-
cmd << "CPPFLAGS=-I#{static_openssl_builddir}/include"
|
197
|
-
|
198
|
-
run( *cmd )
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
|
203
|
-
# make libpq.dll
|
204
|
-
task postgresql_lib => [ postgresql_global_makefile ] do |t|
|
205
|
-
# Work around missing dependency to libcommon in PostgreSQL-9.4.0
|
206
|
-
chdir( static_postgresql_srcdir + "common" ) do
|
207
|
-
sh 'make', "-j#{NUM_CPUS}"
|
208
|
-
end
|
209
|
-
chdir( static_postgresql_srcdir + "port" ) do
|
210
|
-
sh 'make', "-j#{NUM_CPUS}"
|
211
|
-
end
|
212
|
-
|
213
|
-
chdir( postgresql_lib.dirname ) do
|
214
|
-
sh 'make',
|
215
|
-
"-j#{NUM_CPUS}",
|
216
|
-
postgresql_lib.basename.to_s,
|
217
|
-
'SHLIB_LINK=-lssl -lcrypto -lcrypt32 -lgdi32 -lsecur32 -lwsock32 -lws2_32'
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
|
222
|
-
#desc 'compile libpg.a'
|
223
|
-
task "native:#{for_platform}" => postgresql_lib
|
224
|
-
|
225
|
-
# copy libpq.dll to lib dir
|
226
|
-
dest_libpq = "lib/#{for_platform}/#{postgresql_lib.basename}"
|
227
|
-
directory File.dirname(dest_libpq)
|
228
|
-
file dest_libpq => [postgresql_lib, File.dirname(dest_libpq)] do
|
229
|
-
cp postgresql_lib, dest_libpq
|
230
|
-
end
|
231
|
-
|
232
|
-
stage_libpq = "tmp/#{for_platform}/stage/#{dest_libpq}"
|
233
|
-
directory File.dirname(stage_libpq)
|
234
|
-
file stage_libpq => [postgresql_lib, File.dirname(stage_libpq)] do |t|
|
235
|
-
cp postgresql_lib, stage_libpq
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
def download(url, save_to)
|
240
|
-
part = save_to+".part"
|
241
|
-
sh "wget #{url.to_s.inspect} -O #{part.inspect} || curl #{url.to_s.inspect} -o #{part.inspect}"
|
242
|
-
FileUtils.mv part, save_to
|
243
|
-
end
|
244
|
-
|
245
|
-
def run(*args)
|
246
|
-
sh(*args)
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
CrossLibraries = [
|
251
|
-
['x64-mingw-ucrt', 'mingw64', 'x86_64-w64-mingw32'],
|
252
|
-
['x86-mingw32', 'mingw', 'i686-w64-mingw32'],
|
253
|
-
['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
|
254
|
-
].map do |platform, openssl_config, toolchain|
|
255
|
-
CrossLibrary.new platform, openssl_config, toolchain
|
256
|
-
end
|
257
|
-
|
258
|
-
desc 'cross compile pg for win32'
|
259
|
-
task :cross => [ :mingw32 ]
|
260
|
-
|
261
|
-
task :mingw32 do
|
262
|
-
# Use Rake::ExtensionCompiler helpers to find the proper host
|
263
|
-
unless Rake::ExtensionCompiler.mingw_host then
|
264
|
-
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
265
|
-
warn "Please refer to your distribution/package manager documentation about installation."
|
266
|
-
fail
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
task 'gem:windows:prepare' do
|
271
|
-
require 'io/console'
|
272
|
-
require 'rake_compiler_dock'
|
273
|
-
|
274
|
-
# Copy gem signing key and certs to be accessible from the docker container
|
275
|
-
mkdir_p 'build/gem'
|
276
|
-
sh "cp ~/.gem/gem-*.pem build/gem/ || true"
|
277
|
-
sh "bundle package"
|
278
|
-
begin
|
279
|
-
OpenSSL::PKey.read(File.read(File.expand_path("~/.gem/gem-private_key.pem")), ENV["GEM_PRIVATE_KEY_PASSPHRASE"] || "")
|
280
|
-
rescue OpenSSL::PKey::PKeyError
|
281
|
-
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
|
282
|
-
retry
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
CrossLibraries.each do |xlib|
|
287
|
-
platform = xlib.for_platform
|
288
|
-
desc "Build fat binary gem for platform #{platform}"
|
289
|
-
task "gem:windows:#{platform}" => ['gem:windows:prepare', xlib.openssl_tarball, xlib.postgresql_tarball] do
|
290
|
-
RakeCompilerDock.sh <<-EOT, platform: platform
|
291
|
-
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
292
|
-
bundle install --local &&
|
293
|
-
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=3.3.0:3.2.0:3.1.0:3.0.0:2.7.0:2.6.0:2.5.0
|
294
|
-
EOT
|
295
|
-
end
|
296
|
-
desc "Build the windows binary gems"
|
297
|
-
multitask 'gem:windows' => "gem:windows:#{platform}"
|
298
|
-
end
|