Merge changes from topic "soong_mdnsresponder"
* changes:
Add windows libraries used by mdnsresponder
Add support for Windows Message Compiler
diff --git a/cc/builder.go b/cc/builder.go
index 1a4f505..b5bdc3d 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -158,6 +158,13 @@
},
"asFlags")
+ windres = pctx.AndroidStaticRule("windres",
+ blueprint.RuleParams{
+ Command: "$windresCmd $flags -I$$(dirname $in) -i $in -o $out",
+ CommandDeps: []string{"$windresCmd"},
+ },
+ "windresCmd", "flags")
+
_ = pctx.SourcePathVariable("sAbiDumper", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/header-abi-dumper")
// -w has been added since header-abi-dumper does not need to produce any sort of diagnostic information.
@@ -332,7 +339,8 @@
objFiles[i] = objFile
- if srcFile.Ext() == ".asm" {
+ switch srcFile.Ext() {
+ case ".asm":
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: yasm,
Description: "yasm " + srcFile.Rel(),
@@ -344,6 +352,19 @@
},
})
continue
+ case ".rc":
+ ctx.ModuleBuild(pctx, android.ModuleBuildParams{
+ Rule: windres,
+ Description: "windres " + srcFile.Rel(),
+ Output: objFile,
+ Input: srcFile,
+ OrderOnly: deps,
+ Args: map[string]string{
+ "windresCmd": gccCmd(flags.toolchain, "windres"),
+ "flags": flags.toolchain.WindresFlags(),
+ },
+ })
+ continue
}
var moduleCflags string
diff --git a/cc/compiler.go b/cc/compiler.go
index 0cc809d..5ffaf17 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -429,6 +429,11 @@
"-I"+android.PathForModuleGen(ctx, "yacc", ctx.ModuleDir()).String())
}
+ if compiler.hasSrcExt(".mc") {
+ flags.GlobalFlags = append(flags.GlobalFlags,
+ "-I"+android.PathForModuleGen(ctx, "windmc", ctx.ModuleDir()).String())
+ }
+
if compiler.hasSrcExt(".aidl") {
if len(compiler.Properties.Aidl.Local_include_dirs) > 0 {
localAidlIncludeDirs := android.PathsForModuleSrc(ctx, compiler.Properties.Aidl.Local_include_dirs)
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index fc0282b..d62ebe4 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -70,6 +70,8 @@
YasmFlags() string
+ WindresFlags() string
+
Is64Bit() bool
ShlibSuffix() string
@@ -135,6 +137,10 @@
return ""
}
+func (toolchainBase) WindresFlags() string {
+ return ""
+}
+
func (toolchainBase) SanitizerRuntimeLibraryArch() string {
return ""
}
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index 4709823..270084e 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -81,7 +81,10 @@
windowsAvailableLibraries = addPrefix([]string{
"gdi32",
"imagehlp",
+ "iphlpapi",
+ "netapi32",
"ole32",
+ "powrprof",
"psapi",
"pthread",
"userenv",
@@ -172,6 +175,14 @@
return "${config.WindowsIncludeFlags}"
}
+func (t *toolchainWindowsX86) WindresFlags() string {
+ return "-F pe-i386"
+}
+
+func (t *toolchainWindowsX8664) WindresFlags() string {
+ return "-F pe-x86-64"
+}
+
func (t *toolchainWindows) ClangSupported() bool {
return false
}
diff --git a/cc/gen.go b/cc/gen.go
index 7a22abd..6c9579e 100644
--- a/cc/gen.go
+++ b/cc/gen.go
@@ -54,6 +54,13 @@
Deps: blueprint.DepsGCC,
},
"aidlFlags", "outDir")
+
+ windmc = pctx.AndroidStaticRule("windmc",
+ blueprint.RuleParams{
+ Command: "$windmcCmd -r$$(dirname $out) -h$$(dirname $out) $in",
+ CommandDeps: []string{"$windmcCmd"},
+ },
+ "windmcCmd")
)
func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.ModuleGenPath, yaccFlags string) (headerFile android.ModuleGenPath) {
@@ -100,6 +107,26 @@
})
}
+func genWinMsg(ctx android.ModuleContext, srcFile android.Path, flags builderFlags) (android.Path, android.Path) {
+ headerFile := android.GenPathWithExt(ctx, "windmc", srcFile, "h")
+ rcFile := android.GenPathWithExt(ctx, "windmc", srcFile, "rc")
+
+ windmcCmd := gccCmd(flags.toolchain, "windmc")
+
+ ctx.ModuleBuild(pctx, android.ModuleBuildParams{
+ Rule: windmc,
+ Description: "windmc " + srcFile.Rel(),
+ Output: rcFile,
+ ImplicitOutput: headerFile,
+ Input: srcFile,
+ Args: map[string]string{
+ "windmcCmd": windmcCmd,
+ },
+ })
+
+ return rcFile, headerFile
+}
+
func genSources(ctx android.ModuleContext, srcFiles android.Paths,
buildFlags builderFlags) (android.Paths, android.Paths) {
@@ -137,6 +164,10 @@
cppFile := rsGeneratedCppFile(ctx, srcFile)
rsFiles = append(rsFiles, srcFiles[i])
srcFiles[i] = cppFile
+ case ".mc":
+ rcFile, headerFile := genWinMsg(ctx, srcFile, buildFlags)
+ srcFiles[i] = rcFile
+ deps = append(deps, headerFile)
}
}