mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-06-05 22:29:40 +02:00
added findclib and used it in Build.moon
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ public target 'info', fn: =>
|
|||||||
#echo "Binary:", BINARY
|
#echo "Binary:", BINARY
|
||||||
|
|
||||||
default target BINARY, out: {BINARY, OUT_C}, from: OUT_LUA, fn: =>
|
default target BINARY, out: {BINARY, OUT_C}, from: OUT_LUA, fn: =>
|
||||||
-luastatic MAIN_LUA, OUT_LUA, '-I/usr/include/lua5.3', '-llua5.3'
|
-luastatic MAIN_LUA, OUT_LUA, (findclib 'lua5.3', 'all')
|
||||||
|
|
||||||
target '%.lua', in: '%.moon', out: '%.lua', fn: =>
|
target '%.lua', in: '%.moon', out: '%.lua', fn: =>
|
||||||
-moonc @infile
|
-moonc @infile
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ calccdeps= (infile, includesys=false) ->
|
|||||||
rawdeps=data\gsub('\\\n', '')\match ':(.+)'
|
rawdeps=data\gsub('\\\n', '')\match ':(.+)'
|
||||||
[dep for dep in rawdeps\gmatch '%S+' when dep!=infile]
|
[dep for dep in rawdeps\gmatch '%S+' when dep!=infile]
|
||||||
|
|
||||||
|
findclib= (name, mode='all') ->
|
||||||
|
args={name}
|
||||||
|
insert args, '--cflags' if mode=='all' or mode=='cc'
|
||||||
|
insert args, '--libs' if mode=='all' or mode=='ld'
|
||||||
|
[arg for arg in (popen 'pkg-config', args)\read('*a')\gmatch '%S+']
|
||||||
|
|
||||||
-- file matcher
|
-- file matcher
|
||||||
wildcard= (pattern) ->
|
wildcard= (pattern) ->
|
||||||
prefix, suffix=pattern\match '^(.*)%*%*(.*)$'
|
prefix, suffix=pattern\match '^(.*)%*%*(.*)$'
|
||||||
@@ -169,7 +175,7 @@ sortedpairs= (table, cmp) ->
|
|||||||
|
|
||||||
-- command functions
|
-- command functions
|
||||||
:run, :popen
|
:run, :popen
|
||||||
:calccdeps
|
:calccdeps, :findclib
|
||||||
|
|
||||||
-- string functions
|
-- string functions
|
||||||
:patsubst, :match, :isglob
|
:patsubst, :match, :isglob
|
||||||
|
|||||||
Reference in New Issue
Block a user