Fixup download.py and integrate into bam.lua

This commit is contained in:
Henningstone 2015-05-19 16:50:28 +02:00
parent 67f63d34bf
commit e21cab322f
2 changed files with 24 additions and 7 deletions

10
bam.lua
View file

@ -424,7 +424,7 @@ function GenerateSettings(conf, arch, builddir, compiler)
return settings
end
-- String formatting wth named parameters, by RiciLake http://lua-users.org/wiki/StringInterpolation
-- String formatting with named parameters, by RiciLake http://lua-users.org/wiki/StringInterpolation
function interp(s, tab)
return (s:gsub('%%%((%a%w*)%)([-0-9%.]*[cdeEfgGiouxXsq])',
function(k, fmt)
@ -489,9 +489,17 @@ for a, cur_arch in ipairs(archs) do
local settings = GenerateSettings(cur_conf, cur_arch, cur_builddir, compiler)
for t, cur_target in pairs(targets) do
table.insert(subtargets[cur_target], PathJoin(cur_builddir, cur_target .. settings.link.extension))
dl = Python("scripts/download.py")
dl = dl .. " -arch " .. cur_arch .. " -conf " .. cur_conf
AddJob(cur_target .. "SDL2.dll", "Downloading SDL2.dll for " .. cur_arch .. "/" .. cur_conf, dl .. " +pack SDL2.dll-" .. cur_arch)
AddJob(cur_target .. "freetype.dll", "Downloading freetype.dll for " .. cur_arch .. "/" .. cur_conf, dl .. " +pack freetype.dll-" .. cur_arch)
end
end
end
AddJob("other/sdl/include/SDL.h", "Downloading sdl and freetype", dl .. " +pack sdl +pack freetype") --TODO: remove freetype from sdl-download
AddJob("other/freetype/include/freetype.h", "Downloading freetype", dl .. " +pack freetype") --TODO: MAKE ME WORKING (why don't I...!?)
for cur_name, cur_target in pairs(targets) do
-- Supertarget for all configurations and architectures of that target
PseudoTarget(cur_name, subtargets[cur_target])

View file

@ -2,6 +2,7 @@ import urllib.request
import os
import zipfile
import sys
import re
def _downloadZip(url, filePath):
# create full path, if it doesn't exists
@ -19,15 +20,23 @@ def downloadAll(arch, conf):
builddir = "../build/" + arch + "/" + conf + "/"
files = (downloadUrl.format("SDL2.dll" + "-" + arch), builddir ),\
(downloadUrl.format("freetype.dll" + "-" + arch), builddir ),\
(downloadUrl.format("sdl" ), "../other/sdl/" ),\
(downloadUrl.format("freetype" ), "../other/freetype/")
(downloadUrl.format("sdl" ), "other/sdl/" ),\
(downloadUrl.format("freetype" ), "other/freetype/")
for elem in files:
_downloadZip(elem[0], elem[1])
for i in range(1,len(sys.argv)):
sTmp = re.search('master/(.+?).zip', elem[0])
curr_pack = sTmp.group(1)
if sys.argv[i] == "+pack" and sys.argv[i + 1] == curr_pack:
_downloadZip(elem[0], elem[1])
def main():
arch = sys.argv[1] if len(sys.argv) >= 2 else "x86"
conf = sys.argv[2] if len(sys.argv) >= 3 else "debug"
arch = "x86"
conf = "debug"
for i in range(1,len(sys.argv)): # this is expandable infinitly for more args
if sys.argv[i] == "-arch": arch = sys.argv[i + 1]
if sys.argv[i] == "-conf": conf = sys.argv[i + 1]
downloadAll(arch, conf)
if __name__ == '__main__':
main()
main()