Init
This commit is contained in:
commit
79e255d19d
11 changed files with 915 additions and 0 deletions
64
bldit.lua
Normal file
64
bldit.lua
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
bldit_version = "1.1.3"
|
||||
package_version = "1.1.3"
|
||||
|
||||
dependencies = {}
|
||||
|
||||
exec_name = "kvm"
|
||||
libs = "-Wall -Wextra -ludev -lX11 -lXrandr -lXext -lXfixes -lXft"
|
||||
includes = "-Iudev -ggdb -I/usr/include/freetype2"
|
||||
cc = "gcc"
|
||||
|
||||
execute = function(str)
|
||||
print(str)
|
||||
return os.execute(str)
|
||||
end
|
||||
|
||||
targets = {
|
||||
default = {
|
||||
build = function()
|
||||
e,h,c = execute("rm -fr build")
|
||||
if c ~= 0 and c ~= nil then
|
||||
print("Build Error")
|
||||
print("GIVEN UP")
|
||||
return c
|
||||
end
|
||||
e,h,c = execute("mkdir build")
|
||||
if c ~= 0 and c ~= nil then
|
||||
print("Build Error")
|
||||
print("GIVEN UP")
|
||||
return c
|
||||
end
|
||||
cmd = [[find src -type f -name "*.c" -print]]
|
||||
p = io.popen(cmd)
|
||||
assert(p, "File detection error, GIVEN UP")
|
||||
|
||||
for f in p:lines() do
|
||||
base = f:match("([^/]+)%.c$")
|
||||
obj = "build/"..base..".o"
|
||||
ccom = cc.." -c -O3 '"..f.."' -o '"..obj.."' "..includes
|
||||
e,h,c = execute(ccom)
|
||||
if c ~= 0 and c ~= nil then
|
||||
print("Compilation Error")
|
||||
print("GIVEN UP")
|
||||
return c
|
||||
end
|
||||
end
|
||||
p:close()
|
||||
e,h,c = execute(cc.." build/*.o "..libs.." -o "..exec_name)
|
||||
if c ~= 0 and c ~= nil then
|
||||
print("Compilation Error")
|
||||
print("GIVEN UP")
|
||||
return c
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
install = function()
|
||||
e,h,c = execute("cp "..exec_name.." /bin")
|
||||
return c or 0
|
||||
end,
|
||||
uninstall = function()
|
||||
e,h,c = execute("rm /bin"..exec_name)
|
||||
return c or 0
|
||||
end,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue