Skip to content

Instantly share code, notes, and snippets.

@timburks
Created December 4, 2008 00:55
Show Gist options
  • Save timburks/31796 to your computer and use it in GitHub Desktop.
Save timburks/31796 to your computer and use it in GitHub Desktop.
Nuke task to build standalone "tool" executables
;; use this to create all the linking and assembly tasks to build a standalone "tool" executable
(macro tool-tasks
(unless (and @arch (@arch length))
(set @arch (list (NSString stringWithShellCommand:"arch"))))
(unless @tool_extras
(set @tool_extras ""))
;; executable architecture-specific executable
(set @tool_executables (NSMutableArray array))
(@arch each:
(do (architecture)
(set tool_executable "build/#{architecture}/#{@tool}")
(@tool_executables addObject:tool_executable)
(file tool_executable => (@c_objects objectForKey:architecture) (@m_objects objectForKey:architecture) is
(set command "gcc #{((@c_objects objectForKey:architecture) join)} #{((@m_objects objectForKey:architecture) join)} #{@tool_extras} #{@ldflags} -o '#{(target name)}'")
(SH command))))
;; tool fat archive
(set @tool_executable_name "#{@tool}")
(file @tool_executable_name => @tool_executables is
(if (> (@tool_executables count) 1)
(then (set command "lipo -create #{(@tool_executables join)} -output '#{@tool_executable_name}'"))
(else (set command "cp '#{(@tool_executables objectAtIndex:0)}' '#{@tool_executable_name}'")))
(SH command))
(task "tool" => @tool_executable_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment