about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-13T15·15+0000
committerVincent Ambo <tazjin@google.com>2019-12-13T15·15+0000
commit859c429b2fbf21e3ea799b1068daa6f123c59a48 (patch)
tree1425b71b0e6255638dd1e78b7759b478258e1e57
parentcfae527cc14c55f2cfa3d356674971c627ad1a88 (diff)
feat(external): Include *.s (ASM) files in external builds
-rw-r--r--external/default.nix1
-rw-r--r--external/main.go8
2 files changed, 9 insertions, 0 deletions
diff --git a/external/default.nix b/external/default.nix
index 49f8bd93149a..ee0bf94fa2c7 100644
--- a/external/default.nix
+++ b/external/default.nix
@@ -67,6 +67,7 @@ let
       libArgs = args // {
         name = pathToName entry.name;
         path = lib.concatStringsSep "/" ([ path ] ++ entry.locator);
+        sfiles = map (f: src + ("/" + f)) entry.sfiles;
       };
 
       binArgs = args // {
diff --git a/external/main.go b/external/main.go
index d73f1540a986..aa4a813d32bd 100644
--- a/external/main.go
+++ b/external/main.go
@@ -32,6 +32,7 @@ type pkg struct {
 	Name        string     `json:"name"`
 	Locator     []string   `json:"locator"`
 	Files       []string   `json:"files"`
+	SFiles      []string   `json:"sfiles"`
 	LocalDeps   [][]string `json:"localDeps"`
 	ForeignDeps []string   `json:"foreignDeps"`
 	IsCommand   bool       `json:"isCommand"`
@@ -75,6 +76,7 @@ func findGoDirs(at string) ([]string, error) {
 // generate a derivation for this package.
 func analysePackage(root, source, importpath string, stdlib map[string]bool) (pkg, error) {
 	ctx := build.Default
+	ctx.CgoEnabled = false
 
 	p, err := ctx.ImportDir(source, build.IgnoreVendor)
 	if err != nil {
@@ -114,10 +116,16 @@ func analysePackage(root, source, importpath string, stdlib map[string]bool) (pk
 		files = append(files, path.Join(prefix, f))
 	}
 
+	sfiles := []string{}
+	for _, f := range p.SFiles {
+		sfiles = append(sfiles, path.Join(prefix, f))
+	}
+
 	return pkg{
 		Name:        path.Join(importpath, prefix),
 		Locator:     locator,
 		Files:       files,
+		SFiles:      sfiles,
 		LocalDeps:   local,
 		ForeignDeps: foreign,
 		IsCommand:   p.IsCommand(),