pg 1.5.9-x64-mingw32 → 1.6.3-x64-mingw32
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/{History.md → CHANGELOG.md} +80 -0
- data/Gemfile +10 -7
- data/README-Windows.rdoc +1 -1
- data/README.ja.md +4 -4
- data/README.md +66 -23
- data/Rakefile +78 -14
- data/ext/errorcodes.def +9 -0
- data/ext/errorcodes.rb +1 -1
- data/ext/errorcodes.txt +8 -1
- data/ext/extconf.rb +189 -15
- data/ext/gvl_wrappers.c +13 -2
- data/ext/gvl_wrappers.h +33 -0
- data/ext/pg.c +16 -5
- data/ext/pg.h +15 -13
- data/ext/pg_binary_decoder.c +151 -1
- data/ext/pg_binary_encoder.c +212 -9
- data/ext/pg_cancel_connection.c +360 -0
- data/ext/pg_coder.c +54 -5
- data/ext/pg_connection.c +390 -160
- data/ext/pg_copy_coder.c +2 -2
- data/ext/pg_record_coder.c +1 -1
- data/ext/pg_result.c +104 -52
- data/ext/pg_text_decoder.c +1 -1
- data/ext/pg_text_encoder.c +22 -9
- data/ext/pg_tuple.c +8 -8
- data/ext/pg_type_map.c +4 -2
- 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 +2 -1
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +3 -1
- data/ext/pg_type_map_in_ruby.c +1 -1
- data/ext/pg_util.c +2 -2
- data/ext/pg_util.h +2 -2
- data/lib/3.0/pg_ext.so +0 -0
- data/lib/pg/basic_type_map_for_queries.rb +7 -3
- data/lib/pg/basic_type_registry.rb +2 -2
- data/lib/pg/cancel_connection.rb +53 -0
- data/lib/pg/coder.rb +4 -2
- data/lib/pg/connection.rb +254 -131
- data/lib/pg/version.rb +2 -1
- data/lib/pg.rb +156 -130
- data/misc/glibc/Dockerfile +20 -0
- data/misc/glibc/docker-compose.yml +9 -0
- data/misc/glibc/glibc_spec.rb +5 -0
- data/misc/yugabyte/Dockerfile +9 -0
- data/misc/yugabyte/docker-compose.yml +28 -0
- data/misc/yugabyte/pg-test.rb +45 -0
- data/pg.gemspec +5 -3
- data/ports/patches/krb5/1.22.1/0001-Allow-static-linking-krb5-library.patch +30 -0
- data/ports/patches/krb5/1.22.1/0002-unknown-command-line-option-on-clang.patch +12 -0
- data/ports/patches/openssl/3.5.2/0001-aarch64-mingw.patch +21 -0
- data/ports/patches/postgresql/18.1/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch +42 -0
- data/ports/patches/postgresql/18.1/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch +52 -0
- data/{lib/x64-mingw32 → ports/x64-mingw32/lib}/libpq.dll +0 -0
- data/rakelib/pg_gem_helper.rb +64 -0
- data.tar.gz.sig +0 -0
- metadata +37 -29
- metadata.gz.sig +0 -0
- data/Manifest.txt +0 -72
- data/Rakefile.cross +0 -303
- data/lib/2.5/pg_ext.so +0 -0
- data/lib/2.6/pg_ext.so +0 -0
- data/lib/2.7/pg_ext.so +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'bundler'
|
|
2
|
+
require 'bundler/gem_helper'
|
|
3
|
+
|
|
4
|
+
class PgGemHelper < Bundler::GemHelper
|
|
5
|
+
attr_accessor :cross_platforms
|
|
6
|
+
|
|
7
|
+
def install
|
|
8
|
+
super
|
|
9
|
+
|
|
10
|
+
task "release:guard_clean" => ["release:update_history"]
|
|
11
|
+
|
|
12
|
+
task "release:update_history" do
|
|
13
|
+
update_history
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
task "release:rubygem_push" => ["gem:native"]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def hfile
|
|
20
|
+
"CHANGELOG.md"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def headline
|
|
24
|
+
'^([^\n]*)(\d+\.\d+\.\d+(?:\.\w+)?)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def reldate
|
|
28
|
+
Time.now.strftime("%Y-%m-%d")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def update_history
|
|
32
|
+
hin = File.read(hfile)
|
|
33
|
+
hout = hin.sub(/#{headline}/) do
|
|
34
|
+
raise "#{hfile} isn't up-to-date for version #{version} (!= #{$2})" unless $2==version.to_s
|
|
35
|
+
$1 + $2 + $3 + reldate + $5
|
|
36
|
+
end
|
|
37
|
+
if hout != hin
|
|
38
|
+
Bundler.ui.confirm "Updating #{hfile} for release."
|
|
39
|
+
File.write(hfile, hout)
|
|
40
|
+
Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def tag_version
|
|
45
|
+
Bundler.ui.confirm "Tag release with annotation:"
|
|
46
|
+
m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
|
|
47
|
+
Bundler.ui.info(m[:annotation].gsub(/^/, " "))
|
|
48
|
+
IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd|
|
|
49
|
+
fd.write m[:annotation]
|
|
50
|
+
end
|
|
51
|
+
yield if block_given?
|
|
52
|
+
rescue
|
|
53
|
+
Bundler.ui.error "Untagging #{version_tag} due to error."
|
|
54
|
+
Rake::FileUtilsExt.sh "git", "tag", "-d", version_tag
|
|
55
|
+
raise
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def rubygem_push(path)
|
|
59
|
+
cross_platforms.each do |ruby_platform|
|
|
60
|
+
super(path.gsub(/\.gem\z/, "-#{ruby_platform}.gem"))
|
|
61
|
+
end
|
|
62
|
+
super(path)
|
|
63
|
+
end
|
|
64
|
+
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.3
|
|
5
5
|
platform: x64-mingw32
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Granger
|
|
8
8
|
- Lars Kanis
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain:
|
|
12
11
|
- |
|
|
13
12
|
-----BEGIN CERTIFICATE-----
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
MIIEBDCCAmygAwIBAgIBBDANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
|
|
14
|
+
L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNTEyMjkyMDMyMzFaFw0yNjEy
|
|
15
|
+
MjkyMDMyMzFaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
|
|
17
16
|
PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
|
|
18
17
|
mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
|
|
19
18
|
eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
|
|
@@ -24,28 +23,28 @@ cert_chain:
|
|
|
24
23
|
chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
|
|
25
24
|
9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
|
|
26
25
|
A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEAUVIier9xybHmXNsj801xD+Q7Jz7wpRsf
|
|
27
|
+
fMHpV2sAzvYcAa7pn+mbu9nf7RUhe5hiaUv88Usk9nRUYYrjBOO5RuD+wYNowpcE
|
|
28
|
+
kxUiTAP/fgUBdW6hYUJy57CH3xUD6tj1Cg9hxdKy7jItZXbfhX+qPq2BwGaXz7gn
|
|
29
|
+
nhrALITRmpuPnlsccM94dgSArCInSo2SEc12h2oB6FAnFG1Lre3dmQamI5q1EKp0
|
|
30
|
+
Yafb2+cPbFcVYUdE50wf+cdeGDOsCGlAmo2OGqXWxTP2hIfyhsFoamD6UGufLoPG
|
|
31
|
+
Dh6tAEZIuEvLjq93qoNceUQn+xxiiIszjY5mkTu9rVY+/gh5PJzu9IHvyIqBpb2o
|
|
32
|
+
fdWDISWK+KSLCrqkFtKoliLDTZau73GcYCVOkjca+3cxqABKZ+M8r42Sq8JPxPiv
|
|
33
|
+
KyLQBzqPeLN9qRDD1bEFHIcgwdY/zQTs4mWRBSmBWa7w+k8nP8aSV1dN/fvhYwY3
|
|
34
|
+
HCQwtPaMYOznIOcc8shL4zLJpcl8uCqE
|
|
36
35
|
-----END CERTIFICATE-----
|
|
37
|
-
date:
|
|
36
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
38
37
|
dependencies: []
|
|
39
38
|
description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
|
|
40
|
-
|
|
39
|
+
10 and later.
|
|
41
40
|
email:
|
|
42
41
|
- ged@FaerieMUD.org
|
|
43
42
|
- lars@greiz-reinsdorf.de
|
|
44
43
|
executables: []
|
|
45
44
|
extensions: []
|
|
46
45
|
extra_rdoc_files:
|
|
46
|
+
- CHANGELOG.md
|
|
47
47
|
- Contributors.rdoc
|
|
48
|
-
- History.md
|
|
49
48
|
- README-OS_X.rdoc
|
|
50
49
|
- README-Windows.rdoc
|
|
51
50
|
- README.ja.md
|
|
@@ -56,6 +55,7 @@ extra_rdoc_files:
|
|
|
56
55
|
- ext/pg.h
|
|
57
56
|
- ext/pg_binary_decoder.c
|
|
58
57
|
- ext/pg_binary_encoder.c
|
|
58
|
+
- ext/pg_cancel_connection.c
|
|
59
59
|
- ext/pg_coder.c
|
|
60
60
|
- ext/pg_connection.c
|
|
61
61
|
- ext/pg_copy_coder.c
|
|
@@ -82,6 +82,7 @@ extra_rdoc_files:
|
|
|
82
82
|
- lib/pg/binary_decoder/date.rb
|
|
83
83
|
- lib/pg/binary_decoder/timestamp.rb
|
|
84
84
|
- lib/pg/binary_encoder/timestamp.rb
|
|
85
|
+
- lib/pg/cancel_connection.rb
|
|
85
86
|
- lib/pg/coder.rb
|
|
86
87
|
- lib/pg/connection.rb
|
|
87
88
|
- lib/pg/exceptions.rb
|
|
@@ -101,18 +102,16 @@ extra_rdoc_files:
|
|
|
101
102
|
- lib/pg/version.rb
|
|
102
103
|
files:
|
|
103
104
|
- BSDL
|
|
105
|
+
- CHANGELOG.md
|
|
104
106
|
- Contributors.rdoc
|
|
105
107
|
- Gemfile
|
|
106
|
-
- History.md
|
|
107
108
|
- LICENSE
|
|
108
|
-
- Manifest.txt
|
|
109
109
|
- POSTGRES
|
|
110
110
|
- README-OS_X.rdoc
|
|
111
111
|
- README-Windows.rdoc
|
|
112
112
|
- README.ja.md
|
|
113
113
|
- README.md
|
|
114
114
|
- Rakefile
|
|
115
|
-
- Rakefile.cross
|
|
116
115
|
- certs/ged.pem
|
|
117
116
|
- certs/kanis@comcard.de.pem
|
|
118
117
|
- certs/larskanis-2022.pem
|
|
@@ -128,6 +127,7 @@ files:
|
|
|
128
127
|
- ext/pg.h
|
|
129
128
|
- ext/pg_binary_decoder.c
|
|
130
129
|
- ext/pg_binary_encoder.c
|
|
130
|
+
- ext/pg_cancel_connection.c
|
|
131
131
|
- ext/pg_coder.c
|
|
132
132
|
- ext/pg_connection.c
|
|
133
133
|
- ext/pg_copy_coder.c
|
|
@@ -149,9 +149,6 @@ files:
|
|
|
149
149
|
- ext/vc/pg.sln
|
|
150
150
|
- ext/vc/pg_18/pg.vcproj
|
|
151
151
|
- ext/vc/pg_19/pg_19.vcproj
|
|
152
|
-
- lib/2.5/pg_ext.so
|
|
153
|
-
- lib/2.6/pg_ext.so
|
|
154
|
-
- lib/2.7/pg_ext.so
|
|
155
152
|
- lib/3.0/pg_ext.so
|
|
156
153
|
- lib/pg.rb
|
|
157
154
|
- lib/pg/basic_type_map_based_on_result.rb
|
|
@@ -161,6 +158,7 @@ files:
|
|
|
161
158
|
- lib/pg/binary_decoder/date.rb
|
|
162
159
|
- lib/pg/binary_decoder/timestamp.rb
|
|
163
160
|
- lib/pg/binary_encoder/timestamp.rb
|
|
161
|
+
- lib/pg/cancel_connection.rb
|
|
164
162
|
- lib/pg/coder.rb
|
|
165
163
|
- lib/pg/connection.rb
|
|
166
164
|
- lib/pg/exceptions.rb
|
|
@@ -178,7 +176,9 @@ files:
|
|
|
178
176
|
- lib/pg/tuple.rb
|
|
179
177
|
- lib/pg/type_map_by_column.rb
|
|
180
178
|
- lib/pg/version.rb
|
|
181
|
-
-
|
|
179
|
+
- misc/glibc/Dockerfile
|
|
180
|
+
- misc/glibc/docker-compose.yml
|
|
181
|
+
- misc/glibc/glibc_spec.rb
|
|
182
182
|
- misc/openssl-pg-segfault.rb
|
|
183
183
|
- misc/postgres/History.txt
|
|
184
184
|
- misc/postgres/Manifest.txt
|
|
@@ -190,7 +190,17 @@ files:
|
|
|
190
190
|
- misc/ruby-pg/README.txt
|
|
191
191
|
- misc/ruby-pg/Rakefile
|
|
192
192
|
- misc/ruby-pg/lib/ruby/pg.rb
|
|
193
|
+
- misc/yugabyte/Dockerfile
|
|
194
|
+
- misc/yugabyte/docker-compose.yml
|
|
195
|
+
- misc/yugabyte/pg-test.rb
|
|
193
196
|
- pg.gemspec
|
|
197
|
+
- ports/patches/krb5/1.22.1/0001-Allow-static-linking-krb5-library.patch
|
|
198
|
+
- ports/patches/krb5/1.22.1/0002-unknown-command-line-option-on-clang.patch
|
|
199
|
+
- ports/patches/openssl/3.5.2/0001-aarch64-mingw.patch
|
|
200
|
+
- ports/patches/postgresql/18.1/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch
|
|
201
|
+
- ports/patches/postgresql/18.1/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch
|
|
202
|
+
- ports/x64-mingw32/lib/libpq.dll
|
|
203
|
+
- rakelib/pg_gem_helper.rb
|
|
194
204
|
- rakelib/task_extension.rb
|
|
195
205
|
- sample/array_insert.rb
|
|
196
206
|
- sample/async_api.rb
|
|
@@ -217,9 +227,8 @@ licenses:
|
|
|
217
227
|
metadata:
|
|
218
228
|
homepage_uri: https://github.com/ged/ruby-pg
|
|
219
229
|
source_code_uri: https://github.com/ged/ruby-pg
|
|
220
|
-
changelog_uri: https://github.com/ged/ruby-pg/blob/master/
|
|
230
|
+
changelog_uri: https://github.com/ged/ruby-pg/blob/master/CHANGELOG.md
|
|
221
231
|
documentation_uri: http://deveiate.org/code/pg
|
|
222
|
-
post_install_message:
|
|
223
232
|
rdoc_options:
|
|
224
233
|
- "--main"
|
|
225
234
|
- README.md
|
|
@@ -231,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
231
240
|
requirements:
|
|
232
241
|
- - ">="
|
|
233
242
|
- !ruby/object:Gem::Version
|
|
234
|
-
version: '
|
|
243
|
+
version: '3.0'
|
|
235
244
|
- - "<"
|
|
236
245
|
- !ruby/object:Gem::Version
|
|
237
246
|
version: 3.1.dev
|
|
@@ -241,8 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
241
250
|
- !ruby/object:Gem::Version
|
|
242
251
|
version: '0'
|
|
243
252
|
requirements: []
|
|
244
|
-
rubygems_version:
|
|
245
|
-
signing_key:
|
|
253
|
+
rubygems_version: 4.0.3
|
|
246
254
|
specification_version: 4
|
|
247
255
|
summary: Pg is the Ruby interface to the PostgreSQL RDBMS
|
|
248
256
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/Manifest.txt
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
.gemtest
|
|
2
|
-
BSDL
|
|
3
|
-
Contributors.rdoc
|
|
4
|
-
History.rdoc
|
|
5
|
-
LICENSE
|
|
6
|
-
Manifest.txt
|
|
7
|
-
POSTGRES
|
|
8
|
-
README-OS_X.rdoc
|
|
9
|
-
README-Windows.rdoc
|
|
10
|
-
README.ja.rdoc
|
|
11
|
-
README.rdoc
|
|
12
|
-
Rakefile
|
|
13
|
-
Rakefile.cross
|
|
14
|
-
ext/errorcodes.def
|
|
15
|
-
ext/errorcodes.rb
|
|
16
|
-
ext/errorcodes.txt
|
|
17
|
-
ext/extconf.rb
|
|
18
|
-
ext/gvl_wrappers.c
|
|
19
|
-
ext/gvl_wrappers.h
|
|
20
|
-
ext/pg.c
|
|
21
|
-
ext/pg.h
|
|
22
|
-
ext/pg_binary_decoder.c
|
|
23
|
-
ext/pg_binary_encoder.c
|
|
24
|
-
ext/pg_coder.c
|
|
25
|
-
ext/pg_connection.c
|
|
26
|
-
ext/pg_copy_coder.c
|
|
27
|
-
ext/pg_errors.c
|
|
28
|
-
ext/pg_record_coder.c
|
|
29
|
-
ext/pg_result.c
|
|
30
|
-
ext/pg_text_decoder.c
|
|
31
|
-
ext/pg_text_encoder.c
|
|
32
|
-
ext/pg_tuple.c
|
|
33
|
-
ext/pg_type_map.c
|
|
34
|
-
ext/pg_type_map_all_strings.c
|
|
35
|
-
ext/pg_type_map_by_class.c
|
|
36
|
-
ext/pg_type_map_by_column.c
|
|
37
|
-
ext/pg_type_map_by_mri_type.c
|
|
38
|
-
ext/pg_type_map_by_oid.c
|
|
39
|
-
ext/pg_type_map_in_ruby.c
|
|
40
|
-
ext/pg_util.c
|
|
41
|
-
ext/pg_util.h
|
|
42
|
-
ext/vc/pg.sln
|
|
43
|
-
ext/vc/pg_18/pg.vcproj
|
|
44
|
-
ext/vc/pg_19/pg_19.vcproj
|
|
45
|
-
lib/pg.rb
|
|
46
|
-
lib/pg/basic_type_mapping.rb
|
|
47
|
-
lib/pg/binary_decoder.rb
|
|
48
|
-
lib/pg/coder.rb
|
|
49
|
-
lib/pg/connection.rb
|
|
50
|
-
lib/pg/constants.rb
|
|
51
|
-
lib/pg/exceptions.rb
|
|
52
|
-
lib/pg/result.rb
|
|
53
|
-
lib/pg/text_decoder.rb
|
|
54
|
-
lib/pg/text_encoder.rb
|
|
55
|
-
lib/pg/tuple.rb
|
|
56
|
-
lib/pg/type_map_by_column.rb
|
|
57
|
-
spec/data/expected_trace.out
|
|
58
|
-
spec/data/random_binary_data
|
|
59
|
-
spec/helpers.rb
|
|
60
|
-
spec/pg/basic_type_mapping_spec.rb
|
|
61
|
-
spec/pg/connection_spec.rb
|
|
62
|
-
spec/pg/connection_sync_spec.rb
|
|
63
|
-
spec/pg/result_spec.rb
|
|
64
|
-
spec/pg/tuple_spec.rb
|
|
65
|
-
spec/pg/type_map_by_class_spec.rb
|
|
66
|
-
spec/pg/type_map_by_column_spec.rb
|
|
67
|
-
spec/pg/type_map_by_mri_type_spec.rb
|
|
68
|
-
spec/pg/type_map_by_oid_spec.rb
|
|
69
|
-
spec/pg/type_map_in_ruby_spec.rb
|
|
70
|
-
spec/pg/type_map_spec.rb
|
|
71
|
-
spec/pg/type_spec.rb
|
|
72
|
-
spec/pg_spec.rb
|
data/Rakefile.cross
DELETED
|
@@ -1,303 +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.4.0'
|
|
35
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '17.0'
|
|
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 -DOPENSSL_THREADS",
|
|
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" << "threads" << "-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=-lssl -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
|
-
# Work around missing dependency to errorcodes.h in PostgreSQL-17.0
|
|
210
|
-
chdir( static_postgresql_srcdir + "backend" + "utils" ) do
|
|
211
|
-
sh 'make', "-j#{NUM_CPUS}"
|
|
212
|
-
end
|
|
213
|
-
chdir( static_postgresql_srcdir + "port" ) do
|
|
214
|
-
sh 'make', "-j#{NUM_CPUS}"
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
chdir( postgresql_lib.dirname ) do
|
|
218
|
-
sh 'make',
|
|
219
|
-
"-j#{NUM_CPUS}",
|
|
220
|
-
postgresql_lib.basename.to_s,
|
|
221
|
-
'SHLIB_LINK=-lssl -lcrypto -lcrypt32 -lgdi32 -lsecur32 -lwsock32 -lws2_32'
|
|
222
|
-
end
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
#desc 'compile libpg.a'
|
|
227
|
-
task "native:#{for_platform}" => postgresql_lib
|
|
228
|
-
|
|
229
|
-
# copy libpq.dll to lib dir
|
|
230
|
-
dest_libpq = "lib/#{for_platform}/#{postgresql_lib.basename}"
|
|
231
|
-
directory File.dirname(dest_libpq)
|
|
232
|
-
file dest_libpq => [postgresql_lib, File.dirname(dest_libpq)] do
|
|
233
|
-
cp postgresql_lib, dest_libpq
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
stage_libpq = "tmp/#{for_platform}/stage/#{dest_libpq}"
|
|
237
|
-
directory File.dirname(stage_libpq)
|
|
238
|
-
file stage_libpq => [postgresql_lib, File.dirname(stage_libpq)] do |t|
|
|
239
|
-
cp postgresql_lib, stage_libpq
|
|
240
|
-
end
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
def download(url, save_to)
|
|
244
|
-
part = save_to+".part"
|
|
245
|
-
sh "wget #{url.to_s.inspect} -O #{part.inspect} || curl #{url.to_s.inspect} -o #{part.inspect}"
|
|
246
|
-
FileUtils.mv part, save_to
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
def run(*args)
|
|
250
|
-
sh(*args)
|
|
251
|
-
end
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
CrossLibraries = [
|
|
255
|
-
['x64-mingw-ucrt', 'mingw64', 'x86_64-w64-mingw32'],
|
|
256
|
-
['x86-mingw32', 'mingw', 'i686-w64-mingw32'],
|
|
257
|
-
['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
|
|
258
|
-
].map do |platform, openssl_config, toolchain|
|
|
259
|
-
CrossLibrary.new platform, openssl_config, toolchain
|
|
260
|
-
end
|
|
261
|
-
|
|
262
|
-
desc 'cross compile pg for win32'
|
|
263
|
-
task :cross => [ :mingw32 ]
|
|
264
|
-
|
|
265
|
-
task :mingw32 do
|
|
266
|
-
# Use Rake::ExtensionCompiler helpers to find the proper host
|
|
267
|
-
unless Rake::ExtensionCompiler.mingw_host then
|
|
268
|
-
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
|
269
|
-
warn "Please refer to your distribution/package manager documentation about installation."
|
|
270
|
-
fail
|
|
271
|
-
end
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
task 'gem:windows:prepare' do
|
|
275
|
-
require 'io/console'
|
|
276
|
-
require 'rake_compiler_dock'
|
|
277
|
-
|
|
278
|
-
# Copy gem signing key and certs to be accessible from the docker container
|
|
279
|
-
mkdir_p 'build/gem'
|
|
280
|
-
sh "cp ~/.gem/gem-*.pem build/gem/ || true"
|
|
281
|
-
sh "bundle package"
|
|
282
|
-
begin
|
|
283
|
-
OpenSSL::PKey.read(File.read(File.expand_path("~/.gem/gem-private_key.pem")), ENV["GEM_PRIVATE_KEY_PASSPHRASE"] || "")
|
|
284
|
-
rescue OpenSSL::PKey::PKeyError
|
|
285
|
-
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
|
|
286
|
-
retry
|
|
287
|
-
end
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
CrossLibraries.each do |xlib|
|
|
291
|
-
platform = xlib.for_platform
|
|
292
|
-
desc "Build fat binary gem for platform #{platform}"
|
|
293
|
-
task "gem:windows:#{platform}" => ['gem:windows:prepare', xlib.openssl_tarball, xlib.postgresql_tarball] do
|
|
294
|
-
RakeCompilerDock.sh <<-EOT, platform: platform
|
|
295
|
-
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
|
296
|
-
sudo apt-get update && sudo apt-get install -y bison flex &&
|
|
297
|
-
bundle install --local &&
|
|
298
|
-
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
|
|
299
|
-
EOT
|
|
300
|
-
end
|
|
301
|
-
desc "Build the windows binary gems"
|
|
302
|
-
multitask 'gem:windows' => "gem:windows:#{platform}"
|
|
303
|
-
end
|
data/lib/2.5/pg_ext.so
DELETED
|
Binary file
|
data/lib/2.6/pg_ext.so
DELETED
|
Binary file
|
data/lib/2.7/pg_ext.so
DELETED
|
Binary file
|