forked from hanya/RUNO
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
603 lines (470 loc) · 16.8 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
#! /bin/env rake
#
# Copyright 2011 Tsutomu Uchino
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
require 'rbconfig'
require 'rake/packagetask'
require 'rake/clean'
require 'rubygems/package_task'
require 'rubygems'
require 'rdoc/task'
# Build packages.
# Gem file for RPC.
# RubyLoader provides that you can write an UNO component in Ruby.
# RubyScriptProvider is a servicee to execute ruby script as macros.
env_descriptions = <<EOD
OO_SDK_HOME is used to find include files and map file which are part of the SDK.
OO_SDK_URE_HOME is used to find libraries and types.rdb file.
OFFICE_BASE_PROGRAM_PATH is used to offapi.rdb file.
EOD
sdk_home = ENV['OO_SDK_HOME']
ure_home = ENV['OO_SDK_URE_HOME']
base_path = ENV['OFFICE_BASE_PROGRAM_PATH']
# Building environment
c = RbConfig::CONFIG
cc = c['CC']
link = c['LDSHAREDXX']
cxx = c['CXX']
host = c['host']
LIB_EXT = c['DLEXT']
OBJ_EXT = c['OBJEXT']
CPPU_INCLUDE = './include'
CPPUMAKER = 'cppumaker'
CPPUMAKER_FLAG = "#{CPPU_INCLUDE}/flag"
sdk_include = "#{sdk_home}/include"
rubyhdrdir = c['rubyhdrdir']
arch_rubyhdrdir = "#{rubyhdrdir}/#{c['arch']}"
ruby_backward = "#{rubyhdrdir}/ruby/backward"
dldlibs = c['DLDLIBS']
CFLAGS = c['CFLAGS']
cxxflags = CFLAGS + c['CXXFLAGS']
cxxflags.gsub!(/-O\d?/, "")
target = '3.4'
VERSION = '0.2.0'
RD2 = "rd2"
ZIP = "zip"
ZIP_ARGS = "-9"
OXT_EXT = 'oxt'
RD_EXT = 'rd'
# Local directories
SRC_DIR = "./src"
EXT_DIR = "./ext/rubyuno"
LIB_DIR = "./lib"
PKG_DIR = "./pkg"
DOC_DIR = "./doc"
# Definitions for the component loader for Ruby.
LOADER_PKG_NAME = "RubyLoader"
LOADER_PKG_DISPLAY_NAME = "Ruby Loader"
LOADER_PKG_ID = "mytools.loader.Ruby"
LOADER_PKG_DESC = "The UNO component loader written in Ruby."
LOADER_REGISTRATION = "RubyLoader.components"
LOADER_IMPLE_NAME = "mytools.loader.Ruby"
LOADER_SERVICE_NAMES = ["com.sun.star.loader.Ruby"]
LOADER_RB = "rubyloader.rb"
LOADER_PKG_DIR_NAME = "#{LOADER_PKG_NAME}-#{VERSION}"
LOADER_PKG_FULL_NAME = "#{LOADER_PKG_NAME}-#{VERSION}.#{OXT_EXT}"
LOADER_PKG_DIR = "#{PKG_DIR}/#{LOADER_PKG_NAME}-#{VERSION}"
LOADER_PKG = "#{PKG_DIR}/#{LOADER_PKG_FULL_NAME}"
# Definitions for the script provider for Ruby.
SCRIPT_PKG_NAME = "RubyScriptProvider"
SCRIPT_PKG_DISPLAY_NAME = "Ruby Script Provider"
SCRIPT_PACKAGE_ID = "mytools.script.provider.ScriptProviderForRuby"
SCRIPT_REGISTRATION = "ScriptProviderForRuby.components"
SCRIPT_DESC = "The script provider for Ruby."
SCRIPT_IMPLE_NAME = "mytools.script.provider.ScriptProviderForRuby"
SCRIPT_SERVICE_NAMES = [
"com.sun.star.script.provider.ScriptProviderForRuby",
"com.sun.star.script.provider.LanguageScriptProvider"]
SCRIPT_RB = "rubyscriptprovider.rb"
SCRIPT_PKG_DIR_NAME = "#{SCRIPT_PKG_NAME}-#{VERSION}"
SCRIPT_PKG_FULL_NAME = "#{SCRIPT_PKG_NAME}-#{VERSION}.#{OXT_EXT}"
SCRIPT_PKG_DIR = "#{PKG_DIR}/#{SCRIPT_PKG_DIR_NAME}"
SCRIPT_PKG = "#{PKG_DIR}/#{SCRIPT_PKG_FULL_NAME}"
UNO_RB = "rubyuno.rb"
CONNECTOR_RB = "rubyuno/connector.rb"
LIB_RB = "lib.rb"
# Local files
LIB_UNO_DIR = "#{LIB_DIR}/uno"
MODULE_DLL = "runo.#{LIB_EXT}"
ALL_SRCS = FileList["#{EXT_DIR}/*.cxx"]
MODULE_SRCS = FileList["#{EXT_DIR}/module.cxx"]
LOADER_SRCS = FileList["#{EXT_DIR}/loader.cxx"]
LIB_SRCS = FileList["#{EXT_DIR}/*.cxx"] - MODULE_SRCS - LOADER_SRCS
ALL_OBJS = ALL_SRCS.ext(OBJ_EXT)
MODULE_OBJS = MODULE_SRCS.ext(OBJ_EXT)
LOADER_OBJS = LOADER_SRCS.ext(OBJ_EXT)
LIB_OBJS = LIB_SRCS.ext(OBJ_EXT)
RD_DOCS = FileList["#{DOC_DIR}/*.rd"]
HTML_DOCS = RD_DOCS.ext("html")
CLEAN.include(MODULE_OBJS)
CLEAN.include(LOADER_OBJS)
CLEAN.include(LIB_OBJS)
CLEAN.include(HTML_DOCS)
CLEAN.include(PKG_DIR)
CLEAN.include(CPPU_INCLUDE)
directory LIB_DIR
directory PKG_DIR
directory LIB_UNO_DIR
if host.include? 'linux'
# how about 64bit?, Linux_x64
platform = "Linux_x86"
lib_dll = "libruno.#{LIB_EXT}"
loader_dll = "rubyloader.uno.#{LIB_EXT}"
local_link_lib = "-L#{LIB_DIR}"
lib = "-L#{c['libdir']}"
out_flag = "-o"
coutflag = c['COUTFLAG']
optflags = "-O1"
cflags = "-fPIC"
debugflags = ""#c['debugflags']
flags = "#{cflags} #{optflags} #{debugflags} #{cxxflags}"
ruby_defs = c['DEFS']
cc_defs = "-fno-strict-aliasing -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3 " +
" #{ruby_defs}"
incflags = "-I. -I#{arch_rubyhdrdir} -I#{ruby_backward} -I#{rubyhdrdir} " +
"-I#{sdk_include} -I#{CPPU_INCLUDE} "
sdk_lib = "-L#{sdk_home}/lib"
ure_lib = "-L#{ure_home}/lib"
sdk_libs = " -luno_cppuhelpergcc3 -luno_cppu -luno_salhelpergcc3 -luno_sal -lm "
ldflags = c['LDFLAGS']
lib_ldflags = ""
LIB = ""
LIBS = "#{c['LIBS']} #{dldlibs}"
LIBRUBYARG = c['LIBRUBYARG']
runo_libs = "-lruno"
uno_link_flags = "'-Wl,-rpath,$ORIGIN' -Wl,--version-script,#{sdk_home}/settings/component.uno.map"
ure_types = "#{ure_home}/share/misc/types.rdb"
elsif host.include? 'mswin'
platform = "Windows"
link = "link -nologo "
mt = "mt -nologo "
DLL_EXT = 'dll'
lib_dll = "libruno.#{DLL_EXT}"
loader_dll = "rubyloader.uno.#{DLL_EXT}"
out_flag = "/OUT:"
coutflag = "/Fo"
optflags = "/O1"
cflags = "-MD -Zi -EHsc -Zm600 -Zc:forScope,wchar_t-" #-GR
debugflags = ""#c['debugflags']
warnflags = "-wd4251 -wd4275 -wd4290 -wd4675 -wd4786 -wd4800 " +
"-Zc:forScope"
flags = "#{cflags} #{optflags} #{warnflags} #{debugflags}"
ruby_defs = c['DEFS']
cc_defs = "-DWIN32 -DWNT -D_DLL -DCPPU_V=msci -DCPPU_ENV=msci"
incflags = "-I. -I#{arch_rubyhdrdir} -I#{ruby_backward} -I#{rubyhdrdir} " +
"-I#{sdk_include} -I#{CPPU_INCLUDE} "
sdk_lib = "/LIBPATH:#{sdk_home}/lib"
ure_lib = ""
sdk_libs = " icppuhelper.lib icppu.lib isal.lib isalhelper.lib msvcprt.lib msvcrt.lib kernel32.lib" #
module_def = "#{EXT_DIR}/runo.def"
libuno_def = "#{EXT_DIR}/libruno.def"
ldflags = " /DLL /NODEFAULTLIB:library /DEBUGTYPE:cv "
module_ldflags = " #{ldflags} /MAP /DEF:#{module_def} "
lib_ldflags = " #{ldflags} /MAP /DEF:#{libuno_def} "
local_link_lib = "/LIBPATH:#{LIB_DIR}"
LIB = " /LIBPATH:#{c['libdir']} "
LIBS = "#{c['LIBS']} #{dldlibs}"
LIBRUBYARG = c['LIBRUBYARG']
runo_libs = "libruno.lib"
uno_link_flags = "/DEF:#{sdk_home}/settings/component.uno.def"
ure_types = "#{ure_home}/misc/types.rdb"
else
raise "#{host} is not yet supported to build."
end
# Default task
task :default => [:all]
task :all => [
:package,
:loader, :provider
]
# C++ files
rule ".#{OBJ_EXT}" => '.cxx' do |t|
sh "#{cc} #{incflags} #{cc_defs} #{flags} " +
"#{coutflag}#{t.name} -c #{t.source} "
end
# Header from IDL
types = [
"com.sun.star.beans.MethodConcept",
"com.sun.star.beans.PropertyAttribute",
"com.sun.star.beans.XIntrospection",
"com.sun.star.beans.XIntrospectionAccess",
"com.sun.star.beans.XMaterialHolder",
"com.sun.star.container.XEnumerationAccess",
"com.sun.star.container.XHierarchicalNameAccess",
"com.sun.star.container.XIndexContainer",
"com.sun.star.container.XNameContainer",
"com.sun.star.lang.XMultiServiceFactory",
"com.sun.star.lang.XServiceInfo",
"com.sun.star.lang.XSingleComponentFactory",
"com.sun.star.lang.XSingleServiceFactory",
"com.sun.star.lang.XTypeProvider",
"com.sun.star.lang.XUnoTunnel",
"com.sun.star.reflection.InvocationTargetException",
"com.sun.star.reflection.ParamMode",
"com.sun.star.reflection.XConstantTypeDescription",
"com.sun.star.reflection.XConstantsTypeDescription",
"com.sun.star.reflection.XEnumTypeDescription",
"com.sun.star.reflection.XIdlReflection",
"com.sun.star.reflection.XInterfaceTypeDescription2",
"com.sun.star.reflection.XTypeDescription",
"com.sun.star.registry.XRegistryKey",
"com.sun.star.script.InvocationInfo",
"com.sun.star.script.MemberType",
"com.sun.star.script.XInvocation2",
"com.sun.star.script.XInvocationAdapterFactory2",
"com.sun.star.script.XTypeConverter",
"com.sun.star.script.provider.ScriptFrameworkErrorException",
"com.sun.star.uno.XAggregation",
"com.sun.star.uno.TypeClass",
"com.sun.star.uno.XComponentContext",
"com.sun.star.uno.XWeak",
]
desc "generate headers"
task :header do
unless File.exists?(CPPUMAKER_FLAG)
puts "flag for cppumaker does not exist. starting cppumaker..."
office_types = "#{base_path}/offapi.rdb"
sh "#{CPPUMAKER} -Gc -BUCR -O#{CPPU_INCLUDE} -T\"#{types.join(';')}\" \"#{ure_types}\" \"#{office_types}\""
sh "echo > #{CPPUMAKER_FLAG}"
end
end
# Gem
GEM_LIB_UNO_RB = "#{LIB_DIR}/#{UNO_RB}"
GEM_LIB_RUNO_MODULE = "#{LIB_UNO_DIR}/#{MODULE_DLL}"
task :package => [:header, GEM_LIB_UNO_RB, GEM_LIB_RUNO_MODULE]
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.required_ruby_version = c['RUBY_PROGRAM_VERSION']
s.summary = "Ruby-UNO native bridge."
s.name = "rubyuno"
s.version = VERSION
s.requirements << 'none'
s.author = "hanya"
s.email = "hanya.runo@gmail.com"
s.homepage = "https://github.com/hanya/RUNO"
s.files = [
GEM_LIB_UNO_RB,
GEM_LIB_RUNO_MODULE
]
s.extra_rdoc_files = FileList["#{DOC_DIR}/*.#{RD_EXT}"]
s.description = <<EOF
RubyUNO is native bridge between Ruby and UNO.
EOF
end
Gem::PackageTask.new(spec) do |t|
end
file GEM_LIB_UNO_RB => [LIB_DIR] do |t|
uno = IO.read("#{LIB_DIR}/#{UNO_RB}")
connector = IO.read("#{LIB_DIR}/#{CONNECTOR_RB}")
uno.sub!(/#require 'uno\/runo.so'/, "require 'uno/runo.so'")
open("#{LIB_DIR}/#{UNO_RB}", "w") do |f|
f.write uno
f.write connector
f.flush
end
end
desc "runo.so for RPC connection."
file GEM_LIB_RUNO_MODULE => [LIB_UNO_DIR, *ALL_OBJS] do |t|
puts "building ./lib/uno/runo.so"
sh "#{link} #{out_flag}#{t.name} #{ALL_OBJS.join(' ')} " +
" #{LIB} #{module_ldflags} " +
" #{sdk_lib} #{ure_lib}" +
" #{sdk_libs} #{LIBRUBYARG} #{LIBS} "
if host.include? 'mswin'
sh "#{mt} -manifest #{t.name}.manifest -outputresource:#{t.name};2"
end
end
# Templates for OXT file
TEMPLATE_MANIFEST = <<EOD
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest>
<manifest:file-entry manifest:full-path="${LOADER}" manifest:media-type="${MEDIA_TYPE}"/>
</manifest:manifest>
EOD
TEMPLATE_COMPONENTS = <<EOD
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://openoffice.org/2010/uno-components">
<component loader="${LOADER_NAME}" uri="${URI}">
<implementation name="${IMPLE_NAME}">
${SERVICES}
</implementation>
</component>
</components>
EOD
TEMPLATE_DESCRIPTION = <<EOD
<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:d="http://openoffice.org/extensions/description/2006">
<identifier value="${ID}"/>
<version value="${VERSION}"/>
<dependencies>
<OpenOffice.org-minimal-version value="${TARGET}" d:name="OpenOffice.org ${TARGET}"/>
</dependencies>
<!--
<registration>
<simple-license accept-by="admin" default-license-id="this" suppress-on-update="true">
<license-text xlink:href="LICENSE" license-id="this"/>
</simple-license>
</registration>
-->
<display-name>
<name lang="en">${DISPLAY_NAME}</name>
</display-name>
<extension-description>
<src lang="en" xlink:href="descriptions/desc.en"/>
</extension-description>
</description>
EOD
# procedures depends on templates
# Creates description.xml
def description_task(dir_path, id, target, display_name)
description_file = "#{dir_path}/description.xml"
data = String.new TEMPLATE_DESCRIPTION
data.gsub!(/\$\{ID\}/, id)
data.gsub!(/\$\{VERSION\}/, VERSION)
data.gsub!(/\$\{TARGET\}/, target)
data.gsub!(/\$\{DISPLAY_NAME\}/, display_name)
open(description_file, "w") do |f|
f.write(data)
f.flush
end
end
# Creates META-INF/manifest.xml
def manifest_task(dir_path, full_path, media_type)
manifest_file = "#{dir_path}/META-INF/manifest.xml"
manifest_dir = File.dirname(manifest_file)
mkdir_p manifest_dir unless File.exist?(manifest_dir)
data = String.new TEMPLATE_MANIFEST
data.gsub!(/\$\{LOADER\}/, full_path)
data.gsub!(/\$\{MEDIA_TYPE\}/, media_type)
open(manifest_file, "w") do |f|
f.write(data)
f.flush
end
end
def registration_task(dir_path, file_name, loader_name, uri, imple_name, services)
puts "registration"
components_f = "#{dir_path}/lib/#{file_name}"
data = String.new TEMPLATE_COMPONENTS
data.gsub!(/\$\{LOADER_NAME\}/, loader_name)
data.gsub!(/\$\{URI\}/, uri)
data.gsub!(/\$\{IMPLE_NAME\}/, imple_name)
services.map! do |name|
"<service name=\"#{name}\"/>"
end
data.gsub!(/\$\{SERVICES\}/, services.join("\n"))
open(components_f, "w") do |f|
f.write(data)
f.flush
end
end
# Creates description/desc.en
def extension_description_task(dir_path, desc)
path = "#{dir_path}/descriptions/desc.en"
desc_dir = File.dirname(path)
mkdir_p desc_dir unless File.exist?(desc_dir)
open(path, "w") do |f|
f.write(desc)
f.flush
end
end
# Pack as zip archive
def packaging_task(dir_path, pkg_name)
chdir dir_path do
sh "#{ZIP} -9 -r -o ../#{pkg_name} * **/*"
end
end
# Package of RubyLoader
task :loader => [:header, LOADER_PKG]
LOADER_PKG_DIR_LIB = "#{LOADER_PKG_DIR}/lib"
LOADER_LIB_RUNO_DLL = "#{LIB_DIR}/#{lib_dll}"
LOADER_MODULE_DLL = "#{LIB_DIR}/#{MODULE_DLL}"
LOADER_LIB_DLL = "#{LIB_DIR}/#{loader_dll}"
directory LOADER_PKG_DIR
directory LOADER_PKG_DIR_LIB
desc "create libruno library"
file LOADER_LIB_RUNO_DLL => [LIB_DIR, *LIB_OBJS] do |t|
sh "#{link} #{out_flag}#{t.name} #{LIB_OBJS.join(' ')} " +
" #{LIB} #{lib_ldflags} " +
" #{sdk_lib} #{ure_lib}" +
" #{sdk_libs} #{LIBRUBYARG} #{LIBS} "
if host.include? 'mswin'
sh "#{mt} -manifest #{t.name}.manifest -outputresource:#{t.name};2"
end
end
desc "runo.so for RubyLoader."
file LOADER_MODULE_DLL => [LIB_DIR, *MODULE_OBJS, "#{LIB_DIR}/#{lib_dll}"] do |t|
p "building runo.so"
sh "#{link} #{out_flag}#{LIB_DIR}/#{MODULE_DLL} #{MODULE_OBJS.join(' ')} " +
" #{LIB} #{local_link_lib} #{module_ldflags} " +
" #{sdk_lib} #{ure_lib}" +
" #{sdk_libs} #{LIBRUBYARG} #{LIBS} #{runo_libs}"
if host.include? 'mswin'
sh "#{mt} -manifest #{t.name}.manifest -outputresource:#{t.name};2"
end
end
desc "create loader component"
file LOADER_LIB_DLL => [LIB_DIR, *LOADER_OBJS] do |t|
p "building loader"
sh "#{link} #{out_flag}#{LIB_DIR}/#{loader_dll} #{LOADER_OBJS.join(' ')} " +
" #{LIB} #{local_link_lib} #{ldflags} #{uno_link_flags}" +
" #{sdk_lib} #{ure_lib}" +
" #{sdk_libs} #{LIBRUBYARG} #{LIBS} #{runo_libs} "
if host.include? 'mswin'
sh "#{mt} -manifest #{t.name}.manifest -outputresource:#{t.name};2"
end
end
file LOADER_PKG => [LOADER_PKG_DIR, "#{LOADER_PKG_DIR}/lib", LOADER_LIB_RUNO_DLL, LOADER_MODULE_DLL, LOADER_LIB_DLL] do |t|
dir_path = t.name.sub(/.oxt$/, "")
media_type = "application/vnd.sun.star.uno-components;platform=#{platform}"
"#{LIB_DIR}/#{loader_dll}"
full_path = "lib/#{LOADER_REGISTRATION}"
registration_task(dir_path, LOADER_REGISTRATION,
"com.sun.star.loader.SharedLibrary", loader_dll,
LOADER_IMPLE_NAME, LOADER_SERVICE_NAMES)
manifest_task(dir_path, full_path, media_type)
description_task(dir_path, LOADER_PKG_ID, target, LOADER_PKG_DISPLAY_NAME)
extension_description_task(dir_path, LOADER_PKG_DESC)
cp "#{LOADER_LIB_RUNO_DLL}", "#{LOADER_PKG_DIR_LIB}/#{lib_dll}"
cp "#{LOADER_MODULE_DLL}", "#{LOADER_PKG_DIR_LIB}/#{MODULE_DLL}"
cp "#{LOADER_LIB_DLL}", "#{LOADER_PKG_DIR_LIB}/#{loader_dll}"
cp "#{LIB_DIR}/#{LOADER_RB}", "#{LOADER_PKG_DIR_LIB}/#{LOADER_RB}"
cp "#{LIB_DIR}/#{UNO_RB}", "#{LOADER_PKG_DIR_LIB}/#{LIB_RB}"
packaging_task dir_path, File.basename(t.name)
end
# Package of RubyScriptProvider
task :provider => [SCRIPT_PKG]
SCRIPT_PKG_DIR_LIB = "#{SCRIPT_PKG_DIR}/lib"
directory SCRIPT_PKG_DIR
directory SCRIPT_PKG_DIR_LIB
file SCRIPT_PKG => [SCRIPT_PKG_DIR, SCRIPT_PKG_DIR_LIB] do |t|
dir_path = t.name.sub(/.oxt$/, "")
media_type = "application/vnd.sun.star.uno-components"
registration_task(dir_path, SCRIPT_REGISTRATION,
"com.sun.star.loader.Ruby", SCRIPT_RB,
SCRIPT_IMPLE_NAME, SCRIPT_SERVICE_NAMES)
manifest_task(dir_path, "lib/#{SCRIPT_REGISTRATION}", media_type)
description_task(dir_path, SCRIPT_PACKAGE_ID, target, SCRIPT_PKG_DISPLAY_NAME)
extension_description_task(dir_path, SCRIPT_DESC)
cp "#{LIB_DIR}/#{SCRIPT_RB}", "#{SCRIPT_PKG_DIR_LIB}/#{SCRIPT_RB}"
packaging_task dir_path, File.basename(t.name)
end
# Documents
rule '.html' => '.rd' do |t|
sh "#{RD2} #{t.source} > #{t.name}"
end
task :rd_docs => [*HTML_DOCS]