diff --git a/.github/workflows/bazel-build-test.yaml b/.github/workflows/bazel-build-test.yaml new file mode 100644 index 00000000..45203884 --- /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 --sandbox_debug //... 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 a817d009..7f2a2159 100644 --- a/bazel/glib.BUILD +++ b/bazel/glib.BUILD @@ -1,23 +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 = "./$(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)", -) +# 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",