pg 0.11.0 → 0.12.0pre258
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/.gemtest +0 -0
- data/Contributors.rdoc +37 -0
- data/History.rdoc +60 -0
- data/Manifest.txt +39 -0
- data/README.OS_X.rdoc +68 -0
- data/README.ja.rdoc +7 -0
- data/{README → README.rdoc} +33 -18
- data/{README.windows → README.windows.rdoc} +20 -26
- data/Rakefile +98 -324
- data/ext/extconf.rb +7 -2
- data/ext/pg.c +173 -35
- data/ext/vc/pg.sln +26 -0
- data/ext/vc/pg_18/pg.vcproj +216 -0
- data/ext/vc/pg_19/pg_19.vcproj +209 -0
- data/lib/pg.rb +5 -7
- data/misc/openssl-pg-segfault.rb +31 -0
- data/sample/async_api.rb +109 -0
- data/sample/copyfrom.rb +81 -0
- data/sample/copyto.rb +23 -0
- data/sample/losample.rb +69 -0
- data/sample/notify_wait.rb +43 -0
- data/sample/psql.rb +1181 -0
- data/sample/psqlHelp.rb +158 -0
- data/sample/test1.rb +60 -0
- data/sample/test2.rb +44 -0
- data/sample/test4.rb +71 -0
- data/sample/test_binary_values.rb +35 -0
- data/spec/m17n_spec.rb +1 -1
- data/spec/pgconn_spec.rb +50 -5
- data/spec/pgresult_spec.rb +1 -1
- metadata +142 -66
- data.tar.gz.sig +0 -2
- data/ChangeLog +0 -693
- data/Contributors +0 -32
- data/README.OS_X +0 -19
- data/README.ja +0 -183
- data/Rakefile.local +0 -312
- data/rake/191_compat.rb +0 -26
- data/rake/dependencies.rb +0 -76
- data/rake/documentation.rb +0 -123
- data/rake/helpers.rb +0 -502
- data/rake/hg.rb +0 -318
- data/rake/manual.rb +0 -787
- data/rake/packaging.rb +0 -129
- data/rake/publishing.rb +0 -341
- data/rake/style.rb +0 -62
- data/rake/svn.rb +0 -668
- data/rake/testing.rb +0 -152
- data/rake/verifytask.rb +0 -64
- metadata.gz.sig +0 -0
data/Contributors
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
Dennis Vshivkov <walrus@amur.ru>
|
2
|
-
Gabriel Emerson <gemerson@evalsoft.com>
|
3
|
-
Noboru Saitou <noborus@netlab.jp>
|
4
|
-
Akinori MUSHA <knu@iDaemons.org>
|
5
|
-
Andy Yu <is@gnuchina.org>
|
6
|
-
Ceri Storey <cez@compsoc.man.ac.uk>
|
7
|
-
Gavin Kistner <gavin@refinery.com>
|
8
|
-
Henry T. So Jr. <henryso@panix.com>
|
9
|
-
Jeremy Henty <jeremy@chaos.org.uk>
|
10
|
-
<kasa@air.linkclub.or.jp>
|
11
|
-
Leon Brooks <leon-ruby-postgres@cyberknights.com.au>
|
12
|
-
Martin Hedenfalk <mahe@kth.se>
|
13
|
-
<matz@zetabits.com>
|
14
|
-
MoonWolf <moonwolf@moonwolf.com>
|
15
|
-
<m_seki@mva.biglobe.ne.jp>
|
16
|
-
Nate Haggard <nate@wordplace.com>
|
17
|
-
Neil Conway <nconway@klamath.dyndns.org>
|
18
|
-
Noboru Matui <silicon@mx1.freemail.ne.jp>
|
19
|
-
Okada Jun <yun@be-in.org>
|
20
|
-
Shirai,Kaoru <shirai@p1jp.com>
|
21
|
-
Riley <wormwood@speakeasy.org>
|
22
|
-
shibata <kshibata@vesta.ocn.ne.jp>
|
23
|
-
<greentea@fa2.so-net.ne.jp>
|
24
|
-
ts <decoux@moulon.inra.fr>
|
25
|
-
Yuta TSUBOI <yuuta-t@is.aist-nara.ac.jp>
|
26
|
-
Lugovoi Nikolai <meadow.nnick@gmail.com>
|
27
|
-
Jeff Davis <ruby@j-davis.com>
|
28
|
-
Bertram Scharpf <software@bertram-scharpf.de>
|
29
|
-
Michael Granger <ged@FaerieMUD.org>
|
30
|
-
Mahlon E. Smith <mahlon@martini.nu>
|
31
|
-
Jason Yanowitz <me-bitbucket@jasonyanowitz.com>
|
32
|
-
|
data/README.OS_X
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= Compiling on MacOS X
|
2
|
-
|
3
|
-
If you are building/installing ruby-pg on MacOS X, and the installation doesn't work at first, here are a few things you can try.
|
4
|
-
|
5
|
-
== Compiling With the Correct Architecture
|
6
|
-
|
7
|
-
OS X supports both architecture-specific binaries (e.g. i386), as well as universal binaries (i.e. i386 & ppc). If ruby is built as a universal binary and postgresql is not, you need to specify the path to the appropriate pg_config binary or set the environment variable ARCHFLAGS appropriately.
|
8
|
-
|
9
|
-
For example, if you're using the stock Ruby binary, and PostgreSQL 8.4.x installed from MacPorts (without specifying the {{{+universal}}} variant), do:
|
10
|
-
|
11
|
-
gem install -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
12
|
-
|
13
|
-
Alternatively, if the build system can't figure out which architectures it should include, you may need to set the 'ARCHFLAGS' environment variable explicitly:
|
14
|
-
|
15
|
-
sudo env ARCHFLAGS='-arch i386' gem install pg
|
16
|
-
|
17
|
-
or, if you're building from source:
|
18
|
-
|
19
|
-
rake compile ARCHFLAGS="-arch i386"
|
data/README.ja
DELETED
@@ -1,183 +0,0 @@
|
|
1
|
-
PostgreSQL$BMQ3HD%%i%$%V%i%j(B version 0.7.1
|
2
|
-
|
3
|
-
$B$^$D$b$H(B $B$f$-$R$m(B
|
4
|
-
$B$^$D$b$H(B $B$($$$8(B
|
5
|
-
|
6
|
-
$B@$OC?M(B: $B@FF#(B $BEP(B
|
7
|
-
|
8
|
-
- What's this ?
|
9
|
-
|
10
|
-
$BK\%i%$%V%i%j$O!"(BRuby$B$+$i(BPostgreSQL$B$X%"%/%;%9$9$k$?$a$N3HD%%i%$%V%i%j$G$9!#(B
|
11
|
-
$B%5%]!<%H$7$F$$$k(BPostgreSQL$B$N%P!<%8%g%s$O!"(B6.5/7.0/7.1/7.2 $B$G$9!#(B6.3$B0JA0$N(B
|
12
|
-
$B%P!<%8%g%s$G$b(B($B$A$g$C$H$7$?JQ99$G(B)$BF0:n$9$k$H;W$$$^$9$,!"%F%9%H$7$F$$$^$;$s!#(B
|
13
|
-
|
14
|
-
- How to install ?
|
15
|
-
*** requirement ***
|
16
|
-
PostgreSQL module$B$r;H$&$s$G$9$+$i!$EvA3(BPostgreSQL$B$OI,MW$G$9$M!%:#$N$H$3$m(B
|
17
|
-
$B%m!<%+%k$K(BPostgreSQL$B$,%$%s%9%H!<%k$5$l$F$$$k$3$H$rA0Ds$K$7$F$$$^$9$,!$(B
|
18
|
-
$BI,MW$J%X%C%@$H(Blibpq$B$5$($"$l$P!$%5!<%P$OI,$:$7$b%m!<%+%k$GF0:n$7$F$$$kI,MW(B
|
19
|
-
$B$O$"$j$^$;$s!%(B
|
20
|
-
|
21
|
-
$B%G%U%)%k%H$G$O!$(BPostgreSQL$B$,(B/usr/local/pgsql$BG[2<$K%$%s%9%H!<%k$5$l$F$$$k(B
|
22
|
-
$B$H$7$F$$$^$9!%JL$N>l=j$K%$%s%9%H!<%k$7$F$$$k>l9g$K$O!$4D6-JQ?t(BPGLIB$B$K(Blibpq
|
23
|
-
$B%i%$%V%i%j$,CV$$$F$"$k(Bdirectory$B$K@_Dj$7$F2<$5$$!#(B
|
24
|
-
|
25
|
-
$BG$0U$N>l=j$G!$$3$N%"!<%+%$%V$rE83+$7$F$/$@$5$$!%8e$O(B
|
26
|
-
|
27
|
-
ruby extconf.rb
|
28
|
-
make
|
29
|
-
su ($B$b$7I,MW$J$i(B)
|
30
|
-
make install
|
31
|
-
|
32
|
-
$B$H$9$k$@$1$G$9!%(BPostgreSQL$B$N%$%s%/%k!<%I%U%!%$%k!"%i%$%V%i%j%U%!%$%k$N(B
|
33
|
-
$B%$%s%9%H!<%k>l=j$,I8=`$N0LCV$G$O$J$/%3%s%Q%$%i$,8+IU$1$k$3$H$,$G$-$J$$(B
|
34
|
-
$B>l9g$K$O(B
|
35
|
-
|
36
|
-
--with-pgsql-include-dir=<$B%$%s%/%k!<%I%U%!%$%k%G%#%l%/%H%j(B>
|
37
|
-
--with-pgsql-lib-dir=<$B%i%$%V%i%j%G%#%l%/%H%j(B>
|
38
|
-
$B$^$?$O(B
|
39
|
-
--with-pgsql-dir=<$B%G%#%l%/%H%j(B>
|
40
|
-
$B$3$l$O0J2<$N$h$&$K;XDj$7$?$H$-$H$*$J$8$G$9!#(B
|
41
|
-
--with-pgsql-include-dir=<$B%G%#%l%/%H%j(B>/include
|
42
|
-
--with-pgsql-lib-dir=<$B%G%#%l%/%H%j(B>/lib
|
43
|
-
|
44
|
-
|
45
|
-
$BNc$($P(B
|
46
|
-
|
47
|
-
ruby extconf.rb --with-pgsql-include-dir=/usr/local/pgsql/include \
|
48
|
-
--with-pgsql-lib-dir=/usr/local/pgsql/lib
|
49
|
-
$B$^$?$O(B
|
50
|
-
ruby extconf.rb --with-pgsql-dir=/usr/local/pgsql
|
51
|
-
|
52
|
-
$B$N$h$&$K;XDj$7$F$/$@$5$$!#(B
|
53
|
-
|
54
|
-
- How to use ?
|
55
|
-
|
56
|
-
require "postgres"
|
57
|
-
|
58
|
-
$B$H$7$F$+$i8f;HMQ2<$5$$!#(B
|
59
|
-
|
60
|
-
- What function can I use ?
|
61
|
-
|
62
|
-
$B4pK\E*$K!"(BC$B$N(Blibpq$B%$%s%?%U%'!<%9$GDj5A$5$l$F$$$k4X?t$O%5%]!<%H$7$F$$$^$9!#(B
|
63
|
-
ver 0.6.0 $B$+$i?7$7$/(B Large Object $B%$%s%?!<%U%'%$%9$,DI2C$5$l$^$7$?!#(B
|
64
|
-
|
65
|
-
$B%5%]!<%H$7$F$$$k%a%=%C%I$N0lMw$O0J2<$NDL$j$G$9!#(B
|
66
|
-
|
67
|
-
PGconn$B%/%i%9(B:
|
68
|
-
|
69
|
-
$B%/%i%9%a%=%C%I(B
|
70
|
-
new
|
71
|
-
connect
|
72
|
-
setdb
|
73
|
-
setdblogin
|
74
|
-
escape
|
75
|
-
quote
|
76
|
-
escape_bytea
|
77
|
-
|
78
|
-
$B%a%=%C%I(B
|
79
|
-
db
|
80
|
-
host
|
81
|
-
options
|
82
|
-
port
|
83
|
-
tty
|
84
|
-
status
|
85
|
-
error
|
86
|
-
finish
|
87
|
-
close
|
88
|
-
reset
|
89
|
-
user
|
90
|
-
trace
|
91
|
-
untrace
|
92
|
-
|
93
|
-
exec
|
94
|
-
query
|
95
|
-
async_exec
|
96
|
-
async_query
|
97
|
-
get_notify
|
98
|
-
insert_table
|
99
|
-
putline
|
100
|
-
getline
|
101
|
-
endcopy
|
102
|
-
notifies
|
103
|
-
|
104
|
-
lo_import
|
105
|
-
lo_export
|
106
|
-
lo_create
|
107
|
-
lo_open
|
108
|
-
lo_unlink
|
109
|
-
|
110
|
-
client_encoding
|
111
|
-
set_client_encoding
|
112
|
-
|
113
|
-
PGresult$B%/%i%9(B:
|
114
|
-
|
115
|
-
$B%a%=%C%I(B
|
116
|
-
each
|
117
|
-
[]
|
118
|
-
status
|
119
|
-
result
|
120
|
-
fields
|
121
|
-
num_tuples
|
122
|
-
num_fields
|
123
|
-
fieldname
|
124
|
-
fieldnum
|
125
|
-
type
|
126
|
-
size
|
127
|
-
getvalue
|
128
|
-
getlength
|
129
|
-
cmdstatus
|
130
|
-
print
|
131
|
-
clear
|
132
|
-
|
133
|
-
PGlarge$B%/%i%9(B:
|
134
|
-
|
135
|
-
$B%a%=%C%I(B
|
136
|
-
open
|
137
|
-
close
|
138
|
-
read
|
139
|
-
write
|
140
|
-
lseek
|
141
|
-
tell
|
142
|
-
unlink
|
143
|
-
oid
|
144
|
-
size
|
145
|
-
export
|
146
|
-
|
147
|
-
- Acknowledgement
|
148
|
-
|
149
|
-
$BK\3HD%%i%$%V%i%j$r:n@.$9$k$K$"$?$C$F!"(Bruby-list, ruby-dev,
|
150
|
-
ruby-talk,$B5Z$S(B pgsql-jp$B%a!<%j%s%0%j%9%H$N%a%s%P!<$K!"B?$/$NM-1W$J(B
|
151
|
-
$B%"%I%P%$%9$rD:$-$^$7$?!#$3$3$K46<U$N0U$rI=$7$^$9!#(B
|
152
|
-
|
153
|
-
- Copying
|
154
|
-
|
155
|
-
$BK\3HD%%i%$%V%i%j$NCx:n8"$O!"$^$D$b$H(B $B$f$-$R$m$H$^$D$b$H(B $B$($$$8$,(B
|
156
|
-
$BJ];}$7$^$9!#(B
|
157
|
-
|
158
|
-
$BK\3HD%%i%$%V%i%j$O!"(BRuby$BK\BN$HF1$8G[I[>r7o$K=>$C$F:FG[I[$9$k$3$H(B
|
159
|
-
$B$,$G$-$^$9!#(BRuby$BK\BN$NG[I[>r7o$K$D$$$F$O!"(BRuby$BG[I[J*Cf$N(BREADME.jp
|
160
|
-
$B$K=q$+$l$F$$$^$9!#(B
|
161
|
-
|
162
|
-
$B8=:_$O@FF#(B $BEP$,(B maintainer $B$r>5$C$F$$$k$N$G!"Ld$$9g$o$;$O$3$A$i$NJ}$K(B
|
163
|
-
$B$*4j$$$7$^$9!#(B
|
164
|
-
|
165
|
-
- Author
|
166
|
-
|
167
|
-
$B$^$D$b$H(B $B$f$-$R$m(B <matz@ruby-lang.org>
|
168
|
-
Author of Ruby
|
169
|
-
|
170
|
-
$B$^$D$b$H(B $B$($$$8(B <usagi@ruby.club.or.jp>
|
171
|
-
One of users who loves Ruby
|
172
|
-
|
173
|
-
$B$3$N$U$?$j$O7;Do$G$O$"$j$^$;$s!#(B :-)
|
174
|
-
|
175
|
-
- Special Thanks
|
176
|
-
|
177
|
-
Guy Decoux ts <decoux@moulon.inra.fr>
|
178
|
-
|
179
|
-
- maintainer
|
180
|
-
|
181
|
-
$B@FF#(B $BEP(B <noborus@netlab.jp>
|
182
|
-
$B$^$D$b$H$G$J$/$F$9$$$^$;$s(B :-)
|
183
|
-
|
data/Rakefile.local
DELETED
@@ -1,312 +0,0 @@
|
|
1
|
-
#!rake
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
require 'tempfile'
|
5
|
-
require 'rbconfig'
|
6
|
-
|
7
|
-
MISCDIR = BASEDIR + 'misc'
|
8
|
-
|
9
|
-
EXT_MAKEFILE = EXTDIR + 'Makefile'
|
10
|
-
EXT_SOURCES = FileList[ EXTDIR + '*.c' ]
|
11
|
-
EXT_SO = EXTDIR + "pg_ext.#{CONFIG['DLEXT']}"
|
12
|
-
|
13
|
-
NUM_CPUS = if File.exist?('/proc/cpuinfo')
|
14
|
-
File.read('/proc/cpuinfo').scan('processor').length
|
15
|
-
elsif RUBY_PLATFORM.include?( 'darwin' )
|
16
|
-
`system_profiler SPHardwareDataType | grep 'Cores' | awk '{print $5}'`.chomp
|
17
|
-
else
|
18
|
-
1
|
19
|
-
end
|
20
|
-
|
21
|
-
# Cross-compilation constants
|
22
|
-
OPENSSL_VERSION = ENV['OPENSSL_VERSION'] || '1.0.0d'
|
23
|
-
POSTGRESQL_VERSION = ENV['POSTGRESQL_VERSION'] || '9.0.3'
|
24
|
-
|
25
|
-
COMPILE_HOME = Pathname( "~/.rake-compiler" ).expand_path
|
26
|
-
STATIC_SOURCESDIR = COMPILE_HOME + 'sources'
|
27
|
-
STATIC_BUILDDIR = COMPILE_HOME + 'builds'
|
28
|
-
|
29
|
-
# Static OpenSSL build vars
|
30
|
-
STATIC_OPENSSL_BUILDDIR = STATIC_BUILDDIR + "openssl-#{OPENSSL_VERSION}"
|
31
|
-
|
32
|
-
OPENSSL_SOURCE_URI =
|
33
|
-
URI( "http://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz" )
|
34
|
-
OPENSSL_TARBALL = STATIC_SOURCESDIR + File.basename( OPENSSL_SOURCE_URI.path )
|
35
|
-
OPENSSL_MAKEFILE = STATIC_OPENSSL_BUILDDIR + 'Makefile'
|
36
|
-
|
37
|
-
LIBSSLEAY32 = STATIC_OPENSSL_BUILDDIR + 'libssleay32.a'
|
38
|
-
LIBEAY32 = STATIC_OPENSSL_BUILDDIR + 'libeay32.a'
|
39
|
-
|
40
|
-
OPENSSL_PATCHES = Rake::FileList[ MISCDIR + "openssl-#{OPENSSL_VERSION}.*.patch" ]
|
41
|
-
|
42
|
-
# Static PostgreSQL build vars
|
43
|
-
STATIC_POSTGRESQL_BUILDDIR = STATIC_BUILDDIR + "postgresql-#{POSTGRESQL_VERSION}"
|
44
|
-
POSTGRESQL_SOURCE_URI = begin
|
45
|
-
uristring = "http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/" +
|
46
|
-
"v%s/postgresql-%s.tar.gz" % [ POSTGRESQL_VERSION, POSTGRESQL_VERSION ]
|
47
|
-
URI( uristring )
|
48
|
-
end
|
49
|
-
POSTGRESQL_TARBALL = STATIC_SOURCESDIR + File.basename( POSTGRESQL_SOURCE_URI.path )
|
50
|
-
|
51
|
-
STATIC_POSTGRESQL_SRCDIR = STATIC_POSTGRESQL_BUILDDIR + 'src'
|
52
|
-
STATIC_POSTGRESQL_LIBDIR = STATIC_POSTGRESQL_SRCDIR + 'interfaces/libpq'
|
53
|
-
STATIC_POSTGRESQL_INCDIR = STATIC_POSTGRESQL_SRCDIR + 'include'
|
54
|
-
|
55
|
-
POSTGRESQL_GLOBAL_MAKEFILE = STATIC_POSTGRESQL_SRCDIR + 'Makefile.global'
|
56
|
-
POSTGRESQL_SHLIB_MAKEFILE = STATIC_POSTGRESQL_SRCDIR + 'Makefile.shlib'
|
57
|
-
POSTGRESQL_SHLIB_MF_ORIG = STATIC_POSTGRESQL_SRCDIR + 'Makefile.shlib.orig'
|
58
|
-
POSTGRESQL_LIB = STATIC_POSTGRESQL_LIBDIR + 'libpq.a'
|
59
|
-
|
60
|
-
CROSS_PREFIX = if RUBY_PLATFORM.include?( 'darwin' )
|
61
|
-
'i386-mingw32'
|
62
|
-
else
|
63
|
-
'i586-mingw32msvc'
|
64
|
-
end
|
65
|
-
|
66
|
-
# Make sure the spec data is packaged up with the gem
|
67
|
-
SPEC_DATA = Rake::FileList[ SPECDIR + 'data/*' ]
|
68
|
-
GEMSPEC.test_files += SPEC_DATA.to_a
|
69
|
-
|
70
|
-
# Clean up any testing database directories
|
71
|
-
TESTING_TMPDIRS = Rake::FileList[ "#{BASEDIR}/tmp_test_*" ]
|
72
|
-
CLOBBER.include( STATIC_SOURCESDIR.to_s, *TESTING_TMPDIRS )
|
73
|
-
|
74
|
-
# clean intermediate files and folders
|
75
|
-
CLEAN.include( STATIC_BUILDDIR.to_s )
|
76
|
-
|
77
|
-
|
78
|
-
#####################################################################
|
79
|
-
### T A S K S
|
80
|
-
#####################################################################
|
81
|
-
|
82
|
-
# Make both the default task and the spec task depend on building the extension
|
83
|
-
task :local => :compile
|
84
|
-
task :spec => :compile
|
85
|
-
namespace :spec do
|
86
|
-
task :doc => [ :compile ]
|
87
|
-
task :quiet => [ :compile ]
|
88
|
-
task :html => [ :compile ]
|
89
|
-
task :text => [ :compile ]
|
90
|
-
end
|
91
|
-
|
92
|
-
ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2'
|
93
|
-
|
94
|
-
begin
|
95
|
-
require 'rake/clean'
|
96
|
-
require 'rake/extensiontask'
|
97
|
-
require 'rake/extensioncompiler'
|
98
|
-
|
99
|
-
Rake::ExtensionTask.new do |ext|
|
100
|
-
ext.name = 'pg_ext'
|
101
|
-
ext.gem_spec = GEMSPEC
|
102
|
-
ext.ext_dir = EXTDIR.to_s
|
103
|
-
ext.lib_dir = LIBDIR.to_s
|
104
|
-
ext.source_pattern = "*.{c,h}"
|
105
|
-
|
106
|
-
# If there's an explicit 'compile' argument, use everything after it as options.
|
107
|
-
if offset = ARGV.index( 'compile' )
|
108
|
-
trace "config options = %p" % [ ARGV[(offset + 1)..-1] ]
|
109
|
-
ext.config_options = ARGV[ (offset + 1)..-1 ]
|
110
|
-
# Otherwise, just grab everything from the first option onward
|
111
|
-
elsif offset = ARGV.index( ARGV.find {|arg| arg =~ /^--/ } )
|
112
|
-
trace "config options = %p" % [ ARGV[offset..-1] ]
|
113
|
-
ext.config_options = ARGV[ offset..-1 ]
|
114
|
-
else
|
115
|
-
trace "No config options (ARGV = %p)" % [ ARGV ]
|
116
|
-
end
|
117
|
-
|
118
|
-
ext.cross_compile = true
|
119
|
-
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
120
|
-
|
121
|
-
# configure options only for cross compile
|
122
|
-
ext.cross_config_options += [
|
123
|
-
"--with-pg-include=#{STATIC_POSTGRESQL_LIBDIR}",
|
124
|
-
"--with-opt-include=#{STATIC_POSTGRESQL_INCDIR}",
|
125
|
-
"--with-pg-lib=#{STATIC_POSTGRESQL_LIBDIR}",
|
126
|
-
"--with-opt-lib=#{STATIC_OPENSSL_BUILDDIR}",
|
127
|
-
"--enable-static-build",
|
128
|
-
]
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
#####################################################################
|
135
|
-
### C R O S S - C O M P I L A T I O N - T A S K S
|
136
|
-
#####################################################################
|
137
|
-
|
138
|
-
|
139
|
-
directory STATIC_SOURCESDIR.to_s
|
140
|
-
|
141
|
-
#
|
142
|
-
# Static OpenSSL build tasks
|
143
|
-
#
|
144
|
-
directory STATIC_OPENSSL_BUILDDIR.to_s
|
145
|
-
|
146
|
-
# openssl source file should be stored there
|
147
|
-
file OPENSSL_TARBALL => STATIC_SOURCESDIR do |t|
|
148
|
-
download( OPENSSL_SOURCE_URI, t.name )
|
149
|
-
end
|
150
|
-
|
151
|
-
# Extract the openssl builds
|
152
|
-
file STATIC_OPENSSL_BUILDDIR => OPENSSL_TARBALL do |t|
|
153
|
-
trace "extracting %s to %s" % [ OPENSSL_TARBALL, STATIC_OPENSSL_BUILDDIR.parent ]
|
154
|
-
STATIC_OPENSSL_BUILDDIR.mkpath
|
155
|
-
run 'tar', '-xzf', OPENSSL_TARBALL.to_s, '-C', STATIC_OPENSSL_BUILDDIR.parent.to_s
|
156
|
-
OPENSSL_MAKEFILE.unlink if OPENSSL_MAKEFILE.exist?
|
157
|
-
|
158
|
-
OPENSSL_PATCHES.each do |patchfile|
|
159
|
-
trace " applying patch #{patchfile}..."
|
160
|
-
run 'patch', '-Np1', '-d', STATIC_OPENSSL_BUILDDIR.to_s,
|
161
|
-
'-i', File.expand_path( patchfile, BASEDIR )
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
CMD_PRELUDE = [
|
166
|
-
'env',
|
167
|
-
"CC=#{CROSS_PREFIX}-gcc",
|
168
|
-
"CFLAGS=-DDSO_WIN32",
|
169
|
-
"AR=#{CROSS_PREFIX}-ar",
|
170
|
-
"RANLIB=#{CROSS_PREFIX}-ranlib"
|
171
|
-
]
|
172
|
-
|
173
|
-
|
174
|
-
# generate the makefile in a clean build location
|
175
|
-
file OPENSSL_MAKEFILE => STATIC_OPENSSL_BUILDDIR do |t|
|
176
|
-
Dir.chdir( STATIC_OPENSSL_BUILDDIR ) do
|
177
|
-
cmd = CMD_PRELUDE.dup
|
178
|
-
cmd << "./Configure" << 'mingw'
|
179
|
-
|
180
|
-
run( *cmd )
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
desc "compile static openssl libraries"
|
185
|
-
task :openssl_libs => [ LIBSSLEAY32, LIBEAY32 ]
|
186
|
-
|
187
|
-
task :compile_static_openssl => OPENSSL_MAKEFILE do |t|
|
188
|
-
Dir.chdir( STATIC_OPENSSL_BUILDDIR ) do
|
189
|
-
cmd = CMD_PRELUDE.dup
|
190
|
-
cmd << 'make' << "-j#{NUM_CPUS}" << 'build_libs'
|
191
|
-
|
192
|
-
run( *cmd )
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
desc "compile static #{LIBEAY32}"
|
197
|
-
file LIBEAY32 => :compile_static_openssl do |t|
|
198
|
-
FileUtils.cp( STATIC_OPENSSL_BUILDDIR + 'libcrypto.a', LIBEAY32.to_s )
|
199
|
-
end
|
200
|
-
|
201
|
-
desc "compile static #{LIBSSLEAY32}"
|
202
|
-
file LIBSSLEAY32 => :compile_static_openssl do |t|
|
203
|
-
FileUtils.cp( STATIC_OPENSSL_BUILDDIR + 'libssl.a', LIBSSLEAY32.to_s )
|
204
|
-
end
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
#
|
209
|
-
# Static PostgreSQL build tasks
|
210
|
-
#
|
211
|
-
directory STATIC_POSTGRESQL_BUILDDIR.to_s
|
212
|
-
|
213
|
-
|
214
|
-
# postgresql source file should be stored there
|
215
|
-
file POSTGRESQL_TARBALL => STATIC_SOURCESDIR do |t|
|
216
|
-
download( POSTGRESQL_SOURCE_URI, t.name )
|
217
|
-
end
|
218
|
-
|
219
|
-
# Extract the postgresql sources
|
220
|
-
file STATIC_POSTGRESQL_BUILDDIR => POSTGRESQL_TARBALL do |t|
|
221
|
-
trace "extracting %s to %s" % [ POSTGRESQL_TARBALL, STATIC_POSTGRESQL_BUILDDIR.parent ]
|
222
|
-
STATIC_POSTGRESQL_BUILDDIR.mkpath
|
223
|
-
run 'tar', '-xzf', POSTGRESQL_TARBALL.to_s, '-C', STATIC_POSTGRESQL_BUILDDIR.parent.to_s
|
224
|
-
mv POSTGRESQL_SHLIB_MAKEFILE, POSTGRESQL_SHLIB_MF_ORIG
|
225
|
-
end
|
226
|
-
|
227
|
-
# generate the makefile in a clean build location
|
228
|
-
file POSTGRESQL_GLOBAL_MAKEFILE => [ STATIC_POSTGRESQL_BUILDDIR, :openssl_libs ] do |t|
|
229
|
-
options = [
|
230
|
-
'--target=i386-mingw32',
|
231
|
-
"--host=#{Rake::ExtensionCompiler.mingw_host}",
|
232
|
-
'--with-openssl',
|
233
|
-
'--without-zlib',
|
234
|
-
'--disable-shared',
|
235
|
-
]
|
236
|
-
|
237
|
-
Dir.chdir( STATIC_POSTGRESQL_BUILDDIR ) do
|
238
|
-
configure_path = STATIC_POSTGRESQL_BUILDDIR + 'configure'
|
239
|
-
cmd = [ configure_path.to_s, *options ]
|
240
|
-
cmd << "CFLAGS=-L#{STATIC_OPENSSL_BUILDDIR}"
|
241
|
-
cmd << "LDFLAGS=-L#{STATIC_OPENSSL_BUILDDIR}"
|
242
|
-
cmd << "LDFLAGS_SL=-L#{STATIC_OPENSSL_BUILDDIR}"
|
243
|
-
cmd << "LIBS=-lwsock32 -lws2_32 -lgdi32"
|
244
|
-
cmd << "CPPFLAGS=-I#{STATIC_OPENSSL_BUILDDIR}/include"
|
245
|
-
|
246
|
-
run( *cmd )
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
|
251
|
-
# patch the Makefile.shlib -- depend on the build dir so it's only
|
252
|
-
# rewritten if the tarball is re-extracted.
|
253
|
-
file POSTGRESQL_SHLIB_MAKEFILE => POSTGRESQL_SHLIB_MF_ORIG do |t|
|
254
|
-
tf = Tempfile.new( POSTGRESQL_SHLIB_MAKEFILE.basename )
|
255
|
-
POSTGRESQL_SHLIB_MF_ORIG.open( File::RDONLY ) do |ifh|
|
256
|
-
ifh.each_line do |line|
|
257
|
-
tf.print( line.sub(/^(\s*haslibarule\s*=\s*yes)/, "# \\1 ") )
|
258
|
-
end
|
259
|
-
end
|
260
|
-
tf.close
|
261
|
-
|
262
|
-
FileUtils.mv( tf.path, t.name, :verbose => $trace )
|
263
|
-
end
|
264
|
-
|
265
|
-
|
266
|
-
# make libpq.a
|
267
|
-
task POSTGRESQL_LIB => [ POSTGRESQL_GLOBAL_MAKEFILE, POSTGRESQL_SHLIB_MAKEFILE ] do |t|
|
268
|
-
Dir.chdir( POSTGRESQL_LIB.dirname ) do
|
269
|
-
sh 'make', "-j#{NUM_CPUS}", POSTGRESQL_LIB.basename.to_s, 'PORTNAME=win32'
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
|
274
|
-
#desc 'compile static libpg.a'
|
275
|
-
task :static_libpq => POSTGRESQL_LIB
|
276
|
-
|
277
|
-
desc 'cross compile pg for win32'
|
278
|
-
task :cross do
|
279
|
-
ENV['CROSS_COMPILING'] = 'yes'
|
280
|
-
end
|
281
|
-
task :cross => [ :mingw32, :static_libpq ]
|
282
|
-
|
283
|
-
task :mingw32 do
|
284
|
-
# Use Rake::ExtensionCompiler helpers to find the proper host
|
285
|
-
unless Rake::ExtensionCompiler.mingw_host then
|
286
|
-
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
287
|
-
warn "Please refer to your distribution/package manager documentation about installation."
|
288
|
-
fail
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
rescue LoadError => err
|
293
|
-
task :no_rake_compiler do
|
294
|
-
log "You'll need to install rake-compiler to compile this."
|
295
|
-
fail
|
296
|
-
end
|
297
|
-
|
298
|
-
task :compile => :no_rake_compiler
|
299
|
-
task :cross => :no_rake_compiler
|
300
|
-
task :mingw32 => :no_rake_compiler
|
301
|
-
task :static_libpq => :no_rake_compiler
|
302
|
-
end
|
303
|
-
|
304
|
-
|
305
|
-
desc "Stop any Postmaster instances that remain after testing."
|
306
|
-
task :cleanup_testing_dbs do
|
307
|
-
require 'spec/lib/helpers'
|
308
|
-
PgTestingHelpers.stop_existing_postmasters()
|
309
|
-
Rake::Task[:clean].invoke
|
310
|
-
end
|
311
|
-
|
312
|
-
|