Merge changes from topic "soong_mdnsresponder"

* changes:
  Add windows libraries used by mdnsresponder
  Add support for Windows Message Compiler
This commit is contained in:
Treehugger Robot 2017-09-09 23:31:29 +00:00 committed by Gerrit Code Review
commit ffe58feb76
5 changed files with 75 additions and 1 deletions

View file

@ -158,6 +158,13 @@ var (
},
"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 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
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 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
},
})
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

View file

@ -429,6 +429,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
"-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)

View file

@ -70,6 +70,8 @@ type Toolchain interface {
YasmFlags() string
WindresFlags() string
Is64Bit() bool
ShlibSuffix() string
@ -135,6 +137,10 @@ func (toolchainBase) YasmFlags() string {
return ""
}
func (toolchainBase) WindresFlags() string {
return ""
}
func (toolchainBase) SanitizerRuntimeLibraryArch() string {
return ""
}

View file

@ -81,7 +81,10 @@ var (
windowsAvailableLibraries = addPrefix([]string{
"gdi32",
"imagehlp",
"iphlpapi",
"netapi32",
"ole32",
"powrprof",
"psapi",
"pthread",
"userenv",
@ -172,6 +175,14 @@ func (t *toolchainWindows) IncludeFlags() string {
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
}

View file

@ -54,6 +54,13 @@ var (
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 genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.Mod
})
}
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 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths,
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)
}
}