aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Mascarenhas <mascarenhas@lambda-2.local>2010-01-22 14:57:23 -0200
committerFabio Mascarenhas <mascarenhas@lambda-2.local>2010-01-22 14:57:23 -0200
commitacb4296d3cdd3b5017c3c39e04ecc12c55e49ed5 (patch)
tree7d06a5af831c31927d1a13597cf79029976002df
parent47fea74335776d0d05de6225fcb3a8baa33e7f01 (diff)
downloadluarocks-acb4296d3cdd3b5017c3c39e04ecc12c55e49ed5.tar.gz
luarocks-acb4296d3cdd3b5017c3c39e04ecc12c55e49ed5.tar.bz2
luarocks-acb4296d3cdd3b5017c3c39e04ecc12c55e49ed5.zip
mingw as build system
-rw-r--r--install.bat24
-rw-r--r--src/luarocks/build/builtin.lua9
-rw-r--r--src/luarocks/cfg.lua14
3 files changed, 30 insertions, 17 deletions
diff --git a/install.bat b/install.bat
index 5644fa2a..09d96b8c 100644
--- a/install.bat
+++ b/install.bat
@@ -31,9 +31,9 @@ IF [%1]==[/?] (
31 ECHO /P [dir] Where to install. 31 ECHO /P [dir] Where to install.
32 ECHO Default is %PREFIX% 32 ECHO Default is %PREFIX%
33 ECHO /CONFIG [dir] Location where the config file should be installed. 33 ECHO /CONFIG [dir] Location where the config file should be installed.
34 ECHO Default is %SYSCONFDIR% 34 ECHO Default is same place of installation
35 ECHO /TREE [dir] Root of the local tree of installed rocks. 35 ECHO /TREE [dir] Root of the local tree of installed rocks.
36 ECHO Default is %ROCKS_TREE% 36 ECHO Default is same place of installation
37 ECHO /SCRIPTS [dir] Where to install scripts installed by rocks. 37 ECHO /SCRIPTS [dir] Where to install scripts installed by rocks.
38 ECHO Default is TREE/bin. 38 ECHO Default is TREE/bin.
39 ECHO. 39 ECHO.
@@ -56,6 +56,8 @@ IF [%1]==[/?] (
56) 56)
57IF /I [%1]==[/P] ( 57IF /I [%1]==[/P] (
58 SET PREFIX=%2 58 SET PREFIX=%2
59 SET SYSCONFDIR=%2
60 SET ROCKS_TREE=%2
59 SHIFT /1 61 SHIFT /1
60 SHIFT /1 62 SHIFT /1
61 GOTO PARSE_LOOP 63 GOTO PARSE_LOOP
@@ -240,7 +242,11 @@ IF ERRORLEVEL 1 GOTO ERROR
240IF [%INSTALL_LUA%]==[ON] ( 242IF [%INSTALL_LUA%]==[ON] (
241 IF NOT EXIST "%LUA_BINDIR%" %MKDIR% "%LUA_BINDIR%" 243 IF NOT EXIST "%LUA_BINDIR%" %MKDIR% "%LUA_BINDIR%"
242 IF NOT EXIST "%LUA_INCDIR%" %MKDIR% "%LUA_INCDIR%" 244 IF NOT EXIST "%LUA_INCDIR%" %MKDIR% "%LUA_INCDIR%"
243 COPY lua5.1\bin\*.* "%LUA_BINDIR%" >NUL 245REM IF [%USE_MINGW%]==[ON] (
246REM COPY lua5.1\mingw32-bin\*.* "%LUA_BINDIR%" >NUL
247REM ) ELSE (
248 COPY lua5.1\bin\*.* "%LUA_BINDIR%" >NUL
249REM )
244 COPY lua5.1\include\*.* "%LUA_INCDIR%" >NUL 250 COPY lua5.1\include\*.* "%LUA_INCDIR%" >NUL
245) 251)
246COPY bin\*.* "%BINDIR%" >NUL 252COPY bin\*.* "%BINDIR%" >NUL
@@ -301,11 +307,19 @@ IF NOT EXIST "%CONFIG_FILE%" (
301 307
302IF [%SCRIPTS_DIR%]==[] ( 308IF [%SCRIPTS_DIR%]==[] (
303 %MKDIR% "%ROCKS_TREE%"\bin >NUL 309 %MKDIR% "%ROCKS_TREE%"\bin >NUL
304 COPY lua5.1\bin\*.dll "%ROCKS_TREE%"\bin >NUL 310REM IF [%USE_MINGW%]==[ON] (
311REM COPY lua5.1\mingw32-bin\*.dll "%ROCKS_TREE%"\bin >NUL
312REM ) ELSE (
313 COPY lua5.1\bin\*.dll "%ROCKS_TREE%"\bin >NUL
314REM )
305) 315)
306IF NOT [%SCRIPTS_DIR%]==[] ( 316IF NOT [%SCRIPTS_DIR%]==[] (
307 %MKDIR% "%SCRIPTS_DIR%" >NUL 317 %MKDIR% "%SCRIPTS_DIR%" >NUL
308 COPY lua5.1\bin\*.dll "%SCRIPTS_DIR%" >NUL 318REM IF [%USE_MINGW%]==[ON] (
319REM COPY lua5.1\mingw32-bin\*.dll "%SCRIPTS_DIR%" >NUL
320REM ) ELSE (
321 COPY lua5.1\bin\*.dll "%SCRIPTS_DIR%" >NUL
322REM )
309) 323)
310 324
311IF NOT EXIST "%ROCKS_TREE%" %MKDIR% "%ROCKS_TREE%" 325IF NOT EXIST "%ROCKS_TREE%" %MKDIR% "%ROCKS_TREE%"
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua
index dacaad0a..b6f42eab 100644
--- a/src/luarocks/build/builtin.lua
+++ b/src/luarocks/build/builtin.lua
@@ -86,10 +86,9 @@ function run(rockspec)
86 compile_library = function(library, objects, libraries, libdirs, name) 86 compile_library = function(library, objects, libraries, libdirs, name)
87 local extras = { unpack(objects) } 87 local extras = { unpack(objects) }
88 add_flags(extras, "-L%s", libdirs) 88 add_flags(extras, "-L%s", libdirs)
89 add_flags(extras, "-l%s", libraries) 89 add_flags(extras, "%s.lib", libraries)
90 extras[#extras+1] = "-L" .. variables.LUA_LIBDIR 90 extras[#extras+1] = dir.path(variables.LUA_LIBDIR, "lua5.1.lib")
91 extras[#extras+1] = "-llua51" 91 extras[#extras+1] = "-l" .. (variables.MSVCRT or "msvcr80")
92 extras[#extras+1] = "-lmsvcrt"
93 local ok = execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras)) 92 local ok = execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras))
94 return ok 93 return ok
95 end 94 end
@@ -103,7 +102,7 @@ function run(rockspec)
103 local ok = execute(variables.RC, "-o", resname, rcname) 102 local ok = execute(variables.RC, "-o", resname, rcname)
104 if not ok then return ok end 103 if not ok then return ok end
105 ok = execute(variables.LD, "-o", wrapname, resname, variables.WRAPPER, 104 ok = execute(variables.LD, "-o", wrapname, resname, variables.WRAPPER,
106 "-L"..variables.LUA_LIBDIR, "-llua51", "-lmsvcrt", "-luser32") 105 dir.path(variables.LUA_LIBDIR, "lua5.1.lib"), "-l" .. (variables.MSVCRT or "msvcr80"), "-luser32")
107 return ok, wrapname 106 return ok, wrapname
108 end 107 end
109 elseif is_platform("win32") then 108 elseif is_platform("win32") then
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 5ec87bf5..ae07f905 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -176,12 +176,12 @@ if detected.windows then
176 defaults.variables.LIBFLAG = "/dll" 176 defaults.variables.LIBFLAG = "/dll"
177 defaults.external_deps_patterns = { 177 defaults.external_deps_patterns = {
178 bin = { "?.exe", "?.bat" }, 178 bin = { "?.exe", "?.bat" },
179 lib = { "?.lib", "?.dll" }, 179 lib = { "?.lib", "?.dll", "lib?.dll" },
180 include = { "?.h" } 180 include = { "?.h" }
181 } 181 }
182 defaults.runtime_external_deps_patterns = { 182 defaults.runtime_external_deps_patterns = {
183 bin = { "?.exe", "?.bat" }, 183 bin = { "?.exe", "?.bat" },
184 lib = { "?.dll" }, 184 lib = { "?.dll", "lib?.dll" },
185 include = { "?.h" } 185 include = { "?.h" }
186 } 186 }
187 defaults.local_cache = home.."/cache/luarocks" 187 defaults.local_cache = home.."/cache/luarocks"
@@ -189,7 +189,7 @@ end
189 189
190if detected.mingw32 then 190if detected.mingw32 then
191 home_config_file = home_config_file:gsub("\\","/") 191 home_config_file = home_config_file:gsub("\\","/")
192 defaults.arch = "mingw32-"..proc 192 defaults.arch = "win32-"..proc
193 defaults.platforms = { "win32", "mingw32" } 193 defaults.platforms = { "win32", "mingw32" }
194 defaults.lib_extension = "dll" 194 defaults.lib_extension = "dll"
195 defaults.external_lib_extension = "dll" 195 defaults.external_lib_extension = "dll"
@@ -201,15 +201,15 @@ if detected.mingw32 then
201 defaults.cmake_generator = "MinGW Makefiles" 201 defaults.cmake_generator = "MinGW Makefiles"
202 defaults.make = "mingw32-make" -- TODO: Split Windows flavors between mingw and msvc 202 defaults.make = "mingw32-make" -- TODO: Split Windows flavors between mingw and msvc
203 defaults.makefile = "Makefile.win" 203 defaults.makefile = "Makefile.win"
204 defaults.variables.CC = "gcc" 204 defaults.variables.CC = "mingw32-gcc"
205 defaults.variables.RC = "windres" 205 defaults.variables.RC = "windres"
206 defaults.variables.WRAPPER = config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.o" 206 defaults.variables.WRAPPER = config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.o"
207 defaults.variables.LD = "gcc" 207 defaults.variables.LD = "mingw32-gcc"
208 defaults.variables.CFLAGS = "-O2" 208 defaults.variables.CFLAGS = "-O2"
209 defaults.variables.LIBFLAG = "-shared --dll --export-all-symbols" 209 defaults.variables.LIBFLAG = "-shared"
210 defaults.external_deps_patterns = { 210 defaults.external_deps_patterns = {
211 bin = { "?.exe", "?.bat" }, 211 bin = { "?.exe", "?.bat" },
212 lib = { "lib?.a", "?.dll", "lib?.dll" }, 212 lib = { "?.lib", "?.dll", "lib?.dll" },
213 include = { "?.h" } 213 include = { "?.h" }
214 } 214 }
215 defaults.runtime_external_deps_patterns = { 215 defaults.runtime_external_deps_patterns = {