-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall
More file actions
executable file
·135 lines (111 loc) · 3.71 KB
/
Install
File metadata and controls
executable file
·135 lines (111 loc) · 3.71 KB
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
#!/usr/bin/env ruby
# Copyright 2006-2009 by Starling Software, K.K.
# This is part of QAM from http://www.starling-software.com.
# For license terms, see the LICENSE.QAM file included with this distribution.
require 'fileutils'
require 'rbconfig'
#
# Bootstrap phase
#
def thisdir(path = '')
File.expand_path(__FILE__ + '/../') + '/' + path
end
def install_installer
qamlibdir = thisdir('release/lib/ruby/site_ruby/') +
RbConfig::CONFIG['ruby_version'] + '/qam'
FileUtils.mkdir_p(qamlibdir)
FileUtils.cp(thisdir('src/qam/qam.rb'), thisdir('release/'))
FileUtils.cp(thisdir('src/qam/lib/qam/ruby_extensions.rb'), qamlibdir)
FileUtils.cp(thisdir('src/qam/lib/qam/install.rb'), qamlibdir)
end
install_installer
require File.expand_path(__FILE__ + '/../release/qam')
require 'qam/install'
I = QAM::Install.new; D = I.dirs
opts = QAM::InstallOptions.new
# NOTE: We run install_installer here solely because the later invocation
# of src/qam/Install cannot install qam.rb by itself, as it needs it, being
# a separate install script. If it were "run" from within this process; we
# wouldn't need to worry about it, not to mention the duplicate install of
# src/qam/lib.
opts.full_clean && (I.full_clean; install_installer)
opts.semiclean && (I.semiclean; install_installer)
opts.sticky_changed && (I.semiclean; install_installer)
opts.write_sticky
I.install_tree(D.base('src/qam/lib'), D.rubylib_site, :matching => /\.rb$/)
I.run_quiet_install(D.base('src/qam/Install'))
opts.bootstrap_only && exit
#
# extsrc
#
I.run_install(D.base('extsrc'), :message => "===== Installing extsrc")
#
# src
#
def match(regexp, install_script)
regexp.match(File.basename(File.dirname(install_script)))
end
class InstallScript
initialize_vars :component, :opts
def build
QAM::Install.new.run_quiet_install(component + '/Install')
end
end
components = opts.components_matching(
Dir[D.base('src/*')].collect { |path| path.sub(D.base + '/', '') })
prereq = []; dbs = []; libs = []; others = []; package = []; already_done = [];
components.each { |component|
install_script = D.base(component, 'Install')
next unless File.exist?(install_script)
group = case
when match(/^qam$/, install_script) then already_done
when match(/^qweb$/, install_script) then prereq
when match(/^db/, install_script) then dbs
when match(/^package/, install_script) then package
when File.directory?(File.dirname(install_script) + '/lib') then libs
else others
end
group << install_script
}
(prereq + dbs + libs + others + package).each { |install_script|
I.run_quiet_install(install_script)
}
#
# components from src
#
require 'qam/build'
components.each { |component|
path = D.base(component, 'QBuilder')
next unless File.exist?(path)
$quiet || puts("----- Building src #{component}")
prev = QAM::Build.constants
load path
classnames = QAM::Build.constants - prev
classnames.
collect { |name| QAM::Build.const_get(name).new(component, opts) }.
each { |builder| builder.build }
# XXX above should be quiet unless opts.partial_build
}
#
# Java
#
components.each { |component|
build_xml = D.base(component, 'build.xml')
next unless File.exist?(build_xml)
$quiet || puts("----- Building #{component}/build.xml")
name = File.basename(component)
ant = D.release('java/ant/bin/ant')
props = [
' -Dbase=', D.base,
' -Dsrc=', D.base('src', name),
' -Dbuild=', D.base('build/src', name),
' -Drelease=', D.release,
' -Djavalib=', D.release('java/lib'),
' -Dname=', name,
]
(m = /^server\.(.*)/.match(name)) && props += [
' -Dserver=', m[1],
' -Dserver_data=', D.release('libdata/server', m[1]),
]
I.run_or_fail("#{ant} -q -buildfile #{build_xml} #{props.join}")
}