Skip to content

Commit

Permalink
chore(build): move libtool to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Sep 10, 2024
1 parent 98b7c3c commit 84f18ab
Showing 1 changed file with 14 additions and 35 deletions.
49 changes: 14 additions & 35 deletions build/libexpat/BUILD.libexpat.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
load("@kong_bindings//:variables.bzl", "KONG_VAR")

filegroup(
Expand All @@ -9,37 +9,20 @@ filegroup(
),
)

configure_make(
cmake(
name = "libexpat",
configure_command = "configure",
configure_in_place = True,
configure_options = [
# configure a miminal feature set at first so that we don't
# end up depend to a lot of dependencies; do not when turning
# on any of the feature below, we need to add it o kong package's
# dependencies, and compile it (under build/cross_deps) for
# cross build platforms
"--enable-static=no",
"--without-xmlwf",
"--without-examples",
"--without-docbook",
] + select({
"@kong//:aarch64-linux-glibc-cross": [
"--host=aarch64-unknown-linux-gnu",
],
"@kong//:x86_64-linux-glibc-cross": [
"--host=x86_64-unknown-linux-gnu",
],
"//conditions:default": [],
}),
env = select({
"@platforms//os:macos": {
# don't use rule_foreign_cc's libtool as archiver as it seems to be a bug
# see https://github.com/bazelbuild/rules_foreign_cc/issues/947
"AR": "/usr/bin/ar",
},
"//conditions:default": {},
}),
build_args = [
"--", # <- Pass remaining options to the native tool.
"-j" + KONG_VAR["NPROC"],
],
cache_entries = {
"CMAKE_C_FLAGS": "${CMAKE_C_FLAGS:-} -fPIC",
"CMAKE_INSTALL_LIBDIR": "lib", # force distros that uses lib64 (rhel family) to use lib
"BUILD_SHARED_LIBS": "ON",
"EXPAT_BUILD_EXAMPLES": "OFF",
"EXPAT_BUILD_DOCS": "OFF",
"EXPAT_BUILD_TOOLS": "OFF", # skip xmlwf
},
lib_source = ":all_srcs",
out_include_dir = "include/libexpat", # don't install headers
# out_lib_dir = "lib",
Expand All @@ -51,9 +34,5 @@ configure_make(
"libexpat.so.1.9.2",
],
}),
targets = [
"-j" + KONG_VAR["NPROC"],
"install -j" + KONG_VAR["NPROC"],
],
visibility = ["//visibility:public"],
)

0 comments on commit 84f18ab

Please sign in to comment.