 +    chdir = kw.get('chdir')
 +    if chdir:
 +      result.append(chdir)
++    result.append('ninja')
 +    #configuration = self.configuration_dirname()
-+    #result.extend(['out', configuration])
++    # result.append, configuration])
 +    result.append(self.built_file_basename(name, type, **kw))
 +    return self.workpath(*result)
 +

+    return self.WriteTarget(spec, config, target_deps)
+
+  def WriteActions(self, actions):
+    outputs = []
+    for action in actions:
+      # First write out a rule for the action.
+      name = action['action_name']
+      command = gyp.common.EncodePOSIXShellList(action['action'])
+      self.WriteRule(name=name, command=command)
+
+      # Then write out an edge using the rule.
+      self.WriteEdge(action['outputs'], name, action['inputs'])
+      outputs.extend(action['outputs'])
+    return outputs
+
+  def WriteSources(self, config, sources, extra_link_deps):
+    self.WriteVariableList('defines', ['-D' + d for d in config.get('defines', [])])

+    self.WriteVariableList('ldflags', config.get('ldflags'))
+    self.WriteVariableList('libs', spec.get('libraries'))
+
+    output = self.ComputeOutput(spec)
+    if 'dependencies' in spec:
+      for dep in spec['dependencies']:
+        dep = self.linkable_outputs.get(dep)
