aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2010-12-21 20:31:45 -0200
committerHisham Muhammad <hisham@gobolinux.org>2010-12-21 20:31:45 -0200
commit63c05bee71f4aa90a08ec88c4836cae022e3a878 (patch)
tree1aeb61832c008fa43758b6fd8e0f5383520bbcd0
parenta90a0d3ec2783df75343d366d4b52e586b42f6e6 (diff)
downloadluarocks-63c05bee71f4aa90a08ec88c4836cae022e3a878.tar.gz
luarocks-63c05bee71f4aa90a08ec88c4836cae022e3a878.tar.bz2
luarocks-63c05bee71f4aa90a08ec88c4836cae022e3a878.zip
indentation fixes
-rw-r--r--src/luarocks/build/builtin.lua104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua
index 7c24340e..7b550bff 100644
--- a/src/luarocks/build/builtin.lua
+++ b/src/luarocks/build/builtin.lua
@@ -19,25 +19,25 @@ end
19--- Makes an RC file with an embedded Lua script, for building .exes on Windows 19--- Makes an RC file with an embedded Lua script, for building .exes on Windows
20-- @return nil if could open files, error otherwise 20-- @return nil if could open files, error otherwise
21local function make_rc(luafilename, rcfilename) 21local function make_rc(luafilename, rcfilename)
22 local rcfile = io.open(rcfilename, "w") 22 local rcfile = io.open(rcfilename, "w")
23 if not rcfile then 23 if not rcfile then
24 error("Could not open "..rcfilename.." for writing.") 24 error("Could not open "..rcfilename.." for writing.")
25 end 25 end
26 rcfile:write("STRINGTABLE\r\nBEGIN\r\n") 26 rcfile:write("STRINGTABLE\r\nBEGIN\r\n")
27 27
28 local i = 1 28 local i = 1
29 for line in io.lines(luafilename) do 29 for line in io.lines(luafilename) do
30 if not line:match("^#!") then 30 if not line:match("^#!") then
31 rcfile:write(i .. " \"") 31 rcfile:write(i .. " \"")
32 line = line:gsub("\\", "\\\\"):gsub('"', '""'):gsub("[\r\n]+", "") 32 line = line:gsub("\\", "\\\\"):gsub('"', '""'):gsub("[\r\n]+", "")
33 rcfile:write(line .. "\\r\\n\"\r\n") 33 rcfile:write(line .. "\\r\\n\"\r\n")
34 i = i + 1 34 i = i + 1
35 end 35 end
36 end 36 end
37 37
38 rcfile:write("END\r\n") 38 rcfile:write("END\r\n")
39 39
40 rcfile:close() 40 rcfile:close()
41end 41end
42 42
43--- Driver function for the builtin build back-end. 43--- Driver function for the builtin build back-end.
@@ -74,23 +74,23 @@ function run(rockspec)
74 local extras = { unpack(objects) } 74 local extras = { unpack(objects) }
75 add_flags(extras, "-L%s", libdirs) 75 add_flags(extras, "-L%s", libdirs)
76 add_flags(extras, "%s.lib", libraries) 76 add_flags(extras, "%s.lib", libraries)
77 extras[#extras+1] = dir.path(variables.LUA_LIBDIR, "lua5.1.lib") 77 extras[#extras+1] = dir.path(variables.LUA_LIBDIR, "lua5.1.lib")
78 extras[#extras+1] = "-l" .. (variables.MSVCRT or "msvcr80") 78 extras[#extras+1] = "-l" .. (variables.MSVCRT or "msvcr80")
79 local ok = execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras)) 79 local ok = execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras))
80 return ok 80 return ok
81 end 81 end
82 compile_wrapper_binary = function(fullname, name) 82 compile_wrapper_binary = function(fullname, name)
83 local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") 83 local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\")
84 local basename = name:gsub("%.lua$", ""):gsub("/", "\\") 84 local basename = name:gsub("%.lua$", ""):gsub("/", "\\")
85 local rcname = basename..".rc" 85 local rcname = basename..".rc"
86 local resname = basename..".o" 86 local resname = basename..".o"
87 local wrapname = basename..".exe" 87 local wrapname = basename..".exe"
88 make_rc(fullname, fullbasename..".rc") 88 make_rc(fullname, fullbasename..".rc")
89 local ok = execute(variables.RC, "-o", resname, rcname) 89 local ok = execute(variables.RC, "-o", resname, rcname)
90 if not ok then return ok end 90 if not ok then return ok end
91 ok = execute(variables.LD, "-o", wrapname, resname, variables.WRAPPER, 91 ok = execute(variables.LD, "-o", wrapname, resname, variables.WRAPPER,
92 dir.path(variables.LUA_LIBDIR, "lua5.1.lib"), "-l" .. (variables.MSVCRT or "msvcr80"), "-luser32") 92 dir.path(variables.LUA_LIBDIR, "lua5.1.lib"), "-l" .. (variables.MSVCRT or "msvcr80"), "-luser32")
93 return ok, wrapname 93 return ok, wrapname
94 end 94 end
95 elseif cfg.is_platform("win32") then 95 elseif cfg.is_platform("win32") then
96 compile_object = function(object, source, defines, incdirs) 96 compile_object = function(object, source, defines, incdirs)
@@ -117,21 +117,21 @@ function run(rockspec)
117 return ok 117 return ok
118 end 118 end
119 compile_wrapper_binary = function(fullname, name) 119 compile_wrapper_binary = function(fullname, name)
120 local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") 120 local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\")
121 local basename = name:gsub("%.lua$", ""):gsub("/", "\\") 121 local basename = name:gsub("%.lua$", ""):gsub("/", "\\")
122 local rcname = basename..".rc" 122 local rcname = basename..".rc"
123 local resname = basename..".res" 123 local resname = basename..".res"
124 local wrapname = basename..".exe" 124 local wrapname = basename..".exe"
125 make_rc(fullname, fullbasename..".rc") 125 make_rc(fullname, fullbasename..".rc")
126 local ok = execute(variables.RC, "-r", "-fo"..resname, rcname) 126 local ok = execute(variables.RC, "-r", "-fo"..resname, rcname)
127 if not ok then return ok end 127 if not ok then return ok end
128 ok = execute(variables.LD, "-out:"..wrapname, resname, variables.WRAPPER, 128 ok = execute(variables.LD, "-out:"..wrapname, resname, variables.WRAPPER,
129 dir.path(variables.LUA_LIBDIR, "lua5.1.lib"), "user32.lib") 129 dir.path(variables.LUA_LIBDIR, "lua5.1.lib"), "user32.lib")
130 local manifestfile = wrapname..".manifest" 130 local manifestfile = wrapname..".manifest"
131 if ok and fs.exists(manifestfile) then 131 if ok and fs.exists(manifestfile) then
132 ok = execute(variables.MT, "-manifest", manifestfile, "-outputresource:"..wrapname..";1") 132 ok = execute(variables.MT, "-manifest", manifestfile, "-outputresource:"..wrapname..";1")
133 end 133 end
134 return ok, wrapname 134 return ok, wrapname
135 end 135 end
136 else 136 else
137 compile_object = function(object, source, defines, incdirs) 137 compile_object = function(object, source, defines, incdirs)
@@ -168,16 +168,16 @@ function run(rockspec)
168 local basename = name:gsub("%.lua$", "") 168 local basename = name:gsub("%.lua$", "")
169 local file 169 local file
170 if not match then 170 if not match then
171 file = io.open(fullname) 171 file = io.open(fullname)
172 end 172 end
173 if match or (file and file:read():match("#!.*lua.*")) then 173 if match or (file and file:read():match("#!.*lua.*")) then
174 ok, name = compile_wrapper_binary(fullname, name) 174 ok, name = compile_wrapper_binary(fullname, name)
175 if ok then 175 if ok then
176 build.install.bin[i] = name 176 build.install.bin[i] = name
177 else 177 else
178 if file then file:close() end 178 if file then file:close() end
179 return nil, "Build error in wrapper binaries" 179 return nil, "Build error in wrapper binaries"
180 end 180 end
181 end 181 end
182 if file then file:close() end 182 if file then file:close() end
183 end 183 end