blob: d79d2b29f23e499f8fbeed3c8fc46456585d7f70 [file] [log] [blame]
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@rules_license//rules:license.bzl", "license")
package(default_applicable_licenses = [":license"])
license(
name = "license",
license_kinds = ["@rules_license//licenses/spdx:LGPL-2.1-or-later"],
license_text = "COPYING",
)
exports_files(["COPYING"])
UPSTREAM_VERSION = module_version().split(".bcr.", 1)[0]
[
V_MAJOR,
V_MINOR,
V_MICRO,
] = UPSTREAM_VERSION.split(".", 3)
BINARY_AGE = 100 * int(V_MINOR) + int(V_MICRO)
expand_template(
name = "gen_config_h",
out = "include/config.h",
substitutions = {
"{GLIB_BINARY_AGE}": str(BINARY_AGE),
"{GLIB_MAJOR_VERSION}": V_MAJOR,
"{GLIB_MINOR_VERSION}": V_MINOR,
"{GLIB_MICRO_VERSION}": V_MICRO,
"{GLIB_VERSION}": UPSTREAM_VERSION,
},
template = select({
"@platforms//os:macos": "config.h-macos",
"@platforms//os:linux": "config.h-linux",
}),
)
cc_library(
name = "config_h",
hdrs = [":gen_config_h"],
strip_include_prefix = "/include",
visibility = ["//:__subpackages__"],
)