Created
August 15, 2013 11:34
-
-
Save esetomo/6240162 to your computer and use it in GitHub Desktop.
SecondLife Viewerコンパイル用。CP932でエラーになる部分の修正とか。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby; encoding: utf-8 -*- | |
require 'albacore' | |
require 'win32/shortcut' | |
task :default => :shortcut | |
BUILD_DIR='viewer-local' | |
ENV['LANG'] = 'C' | |
ENV['AUTOBUILD_CONFIGURATION'] = 'RelWithDebInfoOS' | |
ENV['AUTOBUILD_VSVER'] = '100' | |
ENV['AUTOBUILD_CONFIG_FILE'] = 'my_autobuild.xml' | |
if ENV['TMP'] && ENV['tmp'] | |
ENV['TMP'] = ENV['tmp'] | |
ENV.delete('tmp') | |
end | |
if ENV['TEMP'] && ENV['temp'] | |
ENV['TEMP'] = ENV['temp'] | |
ENV.delete('temp') | |
end | |
task :clone => BUILD_DIR | |
file BUILD_DIR do |t| | |
system("hg clone viewer-release #{BUILD_DIR}") | |
end | |
task :configure => "#{BUILD_DIR}/build-vc100/SecondLife.sln" | |
file "#{BUILD_DIR}/#{ENV['AUTOBUILD_CONFIG_FILE']}" => :clone do |t| | |
chdir(BUILD_DIR) do | |
cp 'autobuild.xml', ENV['AUTOBUILD_CONFIG_FILE'] | |
end | |
end | |
file "#{BUILD_DIR}/build-vc100/SecondLife.sln" => | |
"#{BUILD_DIR}/#{ENV['AUTOBUILD_CONFIG_FILE']}" do |t| | |
chdir(BUILD_DIR) do | |
system("autobuild configure") | |
end | |
end | |
def add_bom(file) | |
text = File.read(file) | |
return if text[0] == "\ufeff" | |
print "add bom: #{file}\n" | |
File.write(file, "\ufeff" + text) | |
end | |
def fix_space(file) | |
text = File.read(file) | |
print "fix space: #{file}\n" | |
# nbsp (not in cp932) -> ascii space | |
text = text.gsub(/\u00a0/, "\u0020") | |
File.write(file, text) | |
end | |
def fix_quote(file) | |
text = File.read(file) | |
print "fix quote: #{file}\n" | |
# utf-8 quotes -> ascii quote | |
text = text.gsub(/\u201c/, "\"").gsub(/\u201d/, "\"") | |
text = text.gsub(/\u2018/, "\'").gsub(/\u2019/, "\'") | |
# utf-8 'EN DASH' -> ascii dash | |
text = text.gsub(/\u2013/, "-") | |
File.write(file, text) | |
end | |
def fix_latin1_quote(file) | |
text = File.binread(file) | |
print "fix latin1 quote: #{file}\n" | |
# laten1 quotes -> ascii quote | |
text = text.gsub(/\x93/n, "\"").gsub(/\x94/n, "\"") | |
File.binwrite(file, text) | |
end | |
task :prepare => [:configure, "#{BUILD_DIR}/build-vc100/newview/secondlife-bin.vcxproj.user"] do |t| | |
fix_space("#{BUILD_DIR}/build-vc100/packages/include/boost/type_traits/detail/has_binary_operator.hpp") | |
fix_latin1_quote("#{BUILD_DIR}/indra/llmath/llvolume.cpp") | |
Dir.glob("#{BUILD_DIR}/build-vc100/packages/include/collada/**/*.h") do |file| | |
fix_quote(file) | |
end | |
add_bom("#{BUILD_DIR}/indra/newview/tests/lltranslate_test.cpp") | |
end | |
msbuild :compile => :prepare do |msb| | |
msb.solution = "#{BUILD_DIR}/build-vc100/SecondLife.sln" | |
msb.targets = ['secondlife-bin'] | |
msb.properties = { :Configuration => 'RelWithDebInfo' } | |
end | |
file "#{BUILD_DIR}/build-vc100/newview/secondlife-bin.vcxproj.user" => :configure do |t| | |
open(t.name, "w") do |w| | |
w.write("\ufeff") | |
w.write(<<'EOD') | |
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<LocalDebuggerWorkingDirectory>..\..\indra\newview</LocalDebuggerWorkingDirectory> | |
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | |
</PropertyGroup> | |
</Project> | |
EOD | |
end | |
end | |
task :shortcut => "#{BUILD_DIR}/build-vc100/newview/RelWithDebInfo/secondlife-bin.lnk" | |
file "#{BUILD_DIR}/build-vc100/newview/RelWithDebInfo/secondlife-bin.lnk" => :compile do |t| | |
Win32::Shortcut.new(t.name) do |s| | |
s.path = File.expand_path(t.name.gsub(/\.lnk$/, '.exe')) | |
s.show_cmd = Win32::Shortcut::SHOWNORMAL | |
s.working_directory = File.expand_path("#{BUILD_DIR}/indra/newview") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment