Search code examples
android-sourceandroid-soong

How to specify custom binary name in Soong?


I'm building custom C++ binary to add to AOSP build and I need to use new Soong build (.bp) files (which is Bazel-based, I learned). By default, "name" of the module will become binary name, but i need to change it. Is there any way to do it?

So in the example below I would like the generated binary be "myzip"

cc_binary {
    name: "gzip",
    srcs: ["src/test/minigzip.c"],
    shared_libs: ["libz"],
    stl: "none",
}

Solution

  • Use the stem property for this, for example:

    cc_binary {
        name: "gzip",
        srcs: ["src/test/minigzip.c"],
        shared_libs: ["libz"],
        stl: "none",
        multilib: {
            lib32: {
                stem: "gzip",
            },
            lib64: {
                stem: "gzip64",
            },
        },
    }