def system_library(name, lib_name, custom_lib_path = "/opt/kcal/lib", default_lib_path = "/usr/local/lib"):
    native.cc_library(
        name = name,
        linkopts = select({
            "@kcal_middleware//kcal/api:use_custom_path": [
                "-L" + custom_lib_path,
                "-l" + lib_name,
            ],
            "//conditions:default": [
                "-L" + default_lib_path,
                "-l" + lib_name,
            ],
        }),
    )

def kcal_api_library(name, hdrs, deps = None, custom_include_path = "/opt/kcal/include", default_include_path = "/usr/local/include"):
    native.cc_library(
        name = name,
        hdrs = hdrs,
        copts = select({
            "@kcal_middleware//kcal/api:use_custom_path": ["-I" + custom_include_path],
            "//conditions:default": ["-I" + default_include_path],
        }),
        deps = deps,
    )