blob: 934524785fff3e1f3efd3cad0f885f010ddb52e5 [file] [edit]
load("@bazel_lib//lib:write_source_files.bzl", "write_source_file")
load("@package_metadata//licenses/rules:license.bzl", "license")
load("@package_metadata//licenses/rules:license_kind.bzl", "license_kind")
load("@package_metadata//rules:package_metadata.bzl", "package_metadata")
load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make")
load("@stardust_build_package_metadata_mirror_url//:mirror_url.bzl", "mirror_url")
load(":license.bzl", "concat_package_licenses")
package(
default_package_metadata = [":package_metadata"],
)
exports_files(
glob(["**"]),
visibility = ["//visibility:private"],
)
package_metadata(
name = "package_metadata",
attributes = [
":license",
":mirror_url",
],
purl = "pkg:generic/libiconv@2f2b617",
)
license_kind(
name = "license_kind",
full_name = "GNU libiconv Composite License",
identifier = " AND ".join([
"FSFAP",
"FSFULLR",
"GPL-2.0-or-later WITH Autoconf-exception-2.0",
"LGPL-2.1",
]),
)
license(
name = "license",
kind = ":license_kind",
text = ":LICENSE.txt",
)
mirror_url(
name = "mirror_url",
url = "https://third-party-mirror.googlesource.com/libiconv",
)
concat_package_licenses(
name = "concat_licenses",
)
write_source_file(
name = "write_license",
in_file = ":concat_licenses",
out_file = "LICENSE.txt",
)
filegroup(
name = "all_srcs",
srcs = glob(["**"]) + ["//third_party/gnulib:lgpl2_srcs"],
)
configure_make(
name = "libiconv",
autogen = True,
autogen_command = "autogen.sh",
build_data = [
"//third_party/gnulib:gnulib_tool",
"//third_party/gperf:gperf_exe",
"//third_party/patch:patch_exe",
],
configure_in_place = True,
configure_options = [
"--enable-static",
"--enable-shared",
"--enable-extra-encodings",
],
configure_xcompile = True,
env = {
"GNULIB_SRCDIR": "$$(dirname $(execpath //third_party/gnulib:gnulib_tool))",
"GNULIB_TOOL": "$(execpath //third_party/gnulib:gnulib_tool)",
"GPERF": "$(execpath //third_party/gperf:gperf_exe)",
"PATH": ":".join([
"$$(dirname $(execpath //third_party/patch:patch_exe))",
"$$PATH",
]),
},
lib_source = ":all_srcs",
out_shared_libs = ["libiconv.so"],
out_static_libs = ["libiconv.a"],
# The makefile for this project is not safe for parallel execution and so its
# resource_size must be `tiny`.
resource_size = "tiny",
visibility = ["//visibility:public"],
)