/[pcsx2_0.9.7]/trunk/build.rb
ViewVC logotype

Contents of /trunk/build.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 2 months ago) by william
File size: 4491 byte(s)
committing r3113 initial commit again...
1 #!/usr/bin/env ruby
2
3 # Usage: ruby build.rb [option] [pcsx2, plugins, <plugin name>] [dev,debug,release] [all, install, clean]
4 # If you don't specify pcsx2, plugins, or a plugin name, it will assume you want to rebuild everything.
5 # If you don't specify dev or debug, it assumes a release build.
6 # If it isn't all, install, or clean, it assumes install.
7
8 # If you want other options, add them to $pcsx2_build_types. This is still a work in progress...
9 # --arcum42
10
11 require "fileutils.rb"
12 include FileUtils
13
14 $main_dir = Dir.pwd
15 $pcsx2_install_dir = "#{$main_dir}/bin"
16 $plugin_install_dir = "#{$main_dir}/bin/plugins"
17
18 $pcsx2_dir = "#{$main_dir}/pcsx2"
19 $plugins_dir = "#{$main_dir}/plugins"
20
21 $pcsx2_prefix = " --prefix #{$main_dir}"
22 $plugins_prefix = " --prefix #{$plugin_install_dir}"
23
24 $plugin_list=["CDVDnull", "dev9null", "FWnull", "USBnull", "SPU2null", "zerogs", "zzogl", "zeropad", "zerospu2", "PeopsSPU2", "CDVDiso", "CDVDisoEFP", "CDVDlinuz"]
25 $full_plugin_list=["CDVDnull", "dev9null", "FWnull", "USBnull", "SPU2null", "zerogs", "zzogl", "zeropad", "zerospu2", "PeopsSPU2", "CDVDiso", "CDVDisoEFP", "CDVDlinuz","GSnull","PadNull","onepad"]
26
27 $pcsx2_build_types = {
28 "dev" => " --enable-devbuild ",
29 "debug" => " --enable-debug ",
30 "release" => " "
31 }
32
33 $pcsx2_release_params=["dev","debug","release"]
34 $make_params=["all", "clean","install"]
35
36 $build_report =""
37 $build_counter = 0
38
39 def plugin_src_dir(plugin_name)
40 name = "#{$plugins_dir}/#{plugin_name}/"
41 case plugin_name
42 when "CDVDiso" then
43 name += "src"
44 when "CDVDisoEFP" then
45 name += "src/Linux"
46 when "CDVDlinuz"
47 name += "Src/Linux"
48 when "zerogs", "zzogl"
49 name += "opengl"
50 end
51
52 return name
53 end
54
55 def announce(my_program)
56 print "---------------\n"
57 print "Building #{my_program}\n"
58 print "---------------\n"
59 end
60
61 def make(options)
62 system("make #{options}")
63 ($? == 0)
64 end
65
66 def rebuild(options)
67 system("aclocal")
68 system("automake")
69 system("autoconf")
70 system("chmod +x configure")
71 system("./configure #{options}")
72 make "clean"
73 end
74
75 def install(build_name)
76 ret = make "install"
77
78 case build_name
79 # If the package isn't inclined to obey simple instructions...
80 when "CDVDisoEFP" then
81 system("cp #{plugin_src_dir(build_name)}/cfgCDVDisoEFP #{$plugin_install_dir}")
82 system("cp #{plugin_src_dir(build_name)}/libCDVDisoEFP.so #{$plugin_install_dir}")
83 when "CDVDlinuz" then
84 system("cp #{plugin_src_dir(build_name)}/cfgCDVDlinuz #{$plugin_install_dir}")
85 system("cp #{plugin_src_dir(build_name)}/libCDVDlinuz.so #{$plugin_install_dir}")
86 when "PeopsSPU2" then
87 system("cp #{plugin_src_dir(build_name)}/libspu2Peops*.so* #{$plugin_install_dir}")
88
89 # Copy the shaders over. Shouldn't the makefile do this?
90 when "zzogl","zerogs" then
91 system("cp #{plugin_src_dir(build_name)}/Win32/ps2hw.dat #{$plugin_install_dir}")
92
93 #And while we have the opportunity...
94 when "pcsx2" then
95 svn_revision = `svn info | grep Revision:`
96 svn_revision = /[0-9]+/.match(svn_revision)
97 system("cp #{$pcsx2_install_dir}/pcsx2 #{$pcsx2_install_dir}/pcsx2-#{svn_revision}")
98 end
99
100 ret
101 end
102
103 def build(build_name, make_parameter)
104 completed = true
105
106 announce "#{build_name.capitalize}"
107
108 if build_name != "pcsx2" then
109 build_dir = plugin_src_dir(build_name)
110 else
111 build_dir = "#{$pcsx2_dir}"
112 end
113
114 Dir.chdir build_dir
115
116 case make_parameter
117 when "all" then
118 if build_name == "pcsx2"
119 rebuild($pcsx2_prefix)
120 else
121 rebuild($plugins_prefix)
122 end
123 completed = install(build_name)
124
125 when "clean" then
126 make "clean"
127
128 else
129 completed = install(build_name)
130 end
131
132 Dir.chdir $main_dir
133
134 if completed then
135 $build_report += "#{build_name} was built successfully.\n"
136 $build_counter += 1
137 else
138 $build_report += "#{build_name} was not built successfully.\n"
139 end
140
141 end
142
143 build_parameter = "all"
144 make_parameter = ""
145 build_items = Array.new([])
146
147 ARGV.each do |x|
148 make_parameter = x if $make_params.include?(x)
149
150 build_items.push(x) if $full_plugin_list.include?(x) or (x == "pcsx2")
151 $pcsx2_prefix = $pcsx2_build_types[x] + $pcsx2_prefix if $pcsx2_release_params.include?(x)
152
153 if (x == "plugins") then
154 x = $plugin_list
155 build_items.push(x)
156 end
157 end
158
159 if build_items.empty? then
160 build_items.push($plugin_list)
161 build_items.push("pcsx2")
162 end
163
164 build_items.flatten!
165
166 build_items.each do |x|
167 build(x,make_parameter)
168 end
169
170 print "\n--\n"
171 print "Build Summary:\n"
172 print $build_report
173 print "\n"
174 print "#{$build_counter}/#{build_items.count} Successful.\n"

  ViewVC Help
Powered by ViewVC 1.1.22