From e9e7760102d720e131cbdd2452bee5350559538f Mon Sep 17 00:00:00 2001 From: Red Daly Date: Thu, 4 Aug 2022 09:32:07 -0700 Subject: [PATCH 1/4] Add Github continuous integration test for mdbtools bazel build. --- .github/workflows/bazel-build-test.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/bazel-build-test.yaml diff --git a/.github/workflows/bazel-build-test.yaml b/.github/workflows/bazel-build-test.yaml new file mode 100644 index 00000000..b7c9f603 --- /dev/null +++ b/.github/workflows/bazel-build-test.yaml @@ -0,0 +1,10 @@ +name: "Bazel: Build and test" +on: [push] +jobs: + Build-and-test: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: "Bazel build" + run: bazel build //... From 3b6c7be997c9c65cdbf3b531c4bd6785c2050617 Mon Sep 17 00:00:00 2001 From: Red Daly Date: Thu, 4 Aug 2022 10:41:01 -0700 Subject: [PATCH 2/4] Attempt to fix configure to use C toolchain from bazel. --- bazel/glib.BUILD | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bazel/glib.BUILD b/bazel/glib.BUILD index a817d009..85ad2368 100644 --- a/bazel/glib.BUILD +++ b/bazel/glib.BUILD @@ -14,9 +14,12 @@ genrule( "config.h", "glibconfig.h", ], - cmd = "./$(location configure) --silent --disable-fam --disable-libmount --disable-dtrace --disable-compile-warnings --with-pcre=internal " + + cmd = "AR=$(AR) C_COMPILER=$(C_COMPILER) CC=$(CC) NM=$(NM) OBJCOPY=$(OBJCOPY) STRIP=$(STRIP) ./$(location configure) --silent --disable-fam --disable-libmount --disable-dtrace --disable-compile-warnings --with-pcre=internal " + "&& cp --verbose -- config.h $(location config.h)" + "&& cp --verbose -- glib/glibconfig.h $(location glibconfig.h)", + toolchains = [ + "@bazel_tools//tools/cpp:current_cc_toolchain", + ], ) cc_library( From 3ee874037251b7e365e7cf4d584a3b8236e9e654 Mon Sep 17 00:00:00 2001 From: Red Daly Date: Thu, 4 Aug 2022 10:48:13 -0700 Subject: [PATCH 3/4] Add --sandbox_debug to CI bazel step. --- .github/workflows/bazel-build-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bazel-build-test.yaml b/.github/workflows/bazel-build-test.yaml index b7c9f603..45203884 100644 --- a/.github/workflows/bazel-build-test.yaml +++ b/.github/workflows/bazel-build-test.yaml @@ -7,4 +7,4 @@ jobs: - name: Check out repository code uses: actions/checkout@v3 - name: "Bazel build" - run: bazel build //... + run: bazel build --sandbox_debug //... From e6fe40f4c36a1c397e72710f99a896f05601dfc9 Mon Sep 17 00:00:00 2001 From: Red Daly Date: Thu, 4 Aug 2022 12:03:22 -0700 Subject: [PATCH 4/4] Hopefully fix glib build. --- WORKSPACE.bazel | 25 ++++++++++++++++--- bazel/glib.BUILD | 63 ++++++++++++++++++++++++++++++------------------ 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 34919633..7c1d5b62 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -95,10 +95,27 @@ llvm_register_toolchains() http_archive( name = "glib_archive", build_file = "@mdbtools//bazel:glib.BUILD", - sha256 = "0cbb3d31c9d181bbcc97cba3d9dbe3250f75e2da25e5f7c8bf5a993fe54baf6a", - strip_prefix = "glib-2.55.1", + sha256 = "520376d5a95039820f687b44aef7a8adb9e82777b5f914892dfacc05ecc32b48", + strip_prefix = "glib-bazel-0.0.2", urls = [ - "https://mirror.bazel.build/ftp.gnome.org/pub/gnome/sources/glib/2.55/glib-2.55.1.tar.xz", - "https://ftp.gnome.org/pub/gnome/sources/glib/2.55/glib-2.55.1.tar.xz", + "https://github.com/reddaly/glib-bazel/archive/refs/tags/v0.0.2.tar.gz", + #"https://mirror.bazel.build/ftp.gnome.org/pub/gnome/sources/glib/2.55/glib-2.55.1.tar.xz", + #"https://ftp.gnome.org/pub/gnome/sources/glib/2.55/glib-2.55.1.tar.xz", ], ) + +# See https://bazelbuild.github.io/rules_foreign_cc/0.9.0/index.html + +http_archive( + name = "rules_foreign_cc", + # TODO: Get the latest sha256 value from a bazel debug message or the latest + # release on the releases page: https://github.com/bazelbuild/rules_foreign_cc/releases + # + # sha256 = "...", + strip_prefix = "rules_foreign_cc-0.9.0", + url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.9.0.tar.gz", +) + +load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") + +rules_foreign_cc_dependencies() diff --git a/bazel/glib.BUILD b/bazel/glib.BUILD index 85ad2368..7f2a2159 100644 --- a/bazel/glib.BUILD +++ b/bazel/glib.BUILD @@ -1,26 +1,43 @@ -genrule( - name = "gen_configure", - srcs = [ - "configure", - "config.guess", - "config.sub", - "install-sh", - "ltmain.sh", - "missing", - "glib/glib.h", - "po/LINGUAS", - ] + glob(["**/*.in"]), - outs = [ - "config.h", - "glibconfig.h", - ], - cmd = "AR=$(AR) C_COMPILER=$(C_COMPILER) CC=$(CC) NM=$(NM) OBJCOPY=$(OBJCOPY) STRIP=$(STRIP) ./$(location configure) --silent --disable-fam --disable-libmount --disable-dtrace --disable-compile-warnings --with-pcre=internal " + - "&& cp --verbose -- config.h $(location config.h)" + - "&& cp --verbose -- glib/glibconfig.h $(location glibconfig.h)", - toolchains = [ - "@bazel_tools//tools/cpp:current_cc_toolchain", - ], -) +# load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make") + +# configure_make( +# name = "foreign_glib", +# autoconf = True, +# configure_in_place = True, +# configure_options = [ +# "--silent", +# "--disable-fam", +# "--disable-libmount", +# "--disable-dtrace", +# "--disable-compile-warnings", +# "--with-pcre=internal", +# ], +# lib_source = "", +# ) + +# genrule( +# name = "gen_configure", +# srcs = [ +# "configure", +# "config.guess", +# "config.sub", +# "install-sh", +# "ltmain.sh", +# "missing", +# "glib/glib.h", +# "po/LINGUAS", +# ] + glob(["**/*.in"]), +# outs = [ +# "config.h", +# "glibconfig.h", +# ], +# cmd = "AR=$(AR) C_COMPILER=$(C_COMPILER) CC=$(CC) NM=$(NM) OBJCOPY=$(OBJCOPY) STRIP=$(STRIP) ./$(location configure) --silent --disable-fam --disable-libmount --disable-dtrace --disable-compile-warnings --with-pcre=internal " + +# "&& cp --verbose -- config.h $(location config.h)" + +# "&& cp --verbose -- glib/glibconfig.h $(location glibconfig.h)", +# toolchains = [ +# "@bazel_tools//tools/cpp:current_cc_toolchain", +# ], +# ) cc_library( name = "charset",