mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-11-28 08:43:26 +00:00
Autotools examples (#754)
* Build files for autotools tools * m4 1.4.19
This commit is contained in:
parent
1327fa3d4c
commit
7baefc1a8c
25
examples/third_party/BUILD.bazel
vendored
25
examples/third_party/BUILD.bazel
vendored
|
@ -6,13 +6,19 @@ test_suite(
|
|||
tests = [
|
||||
"//apr:apr_build_test",
|
||||
"//apr_util:apr_util_build_test",
|
||||
# https://github.com/bazelbuild/rules_foreign_cc/issues/811
|
||||
# "//bison:bison_build_test",
|
||||
# Builds but not useful as it hardcodes paths so isn't relocateable
|
||||
# "//autotools:autoconf_build_test",
|
||||
# Fails due to hardcoded paths in autoconf
|
||||
# "//autotools:automake_build_test",
|
||||
"//autotools:libtool_build_test",
|
||||
"//autotools:m4_build_test",
|
||||
"//bison:bison_build_test",
|
||||
"//cares:test_c_ares",
|
||||
"//curl:curl_test_suite",
|
||||
"//gn:gn_launch_test",
|
||||
"//gperftools:test",
|
||||
"//libgit2:libgit2_build_test",
|
||||
"//iconv:iconv_linux_build_test",
|
||||
"//libjpeg_turbo:libjpeg_turbo_build_test",
|
||||
"//libpng:test_libpng",
|
||||
"//libssh2:libssh2_build_test",
|
||||
|
@ -32,6 +38,12 @@ test_suite(
|
|||
"//apr:apr_build_test",
|
||||
# Copying files to RBE does not preserve timestamps, invoking autotools which is not new enough to build apr_util and its dependants
|
||||
# "//apr_util:apr_util_build_test",
|
||||
# M4 errors due to timestamps of source
|
||||
# not being preserved
|
||||
#"//autotools:autoconf_build_test",
|
||||
#"//autotools:automake_build_test",
|
||||
#"//autotools:libtool_build_test",
|
||||
#"//autotools:m4_build_test",
|
||||
# Missing a new enough m4 to build
|
||||
# "//bison:bison_build_test",
|
||||
"//cares:test_c_ares",
|
||||
|
@ -58,12 +70,19 @@ test_suite(
|
|||
tests = [
|
||||
"//apr:apr_build_test",
|
||||
"//apr_util:apr_util_build_test",
|
||||
# Builds but not useful as it hardcodes paths so isn't relocateable
|
||||
# "//autotools:autoconf_build_test",
|
||||
# Fails due to hardcoded paths in autoconf
|
||||
#"//autotools:automake_build_test",
|
||||
"//autotools:libtool_build_test",
|
||||
"//autotools:m4_build_test",
|
||||
# "//bison:bison_build_test",
|
||||
"//cares:test_c_ares",
|
||||
"//cares:test_c_ares_ios",
|
||||
"//curl:curl_test_suite",
|
||||
"//gn:gn_launch_test",
|
||||
"//gperftools:test",
|
||||
"//iconv:iconv_build_test",
|
||||
"//iconv:iconv_macos_build_test",
|
||||
"//libgit2:libgit2_build_test",
|
||||
"//libjpeg_turbo:libjpeg_turbo_build_test",
|
||||
"//libpng:test_libpng",
|
||||
|
|
35
examples/third_party/autotools/BUILD.autoconf.bazel
vendored
Normal file
35
examples/third_party/autotools/BUILD.autoconf.bazel
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "all_srcs",
|
||||
srcs = glob(["**"]),
|
||||
)
|
||||
|
||||
configure_make(
|
||||
name = "autoconf",
|
||||
build_data = [
|
||||
"@m4",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": {
|
||||
"AR": "",
|
||||
"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4",
|
||||
},
|
||||
"//conditions:default": {
|
||||
"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4",
|
||||
},
|
||||
}),
|
||||
lib_source = ":all_srcs",
|
||||
out_binaries = [
|
||||
"autoconf",
|
||||
"autoheader",
|
||||
"autom4te",
|
||||
"autoreconf",
|
||||
"autoscan",
|
||||
"autoupdate",
|
||||
"ifnames",
|
||||
],
|
||||
out_data_dirs = ["share"],
|
||||
)
|
28
examples/third_party/autotools/BUILD.automake.bazel
vendored
Normal file
28
examples/third_party/autotools/BUILD.automake.bazel
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "all_srcs",
|
||||
srcs = glob(["**"]),
|
||||
)
|
||||
|
||||
configure_make(
|
||||
name = "automake",
|
||||
build_data = [
|
||||
"@autoconf",
|
||||
"@m4",
|
||||
],
|
||||
env = {
|
||||
"AC_MACRODIR": "$$EXT_BUILD_DEPS$$/bin/autoconf/share/autoconf",
|
||||
"AUTOM4TE": "$$EXT_BUILD_DEPS$$/bin/autoconf/bin/autom4te",
|
||||
"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4",
|
||||
"PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
|
||||
"autom4te_perllibdir": "$$EXT_BUILD_DEPS$$/bin/autoconf/share/autoconf",
|
||||
},
|
||||
lib_source = ":all_srcs",
|
||||
out_binaries = [
|
||||
"automake",
|
||||
],
|
||||
toolchains = ["@rules_perl//:current_toolchain"],
|
||||
)
|
29
examples/third_party/autotools/BUILD.bazel
vendored
Normal file
29
examples/third_party/autotools/BUILD.bazel
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
|
||||
build_test(
|
||||
name = "m4_build_test",
|
||||
tags = ["manual"],
|
||||
targets = ["@m4//:m4"],
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
||||
|
||||
build_test(
|
||||
name = "autoconf_build_test",
|
||||
tags = ["manual"],
|
||||
targets = ["@autoconf//:autoconf"],
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
||||
|
||||
build_test(
|
||||
name = "automake_build_test",
|
||||
tags = ["manual"],
|
||||
targets = ["@automake//:automake"],
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
||||
|
||||
build_test(
|
||||
name = "libtool_build_test",
|
||||
tags = ["manual"],
|
||||
targets = ["@libtool//:libtool"],
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
28
examples/third_party/autotools/BUILD.libtool.bazel
vendored
Normal file
28
examples/third_party/autotools/BUILD.libtool.bazel
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "all_srcs",
|
||||
srcs = glob(["**"]),
|
||||
)
|
||||
|
||||
configure_make(
|
||||
name = "libtool",
|
||||
build_data = [
|
||||
"@m4",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": {
|
||||
"AR": "",
|
||||
"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4",
|
||||
},
|
||||
"//conditions:default": {"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4"},
|
||||
}),
|
||||
install_prefix = "install",
|
||||
lib_source = ":all_srcs",
|
||||
out_binaries = [
|
||||
"libtool",
|
||||
],
|
||||
out_data_dirs = ["share"],
|
||||
)
|
20
examples/third_party/autotools/BUILD.m4.bazel
vendored
Normal file
20
examples/third_party/autotools/BUILD.m4.bazel
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "all_srcs",
|
||||
srcs = glob(["**"]),
|
||||
)
|
||||
|
||||
configure_make(
|
||||
name = "m4",
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
lib_source = ":all_srcs",
|
||||
out_binaries = [
|
||||
"m4",
|
||||
],
|
||||
)
|
60
examples/third_party/autotools/autotools_repositories.bzl
vendored
Normal file
60
examples/third_party/autotools/autotools_repositories.bzl
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
# buildifier: disable=module-docstring
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||
|
||||
def autotools_repositories():
|
||||
"""Load all repositories needed for autotools"""
|
||||
|
||||
maybe(
|
||||
http_archive,
|
||||
name = "m4",
|
||||
build_file = Label("//autotools:BUILD.m4.bazel"),
|
||||
strip_prefix = "m4-1.4.19",
|
||||
urls = [
|
||||
"https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz",
|
||||
],
|
||||
sha256 = "63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96",
|
||||
)
|
||||
|
||||
maybe(
|
||||
http_archive,
|
||||
name = "autoconf",
|
||||
build_file = Label("//autotools:BUILD.autoconf.bazel"),
|
||||
strip_prefix = "autoconf-2.71",
|
||||
urls = [
|
||||
"https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz",
|
||||
],
|
||||
sha256 = "431075ad0bf529ef13cb41e9042c542381103e80015686222b8a9d4abef42a1c",
|
||||
)
|
||||
|
||||
maybe(
|
||||
http_archive,
|
||||
name = "rules_perl",
|
||||
sha256 = "55fbe071971772758ad669615fc9aac9b126db6ae45909f0f36de499f6201dd3",
|
||||
strip_prefix = "rules_perl-2f4f36f454375e678e81e5ca465d4d497c5c02da",
|
||||
urls = [
|
||||
"https://github.com/bazelbuild/rules_perl/archive/2f4f36f454375e678e81e5ca465d4d497c5c02da.tar.gz",
|
||||
],
|
||||
)
|
||||
|
||||
maybe(
|
||||
http_archive,
|
||||
name = "automake",
|
||||
build_file = Label("//autotools:BUILD.automake.bazel"),
|
||||
strip_prefix = "automake-1.16.4",
|
||||
urls = [
|
||||
"https://ftp.gnu.org/gnu/automake/automake-1.16.4.tar.gz",
|
||||
],
|
||||
sha256 = "8a0f0be7aaae2efa3a68482af28e5872d8830b9813a6a932a2571eac63ca1794",
|
||||
)
|
||||
|
||||
maybe(
|
||||
http_archive,
|
||||
name = "libtool",
|
||||
build_file = Label("//autotools:BUILD.libtool.bazel"),
|
||||
strip_prefix = "libtool-2.4.6",
|
||||
urls = [
|
||||
"https://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz",
|
||||
],
|
||||
sha256 = "e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3",
|
||||
)
|
6
examples/third_party/bison/BUILD.bison.bazel
vendored
6
examples/third_party/bison/BUILD.bison.bazel
vendored
|
@ -10,6 +10,12 @@ filegroup(
|
|||
# I tested and this builds for me on MAC and Linux, did not check Windows thouigh
|
||||
configure_make(
|
||||
name = "bison",
|
||||
build_data = [
|
||||
"@m4",
|
||||
],
|
||||
env = {
|
||||
"M4": "$$EXT_BUILD_DEPS$$/bin/m4/bin/m4",
|
||||
},
|
||||
lib_source = ":all_srcs",
|
||||
out_binaries = [
|
||||
"bison",
|
||||
|
|
18
examples/third_party/iconv/BUILD.bazel
vendored
18
examples/third_party/iconv/BUILD.bazel
vendored
|
@ -3,15 +3,29 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
|||
exports_files(
|
||||
[
|
||||
"BUILD.iconv.bazel",
|
||||
"BUILD.iconv.macos.bazel",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
build_test(
|
||||
name = "iconv_build_test",
|
||||
tags = ["manual"], # MacOS Only
|
||||
name = "iconv_linux_build_test",
|
||||
target_compatible_with = [
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
targets = [
|
||||
"@iconv//:iconv",
|
||||
],
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
||||
|
||||
build_test(
|
||||
name = "iconv_macos_build_test",
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
targets = [
|
||||
"@iconv_macos//:iconv",
|
||||
],
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
||||
|
|
6
examples/third_party/iconv/BUILD.iconv.bazel
vendored
6
examples/third_party/iconv/BUILD.iconv.bazel
vendored
|
@ -1,5 +1,3 @@
|
|||
"""libiconv is only expected to be used on MacOS systems"""
|
||||
|
||||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
|
||||
|
||||
filegroup(
|
||||
|
@ -15,10 +13,6 @@ configure_make(
|
|||
"--enable-shared=no",
|
||||
"--enable-static=yes",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
lib_source = "@iconv//:all",
|
||||
out_static_libs = [
|
||||
"libiconv.a",
|
||||
|
|
25
examples/third_party/iconv/BUILD.iconv.macos.bazel
vendored
Normal file
25
examples/third_party/iconv/BUILD.iconv.macos.bazel
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
"""libiconv is only expected to be used on MacOS systems"""
|
||||
|
||||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
|
||||
|
||||
filegroup(
|
||||
name = "all",
|
||||
srcs = glob(["**"]),
|
||||
)
|
||||
|
||||
configure_make(
|
||||
name = "iconv",
|
||||
configure_in_place = True,
|
||||
configure_options = [
|
||||
"--enable-relocatable",
|
||||
"--enable-shared=no",
|
||||
"--enable-static=yes",
|
||||
],
|
||||
env = {"AR": ""},
|
||||
lib_source = "@iconv_macos//:all",
|
||||
out_static_libs = [
|
||||
"libiconv.a",
|
||||
],
|
||||
targets = ["install-lib"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -7,11 +7,23 @@ def iconv_repositories():
|
|||
maybe(
|
||||
http_archive,
|
||||
name = "iconv",
|
||||
urls = [
|
||||
"https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz",
|
||||
],
|
||||
type = "tar.gz",
|
||||
sha256 = "e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04",
|
||||
strip_prefix = "libiconv-1.16",
|
||||
build_file = Label("//iconv:BUILD.iconv.bazel"),
|
||||
)
|
||||
|
||||
maybe(
|
||||
http_archive,
|
||||
name = "iconv_macos",
|
||||
urls = [
|
||||
"https://opensource.apple.com/tarballs/libiconv/libiconv-59.tar.gz",
|
||||
],
|
||||
type = "tar.gz",
|
||||
sha256 = "f7729999a9f2adc8c158012bc4bc8d69bea5dec88c8203cdd62067f91ed60b43",
|
||||
strip_prefix = "libiconv-59/libiconv",
|
||||
build_file = Label("//iconv:BUILD.iconv.bazel"),
|
||||
build_file = Label("//iconv:BUILD.iconv.macos.bazel"),
|
||||
)
|
||||
|
|
|
@ -42,7 +42,7 @@ cmake(
|
|||
"@openssl",
|
||||
] + select({
|
||||
"@platforms//os:linux": ["@pcre"],
|
||||
"@platforms//os:macos": ["@iconv"],
|
||||
"@platforms//os:macos": ["@iconv_macos//:iconv"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
|
2
examples/third_party/repositories.bzl
vendored
2
examples/third_party/repositories.bzl
vendored
|
@ -4,6 +4,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||
load("//apr:apr_repositories.bzl", "apr_repositories")
|
||||
load("//apr_util:apr_util_repositories.bzl", "apr_util_repositories")
|
||||
load("//autotools:autotools_repositories.bzl", "autotools_repositories")
|
||||
load("//bison:bison_repositories.bzl", "bison_repositories")
|
||||
load("//cares:cares_repositories.bzl", "cares_repositories")
|
||||
load("//curl:curl_repositories.bzl", "curl_repositories")
|
||||
|
@ -27,6 +28,7 @@ def repositories():
|
|||
"""Load all repositories needed for the targets of rules_foreign_cc_examples_third_party"""
|
||||
apr_repositories()
|
||||
apr_util_repositories()
|
||||
autotools_repositories()
|
||||
bison_repositories()
|
||||
cares_repositories()
|
||||
curl_repositories()
|
||||
|
|
|
@ -70,6 +70,7 @@ def create_configure_script(
|
|||
options = " ".join(autoreconf_options),
|
||||
).lstrip())
|
||||
|
||||
script.append("##mkdirs## $$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$")
|
||||
script.append("{env_vars} {prefix}\"{configure}\" --prefix=$$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$ {user_options}".format(
|
||||
env_vars = _get_env_vars(workspace_name, tools, flags, env_vars, deps, inputs),
|
||||
prefix = configure_prefix,
|
||||
|
|
Loading…
Reference in a new issue