blob: ea3a12b7dc1949a83c358e740c91604c472bfdb1 [file] [edit]
load("@bazel_lib//lib:write_source_files.bzl", "write_source_file", "write_source_files")
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_python//python:defs.bzl", "py_binary", "py_library")
load("@stardust_build_package_metadata_mirror_url//:mirror_url.bzl", "mirror_url")
load("//stardust-build/compliance:defs.bzl", "concat_licenses", "extract_lines")
load(":bazel/generate_gnulib_srcs.bzl", "generate_gnulib_srcs")
load(":bazel/gnulib_srcs.bzl", "LGPL2_SRCS", "LGPL3_SRCS")
package(
default_package_metadata = [":package_metadata"],
)
_GNULIB_PURL = "pkg:generic/gnulib@2ec728a27e7f677d2af40b82f078e24f74d08ee7"
package_metadata(
name = "package_metadata",
attributes = [
":license",
":mirror_url",
],
purl = _GNULIB_PURL,
)
mirror_url(
name = "mirror_url",
url = "https://third-party-mirror.googlesource.com/gnulib",
)
extract_lines(
name = "agpl_license",
src = "doc/agpl-3.0.texi",
end_line = 650,
start_line = 8,
)
extract_lines(
name = "bsd_license",
src = "lib/random_r.c",
end_line = 45,
start_line = 19,
)
extract_lines(
name = "fsfap_license",
src = "doc/INSTALL",
end_line = -1,
start_line = 374,
)
extract_lines(
name = "gfdl_license",
src = "doc/alloca.texi",
end_line = 8,
start_line = 3,
)
extract_lines(
name = "gpl2_autoconf_license",
src = "build-aux/ar-lib",
end_line = 26,
start_line = 10,
)
extract_lines(
name = "gpl3_autoconf_license",
src = "build-aux/config.guess",
end_line = 28,
start_line = 9,
)
extract_lines(
name = "isc_license",
src = "lib/inet_ntop.c",
end_line = 33,
start_line = 19,
)
extract_lines(
name = "rijndael_license",
src = "lib/rijndael-alg-fst.c",
end_line = 52,
start_line = 31,
)
extract_lines(
name = "sunpro_license",
src = "lib/acosl.c",
end_line = 26,
start_line = 19,
)
extract_lines(
name = "unicode_license",
src = "tests/unigbrk/GraphemeBreakTest.txt",
end_line = 39,
start_line = 1,
)
extract_lines(
name = "x11_license",
src = "build-aux/install-sh",
end_line = 32,
start_line = 10,
)
concat_licenses(
name = "concat_licenses",
srcs = [
"doc/COPYINGv3",
"doc/COPYINGv2",
"doc/COPYING.LESSERv3",
"doc/COPYING.LESSERv2",
"etc/license-notices/unlimited",
":agpl_license",
":bsd_license",
":fsfap_license",
":gfdl_license",
":gpl2_autoconf_license",
":gpl3_autoconf_license",
":isc_license",
":rijndael_license",
":sunpro_license",
":unicode_license",
":x11_license",
],
)
license_kind(
name = "license_kind",
full_name = "GNU Gnulib Composite License",
identifier = " AND ".join([
"AGPL-3.0",
"BSD-3-Clause",
"FSFAP",
"FSFULLR",
"GFDL-1.3",
"GPL-2.0",
"GPL-2.0-or-later WITH Autoconf-exception-2.0",
"GPL-3.0",
"GPL-3.0-with-autoconf-exception",
"ISC",
"LGPL-2.1",
"LGPL-3.0",
"LicenseRef-Rijndael-3.0",
"SunPro",
"Unicode-3.0",
"X11",
]),
)
license(
name = "license",
kind = ":license_kind",
text = ":LICENSE.txt",
)
concat_licenses(
name = "lgpl3_concat_licenses",
srcs = [
"doc/COPYING.LESSERv3",
"doc/COPYING.LESSERv2",
"etc/license-notices/unlimited",
":bsd_license",
":fsfap_license",
":gpl2_autoconf_license",
":gpl3_autoconf_license",
":isc_license",
":rijndael_license",
":sunpro_license",
":x11_license",
],
)
package_metadata(
name = "lgpl3_package_metadata",
attributes = [
":lgpl3_license",
":mirror_url",
],
purl = _GNULIB_PURL,
)
license_kind(
name = "lgpl3_license_kind",
full_name = "GNU Gnulib LGPLv3 Composite License",
identifier = " AND ".join([
"BSD-3-Clause",
"FSFAP",
"FSFULLR",
"GPL-2.0-or-later WITH Autoconf-exception-2.0",
"GPL-3.0-with-autoconf-exception",
"ISC",
"LGPL-2.1",
"LGPL-3.0",
"LicenseRef-Rijndael-3.0",
"SunPro",
"X11",
]),
)
license(
name = "lgpl3_license",
kind = ":lgpl3_license_kind",
text = ":LICENSE.lgpl3.txt",
)
concat_licenses(
name = "lgpl2_concat_licenses",
srcs = [
"doc/COPYING.LESSERv2",
"etc/license-notices/unlimited",
":bsd_license",
":fsfap_license",
":gpl2_autoconf_license",
":gpl3_autoconf_license",
":isc_license",
":rijndael_license",
":x11_license",
],
)
package_metadata(
name = "lgpl2_package_metadata",
attributes = [
":lgpl2_license",
":mirror_url",
],
purl = _GNULIB_PURL,
)
license_kind(
name = "lgpl2_license_kind",
full_name = "GNU Gnulib LGPLv2 Composite License",
identifier = " AND ".join([
"BSD-3-Clause",
"FSFAP",
"FSFULLR",
"GPL-2.0-or-later WITH Autoconf-exception-2.0",
"GPL-3.0-with-autoconf-exception",
"ISC",
"LGPL-2.1",
"LicenseRef-Rijndael-3.0",
"X11",
]),
)
license(
name = "lgpl2_license",
kind = ":lgpl2_license_kind",
text = ":LICENSE.lgpl2.txt",
)
write_source_files(
name = "write_license",
files = {
"LICENSE.txt": ":concat_licenses",
"LICENSE.lgpl3.txt": ":lgpl3_concat_licenses",
"LICENSE.lgpl2.txt": ":lgpl2_concat_licenses",
},
)
py_library(
name = "pygnulib",
srcs = glob(["pygnulib/*.py"]),
imports = ["."],
)
py_binary(
name = "gnulib_srcs_bin",
srcs = ["bazel/generate_gnulib_srcs.py"],
main = "bazel/generate_gnulib_srcs.py",
deps = [":pygnulib"],
)
generate_gnulib_srcs(
name = "generated_gnulib_srcs",
srcs = [":all_srcs"],
out = "generated_gnulib_srcs.bzl",
)
write_source_file(
name = "write_gnulib_srcs",
in_file = ":generated_gnulib_srcs",
out_file = "bazel/gnulib_srcs.bzl",
)
filegroup(
name = "all_srcs",
srcs = glob(
include = ["**"],
exclude = [
"BUILD",
"bazel/**",
"LICENSE*.txt",
],
),
visibility = ["//visibility:public"],
)
filegroup(
name = "lgpl3_srcs",
srcs = list(LGPL3_SRCS),
package_metadata = [":lgpl3_package_metadata"],
visibility = ["//visibility:public"],
)
filegroup(
name = "lgpl2_srcs",
srcs = list(LGPL2_SRCS),
package_metadata = [":lgpl2_package_metadata"],
visibility = ["//visibility:public"],
)
filegroup(
name = "gnulib_tool",
srcs = ["gnulib-tool"],
visibility = ["//visibility:public"],
)