// Copyright 2017 The Android Open Source Project

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "external_e2fsprogs_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-GPL
    default_applicable_licenses: ["external_e2fsprogs_license"],
}

resize2fs_libs = [
    "libext2fs",
    "libext2_com_err",
    "libext2_e2p",
    "libext2_uuid",
    "libext2_blkid",
]

cc_defaults {
    name: "resize2fs-defaults",
    defaults: ["e2fsprogs-defaults"],
    srcs: [
        "extent.c",
        "resize2fs.c",
        "main.c",
        "online.c",
        "sim_progress.c",
        "resource_track.c",
    ],
}

cc_binary {
    name: "resize2fs",
    host_supported: true,
    vendor_ramdisk_available: true,
    defaults: ["resize2fs-defaults"],

    // Host binaries can be compiled statically to be re-used in other environments.
    // For android binaries, we keep shared libraries to keep the binary size smaller.
    target: {
        host: {
            static_libs: resize2fs_libs,
        },
        android: {
            shared_libs: resize2fs_libs,
        },
    },
}

cc_binary {
    name: "resize2fs_ramdisk",
    stem: "resize2fs",
    static_executable: true,
    ramdisk: true,
    defaults: ["resize2fs-defaults"],
    static_libs: resize2fs_libs,
}
