transactd 1.0.1-x64-mswin64-100
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 +7 -0
- data/BUILD_UNIX-JA +174 -0
- data/BUILD_WIN-JA +256 -0
- data/CMakeLists.txt +96 -0
- data/COPYING +339 -0
- data/README +406 -0
- data/README-JA +424 -0
- data/bin/2.0/transactd.so +0 -0
- data/bin/common/tdclc_64_1_0.dll +0 -0
- data/bin/common/tdclcpp_vc100_64m_1_1.dll +0 -0
- data/build/common/copyifgreater.cmd +30 -0
- data/build/common/copyifgreater.js +290 -0
- data/build/common/system.cmake +122 -0
- data/build/tdclrb/bldgem/extconf.rb +123 -0
- data/build/tdclrb/gem/INSTALLLOG.win32 +9 -0
- data/build/tdclrb/gem/Makefile.win32-VS +65 -0
- data/build/tdclrb/gem/Makefile.win32-prebuilt +48 -0
- data/build/tdclrb/gem/detect.rb +31 -0
- data/build/tdclrb/gem/helper.rb +113 -0
- data/build/tdclrb/gem/transactd.rb +22 -0
- data/source/bzs/test/tdclrb/bench_tdclcpp.rb +375 -0
- data/source/bzs/test/tdclrb/prepare.rb +226 -0
- data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +172 -0
- data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +208 -0
- data/source/bzs/test/tdclrb/transactd_spec.rb +1536 -0
- data/transactd.gemspec +97 -0
- metadata +75 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
/*=================================================================
|
2
|
+
Copyright (C) 2013 BizStation Corp All rights reserved.
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or
|
5
|
+
modify it under the terms of the GNU General Public License
|
6
|
+
as published by the Free Software Foundation; either version 2
|
7
|
+
of the License, or (at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License
|
15
|
+
along with this program; if not, write to the Free Software
|
16
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
|
+
02111-1307, USA.
|
18
|
+
=================================================================*/
|
19
|
+
var DRY_RUN = false;
|
20
|
+
var LOG_OFF = false;
|
21
|
+
var IGNORE_ERROR = false;
|
22
|
+
var VERSION_SEPARATOR = '.';
|
23
|
+
var TIMEOUT = 30 * 1000; // copy timeout = 30 sec
|
24
|
+
var fso = new ActiveXObject('Scripting.FileSystemObject');
|
25
|
+
|
26
|
+
// replace '/' to '\'
|
27
|
+
function toNativePath(path)
|
28
|
+
{
|
29
|
+
return path.replace(/\//g, '\\').replace(/^\s*(.*?)\s*$/, "$1");
|
30
|
+
}
|
31
|
+
|
32
|
+
// replace '/' to '\' and convert to absolute path
|
33
|
+
function toNativeAbsolutePath(path)
|
34
|
+
{
|
35
|
+
return fso.GetAbsolutePathName(toNativePath(path));
|
36
|
+
}
|
37
|
+
|
38
|
+
// get parent folder native absolute path
|
39
|
+
function getParentPath(path)
|
40
|
+
{
|
41
|
+
path = toNativeAbsolutePath(path);
|
42
|
+
var name = fso.GetFileName(path);
|
43
|
+
return stripPath(path.substring(0, path.length - name.length));
|
44
|
+
}
|
45
|
+
|
46
|
+
// delete end of '\'
|
47
|
+
function stripPath(path)
|
48
|
+
{
|
49
|
+
return path.replace(/\\$/, '');
|
50
|
+
}
|
51
|
+
|
52
|
+
// create folder recursive -- return true if succeed
|
53
|
+
function createFolder(path)
|
54
|
+
{
|
55
|
+
var fullpath = toNativeAbsolutePath(path);
|
56
|
+
if (fso.FolderExists(fullpath))
|
57
|
+
return true;
|
58
|
+
var myName = fso.GetFileName(fullpath);
|
59
|
+
var parentPath = fullpath.substring(0, fullpath.length - myName.length);
|
60
|
+
parentPath = toNativeAbsolutePath(parentPath);
|
61
|
+
if (fullpath == parentPath)
|
62
|
+
return false;
|
63
|
+
var parentOK = fso.FolderExists(parentPath) || createFolder(parentPath);
|
64
|
+
if (!parentOK)
|
65
|
+
return false;
|
66
|
+
try
|
67
|
+
{
|
68
|
+
fso.CreateFolder(fullpath);
|
69
|
+
return true;
|
70
|
+
} catch (e) {}
|
71
|
+
return false;
|
72
|
+
}
|
73
|
+
|
74
|
+
// get version array
|
75
|
+
function getVersion(path)
|
76
|
+
{
|
77
|
+
var str = fso.FileExists(path) ? fso.GetFileVersion(path) : '';
|
78
|
+
var ver = str.split(VERSION_SEPARATOR);
|
79
|
+
var maxstrlen = 0;
|
80
|
+
for(var i = 0; i < ver.length; i++)
|
81
|
+
{
|
82
|
+
ver[i] = ver[i].replace(/^\s*(.*?)\s*$/, "$1");
|
83
|
+
if (ver[i].length > maxstrlen)
|
84
|
+
maxstrlen = ver[i].length;
|
85
|
+
}
|
86
|
+
if (maxstrlen == 0)
|
87
|
+
ver = [];
|
88
|
+
return ver;
|
89
|
+
}
|
90
|
+
|
91
|
+
// hasVersion -- return true if both of srcpath-version and destpath-version has version info
|
92
|
+
function haveVersion(srcpath, destpath)
|
93
|
+
{
|
94
|
+
var srcver = getVersion(srcpath);
|
95
|
+
var destver = getVersion(destpath);
|
96
|
+
return ((srcver.length > 0) && (destver.length > 0));
|
97
|
+
}
|
98
|
+
|
99
|
+
// greater -- return true if srcpath-version is greater than destpath-version
|
100
|
+
function greater(srcpath, destpath)
|
101
|
+
{
|
102
|
+
var srcver = getVersion(srcpath);
|
103
|
+
var destver = getVersion(destpath);
|
104
|
+
if((srcver.length <= 0) || (destver.length <= 0))
|
105
|
+
return false;
|
106
|
+
var i = 0;
|
107
|
+
while(i < srcver.length && i < destver.length)
|
108
|
+
{
|
109
|
+
src = srcver[i];
|
110
|
+
dest = destver[i];
|
111
|
+
if (!isNaN(src) && !isNaN(dest))
|
112
|
+
{
|
113
|
+
src = parseInt(src, 10);
|
114
|
+
dest = parseInt(dest, 10);
|
115
|
+
}
|
116
|
+
if(src > dest)
|
117
|
+
return true;
|
118
|
+
i++;
|
119
|
+
}
|
120
|
+
return false;
|
121
|
+
}
|
122
|
+
|
123
|
+
// copy -- copy srcpath to destpath (overwrite)
|
124
|
+
// return true if succeed
|
125
|
+
function copy(srcpath, destpath)
|
126
|
+
{
|
127
|
+
if (!fso.FileExists(srcpath))
|
128
|
+
return false;
|
129
|
+
if (!createFolder(getParentPath(destpath)))
|
130
|
+
return false;
|
131
|
+
try
|
132
|
+
{
|
133
|
+
if (! DRY_RUN)
|
134
|
+
{
|
135
|
+
fso.CopyFile(srcpath, destpath, true);
|
136
|
+
var timer = 0;
|
137
|
+
while(!fso.fileExists(destpath) && (timer < TIMEOUT))
|
138
|
+
{
|
139
|
+
WScript.Sleep(100);
|
140
|
+
timer += 100;
|
141
|
+
}
|
142
|
+
return (timer < TIMEOUT);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
catch (e)
|
146
|
+
{
|
147
|
+
return false;
|
148
|
+
}
|
149
|
+
return true;
|
150
|
+
}
|
151
|
+
|
152
|
+
/*
|
153
|
+
copyIfGreater
|
154
|
+
copy srcpath to destpath if srcpath is greater than destpath
|
155
|
+
return code:
|
156
|
+
COPYRESULT_COPIED (0): file copied
|
157
|
+
COPYRESULT_NOTCOPIED (1): file not copied because it is not greater than dest
|
158
|
+
COPYRESULT_CANNOTREAD (2): file not copied because can not read version number
|
159
|
+
COPYRESULT_EXITERROR (3): file not copied because some error occured
|
160
|
+
*/
|
161
|
+
var COPYRESULT_COPIED = 0;
|
162
|
+
var COPYRESULT_NOTCOPIED = 1;
|
163
|
+
var COPYRESULT_CANNOTREAD = 2;
|
164
|
+
var COPYRESULT_EXITERROR = 3;
|
165
|
+
function copyIfGreater(srcpath, destpath)
|
166
|
+
{
|
167
|
+
// 1. check srcpath exists (not folder!)
|
168
|
+
if (!fso.FileExists(srcpath))
|
169
|
+
return COPYRESULT_EXITERROR;
|
170
|
+
// 2. check destpath (not folder!) and its parent
|
171
|
+
if (fso.FolderExists(destpath))
|
172
|
+
return COPYRESULT_EXITERROR;
|
173
|
+
if (!createFolder(getParentPath(destpath)))
|
174
|
+
return COPYRESULT_EXITERROR;
|
175
|
+
// 3. if destpath not exists then copy file
|
176
|
+
if (!fso.FileExists(destpath))
|
177
|
+
{
|
178
|
+
if (copy(srcpath, destpath))
|
179
|
+
return COPYRESULT_COPIED;
|
180
|
+
return COPYRESULT_EXITERROR;
|
181
|
+
}
|
182
|
+
// 4. check both of srcpath and destpath have version info
|
183
|
+
if (!haveVersion(srcpath, destpath))
|
184
|
+
return COPYRESULT_CANNOTREAD;
|
185
|
+
// 5. if this is greater than destFileInfo then copy file
|
186
|
+
if (greater(srcpath, destpath))
|
187
|
+
{
|
188
|
+
if (copy(srcpath, destpath))
|
189
|
+
return COPYRESULT_COPIED;
|
190
|
+
return COPYRESULT_EXITERROR;
|
191
|
+
}
|
192
|
+
// 6. other do nothing
|
193
|
+
return COPYRESULT_NOTCOPIED;
|
194
|
+
}
|
195
|
+
|
196
|
+
// parse arguments to file list
|
197
|
+
function printArg(args){
|
198
|
+
WScript.Echo('source:' + args['source'] + "\ndest:" +args['dest'] + "\n");
|
199
|
+
}
|
200
|
+
function parseArgs(args)
|
201
|
+
{
|
202
|
+
if (!(args instanceof Array) || (args.length < 2))
|
203
|
+
return false;
|
204
|
+
// 1. last arg is dest
|
205
|
+
var dest = toNativePath(args[args.length - 1])
|
206
|
+
// 2. is dest folder? -- end with '\\' or multi source then dest is folder
|
207
|
+
var destIsFolder = (/\\$/.test(dest) || args.length > 2 || fso.FolderExists(dest))
|
208
|
+
//WScript.Echo(destIsFolder ? 'destIsFolder' : 'destIs not Folder')
|
209
|
+
// 3. if dest is file then only 1 file to copy
|
210
|
+
if (!destIsFolder)
|
211
|
+
{
|
212
|
+
var src = stripPath(toNativePath(args[0]));
|
213
|
+
if (src.length <= 0)
|
214
|
+
return { 'source': new Array(), 'dest': new Array() };
|
215
|
+
var dst = stripPath(toNativePath(args[1]));
|
216
|
+
return { 'source': new Array(src), 'dest': new Array(dst) };
|
217
|
+
}
|
218
|
+
// 4. if dest is folder, make dest array
|
219
|
+
var ret = { source: new Array(), dest: new Array() };
|
220
|
+
var tmp_srcs = args.slice(0, args.length - 1);
|
221
|
+
for(var i = 0; i < tmp_srcs.length; i++)
|
222
|
+
{
|
223
|
+
var path = toNativePath(tmp_srcs[i]);
|
224
|
+
if (path.length > 0)
|
225
|
+
{
|
226
|
+
var name = fso.GetFileName(path);
|
227
|
+
ret['source'].push(path);
|
228
|
+
ret['dest'].push(fso.BuildPath(dest, name));
|
229
|
+
}
|
230
|
+
}
|
231
|
+
return ret;
|
232
|
+
}
|
233
|
+
|
234
|
+
|
235
|
+
function main()
|
236
|
+
{
|
237
|
+
var args = [];
|
238
|
+
for(var i = 0; i < WScript.Arguments.length; i++)
|
239
|
+
{
|
240
|
+
var argument = WScript.Arguments(i).replace(/^\s*"?\s*(.*?)\s*"?\s*$/, "$1");
|
241
|
+
var subargs = argument.split(';');
|
242
|
+
for(var j = 0; j < subargs.length; j++)
|
243
|
+
{
|
244
|
+
var arg = subargs[j].replace(/^\s*(.*?)\s*$/, "$1");
|
245
|
+
switch (arg) {
|
246
|
+
case '--dry-run': DRY_RUN = true; break;
|
247
|
+
case '--log-off': LOG_OFF = true; break;
|
248
|
+
case '--ignore-error': IGNORE_ERROR = true; break;
|
249
|
+
default:
|
250
|
+
if (arg.length > 0);
|
251
|
+
args.push(arg);
|
252
|
+
break;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
var files = parseArgs(args);
|
257
|
+
if (!files)
|
258
|
+
WScript.Quit(1);
|
259
|
+
var sources = files['source'];
|
260
|
+
var dests = files['dest'];
|
261
|
+
var exitcode = 0;
|
262
|
+
for(var i = 0; i < sources.length; i++)
|
263
|
+
{
|
264
|
+
var ret = copyIfGreater(sources[i], dests[i]);
|
265
|
+
switch (ret) {
|
266
|
+
case COPYRESULT_COPIED:
|
267
|
+
if (!LOG_OFF)
|
268
|
+
WScript.Echo('Installing-if-grater: ' + dests[i]);
|
269
|
+
break;
|
270
|
+
case COPYRESULT_NOTCOPIED:
|
271
|
+
if (!LOG_OFF)
|
272
|
+
WScript.Echo('Up-to-date-if-grater: ' + dests[i]);
|
273
|
+
break;
|
274
|
+
case COPYRESULT_CANNOTREAD:
|
275
|
+
if (!LOG_OFF)
|
276
|
+
WScript.StdErr.WriteLine('Install-warning: ' + sources[i] + ' -> ' + dests[i]);
|
277
|
+
break;
|
278
|
+
case COPYRESULT_EXITERROR:
|
279
|
+
default:
|
280
|
+
if (!LOG_OFF)
|
281
|
+
WScript.StdErr.WriteLine('Install-error-' + ret + ': ' + sources[i] + ' -> ' + dests[i]);
|
282
|
+
if (!IGNORE_ERROR)
|
283
|
+
WScript.Quit(1);
|
284
|
+
exitcode = 1;
|
285
|
+
break;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
WScript.Quit(exitcode);
|
289
|
+
}
|
290
|
+
main()
|
@@ -0,0 +1,122 @@
|
|
1
|
+
##=================================================================
|
2
|
+
# Copyright (C) 2012 2013 BizStation Corp All rights reserved.
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU General Public License
|
6
|
+
# as published by the Free Software Foundation; either version 2
|
7
|
+
# of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
|
+
# 02111-1307, USA.
|
18
|
+
##=================================================================
|
19
|
+
# ==========================================================
|
20
|
+
# get compiler bitness
|
21
|
+
# ==========================================================
|
22
|
+
if(NOT COMMAND bz_get_compiler_bitness)
|
23
|
+
macro(bz_get_compiler_bitness)
|
24
|
+
if(CMAKE_SIZEOF_VOID_P)
|
25
|
+
set(SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
|
26
|
+
else()
|
27
|
+
include(CheckTypeSize)
|
28
|
+
check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY)
|
29
|
+
endif()
|
30
|
+
if(SIZEOF_VOID_P EQUAL 8)
|
31
|
+
set(BZ_BITNESS "64")
|
32
|
+
else()
|
33
|
+
set(BZ_BITNESS "32")
|
34
|
+
endif()
|
35
|
+
if(MSVC AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
36
|
+
if("${CMAKE_GENERATOR}" MATCHES "Win64")
|
37
|
+
set(BZ_BITNESS "64")
|
38
|
+
else()
|
39
|
+
set(BZ_BITNESS "32")
|
40
|
+
endif()
|
41
|
+
endif()
|
42
|
+
endmacro()
|
43
|
+
endif()
|
44
|
+
|
45
|
+
|
46
|
+
# ==========================================================
|
47
|
+
# get compiler
|
48
|
+
# ==========================================================
|
49
|
+
if(NOT COMMAND bz_get_compiler)
|
50
|
+
macro(bz_get_compiler)
|
51
|
+
set(BZ_COMPILER "")
|
52
|
+
if(WIN32)
|
53
|
+
if(MSVC60)
|
54
|
+
set(BZ_COMPILER "_vc060")
|
55
|
+
elseif(MSVC70)
|
56
|
+
set(BZ_COMPILER "_vc070")
|
57
|
+
elseif(MSVC80)
|
58
|
+
set(BZ_COMPILER "_vc080")
|
59
|
+
elseif(MSVC90)
|
60
|
+
set(BZ_COMPILER "_vc090")
|
61
|
+
elseif(MSVC10)
|
62
|
+
set(BZ_COMPILER "_vc100")
|
63
|
+
elseif(MSVC11)
|
64
|
+
set(BZ_COMPILER "_vc110")
|
65
|
+
elseif(MINGW)
|
66
|
+
string(REPLACE "." ";" tmp_list ${CMAKE_CXX_COMPILER_VERSION})
|
67
|
+
list (GET tmp_list 0 MINGW_MAJOR)
|
68
|
+
list (GET tmp_list 1 MINGW_MINOR)
|
69
|
+
list (GET tmp_list 2 MINGW_RELEASE)
|
70
|
+
set(BZ_COMPILER "_mgw${MINGW_MAJOR}${MINGW_MINOR}")
|
71
|
+
endif()
|
72
|
+
endif()
|
73
|
+
endmacro()
|
74
|
+
endif()
|
75
|
+
|
76
|
+
|
77
|
+
# ==========================================================
|
78
|
+
# get windows system bitness
|
79
|
+
# ==========================================================
|
80
|
+
if(NOT COMMAND bz_get_win_bitness)
|
81
|
+
macro(bz_get_win_bitness)
|
82
|
+
if(WIN32)
|
83
|
+
set(tmp_var "$ENV{PROGRAMFILES(x86)}")
|
84
|
+
if(DEFINED tmp_var)
|
85
|
+
set(BZ_WIN_BITNESS "64")
|
86
|
+
else()
|
87
|
+
set(BZ_WIN_BITNESS "32")
|
88
|
+
endif()
|
89
|
+
else()
|
90
|
+
set(BZ_WIN_BITNESS "")
|
91
|
+
endif()
|
92
|
+
endmacro()
|
93
|
+
endif()
|
94
|
+
|
95
|
+
|
96
|
+
# ==========================================================
|
97
|
+
# get windows system directories
|
98
|
+
# ==========================================================
|
99
|
+
if(NOT COMMAND bz_get_win_sysdir)
|
100
|
+
macro(bz_get_win_sysdir)
|
101
|
+
set(BZ_WIN_SYSDIR_FOR_32BIT_BINARY "")
|
102
|
+
set(BZ_WIN_SYSDIR_FOR_64BIT_BINARY "")
|
103
|
+
set(BZ_WIN_SYSDIR "")
|
104
|
+
if(WIN32)
|
105
|
+
bz_get_win_bitness()
|
106
|
+
set(tmp_var "$ENV{Systemroot}")
|
107
|
+
if(DEFINED tmp_var)
|
108
|
+
if("${BZ_WIN_BITNESS}" STREQUAL "32")
|
109
|
+
file(TO_CMAKE_PATH "${tmp_var}/System32" BZ_WIN_SYSDIR_FOR_32BIT_BINARY)
|
110
|
+
elseif("${BZ_WIN_BITNESS}" STREQUAL "64")
|
111
|
+
file(TO_CMAKE_PATH "${tmp_var}/SysWOW64" BZ_WIN_SYSDIR_FOR_32BIT_BINARY)
|
112
|
+
file(TO_CMAKE_PATH "${tmp_var}/System32" BZ_WIN_SYSDIR_FOR_64BIT_BINARY)
|
113
|
+
endif()
|
114
|
+
endif()
|
115
|
+
endif()
|
116
|
+
bz_get_compiler_bitness()
|
117
|
+
if(("${BZ_BITNESS}" STREQUAL "32") OR ("${BZ_BITNESS}" STREQUAL "64"))
|
118
|
+
set(BZ_WIN_SYSDIR "${BZ_WIN_SYSDIR_FOR_${BZ_BITNESS}BIT_BINARY}")
|
119
|
+
endif()
|
120
|
+
endmacro()
|
121
|
+
endif()
|
122
|
+
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# coding : utf-8
|
2
|
+
=begin =============================================================
|
3
|
+
Copyright (C) 2013 BizStation Corp All rights reserved.
|
4
|
+
|
5
|
+
This program is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU General Public License
|
7
|
+
as published by the Free Software Foundation; either version 2
|
8
|
+
of the License, or (at your option) any later version.
|
9
|
+
|
10
|
+
This program is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with this program; if not, write to the Free Software
|
17
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
18
|
+
02111-1307, USA.
|
19
|
+
===================================================================
|
20
|
+
=end
|
21
|
+
|
22
|
+
transactd_gem_root_relative = '../../../'
|
23
|
+
|
24
|
+
require File.expand_path(File.join(transactd_gem_root_relative, 'build/tdclrb/gem/detect.rb'))
|
25
|
+
require File.expand_path(File.join(transactd_gem_root_relative, 'build/tdclrb/gem/helper.rb'))
|
26
|
+
require 'rbconfig'
|
27
|
+
|
28
|
+
transactd_gem_root = File.expand_path(File.join(File.dirname(__FILE__), transactd_gem_root_relative))
|
29
|
+
ruby_bin_path = RbConfig::CONFIG['bindir']
|
30
|
+
ruby_exe_path = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
31
|
+
|
32
|
+
#
|
33
|
+
# use prebuilt binary
|
34
|
+
#
|
35
|
+
if has_binary(transactd_gem_root)
|
36
|
+
make_makefile_prebuilt_win32(ruby_bin_path, transactd_gem_root) if RUBY_PLATFORM =~ /mswin/
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# build binary
|
42
|
+
#
|
43
|
+
|
44
|
+
require 'mkmf'
|
45
|
+
require 'open3'
|
46
|
+
|
47
|
+
# need cmake and swig
|
48
|
+
find_executable('cmake')
|
49
|
+
find_executable('swig')
|
50
|
+
|
51
|
+
# options
|
52
|
+
boost = arg_config('--boost', '').gsub(/"\n/, '')
|
53
|
+
generator = arg_config('--generator', '').gsub(/"\n/, '')
|
54
|
+
ruby_include_dirs = arg_config('--ruby_include_dirs', '').gsub(/"\n/, '')
|
55
|
+
ruby_library_path = arg_config('--ruby_library_path', '').gsub(/"\n/, '')
|
56
|
+
install_prefix = arg_config('--install_prefix', '').gsub(/"\n/, '')
|
57
|
+
|
58
|
+
# boost
|
59
|
+
if boost != '' && boost !=~ /^\-DBOOST_ROOT/
|
60
|
+
boost = '-DBOOST_ROOT="' + to_slash_path(boost) + '"'
|
61
|
+
end
|
62
|
+
|
63
|
+
# detect generator
|
64
|
+
if generator == ''
|
65
|
+
if RUBY_PLATFORM =~ /mswin/
|
66
|
+
bit = (get_ruby_bitness() == 64) ? ' Win64' : ''
|
67
|
+
generator = '-G "Visual Studio 10' + bit + '"'
|
68
|
+
elsif RUBY_PLATFORM =~ /mingw/
|
69
|
+
generator = '-G "MSYS Makefiles"'
|
70
|
+
end
|
71
|
+
else
|
72
|
+
if generator !=~ /^\-G /
|
73
|
+
generator = '-G "' + generator + '"'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# ruby_include_dirs
|
78
|
+
if ruby_include_dirs != '' && ruby_include_dirs !=~ /^\-DRUBY_SWIG_INCLUDE_PATH/
|
79
|
+
ruby_include_dirs = '-DTRANSACTD_RUBY_INCLUDE_PATH="' + to_slash_path(ruby_include_dirs) + '"'
|
80
|
+
end
|
81
|
+
|
82
|
+
# ruby_library_path
|
83
|
+
if ruby_library_path != '' && ruby_library_path !=~ /^\-DRUBY_SWIG_LIBRARY_PATH/
|
84
|
+
ruby_library_path = '-DTRANSACTD_RUBY_LIBRARY_PATH="' + to_slash_path(ruby_library_path) + '"'
|
85
|
+
end
|
86
|
+
|
87
|
+
# install_prefix
|
88
|
+
if install_prefix != '' && install_prefix !=~ /^\-DCMAKE_INSTALL_PREFIX/
|
89
|
+
install_prefix = '-DTRANSACTD_CLIENTS_PREFIX="' + to_slash_path(install_prefix) + '"'
|
90
|
+
end
|
91
|
+
|
92
|
+
# ruby executable path
|
93
|
+
ruby_executable = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
94
|
+
ruby_executable = '-DTRANSACTD_RUBY_EXECUTABLE_PATH="' + to_slash_path(ruby_executable) + '"'
|
95
|
+
|
96
|
+
# output dir
|
97
|
+
gem_root = '-DTRANSACTD_RUBY_GEM_ROOT_PATH="' + to_slash_path(transactd_gem_root) + '"'
|
98
|
+
|
99
|
+
# cmake
|
100
|
+
cmake_cmd = ['cmake', to_native_path(transactd_gem_root_relative), '-DTRANSACTD_RUBY_GEM=ON',
|
101
|
+
generator, boost, ruby_executable, ruby_library_path, ruby_include_dirs,
|
102
|
+
install_prefix, gem_root, '>> cmake_generate.log'].join(' ')
|
103
|
+
begin
|
104
|
+
f = open('cmake_generate.log', 'w')
|
105
|
+
f.puts cmake_cmd
|
106
|
+
ensure
|
107
|
+
f.close
|
108
|
+
end
|
109
|
+
stdout, stderr, status = Open3.capture3(cmake_cmd)
|
110
|
+
succeed = (status == 0)
|
111
|
+
STDERR.puts stderr if !succeed
|
112
|
+
|
113
|
+
# crete dummy Makefile for Visual Studio .sln
|
114
|
+
if /Visual Studio/ =~ generator
|
115
|
+
FileUtils.copy('../gem/Makefile.win32-VS', './nmake.cmd')
|
116
|
+
begin
|
117
|
+
mkfile_dummy = open('Makefile', 'w')
|
118
|
+
ensure
|
119
|
+
mkfile_dummy.close
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
$makefile_created = true if succeed
|