From 2908d0d9e2aaff62690ad6df4bce522a0f4a13ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Thu, 14 Jan 2021 23:36:41 +0000 Subject: [PATCH] [WORKSPACE, glib.BUILD, q3map] Add local version of glib repository This is currently for use on MacOS only. On Linux, we can build glib from source. --- WORKSPACE | 6 ++++++ bazel/glib.BUILD | 15 +++++++++++++++ q3map2/BUILD | 6 ++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 9877c488..b53682e2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -153,6 +153,12 @@ http_archive( ) # TODO: Replace with hermetic build +new_local_repository( + name = "glib_local_archive", + build_file = "@//bazel:glib.BUILD", + path ="/usr/local/Cellar/glib/2.68.3", +) + new_local_repository( name = "sdl_system", build_file = "@//bazel:sdl.BUILD", diff --git a/bazel/glib.BUILD b/bazel/glib.BUILD index a817d009..b56c813a 100644 --- a/bazel/glib.BUILD +++ b/bazel/glib.BUILD @@ -244,3 +244,18 @@ cc_library( visibility = ["//visibility:public"], deps = [":charset"], ) + +cc_library( + name = "glib_local", + srcs = ["lib/libglib-2.0.0.dylib"], + hdrs = glob([ + "include/glib-2.0/**/*.h", + "lib/glib-2.0/**/*.h", + ]), + includes = [ + "include/glib-2.0", + "lib/glib-2.0/include", + ], + linkopts = ["-liconv"], + visibility = ["//visibility:public"], +) diff --git a/q3map2/BUILD b/q3map2/BUILD index 15f9cf2b..50b6798d 100644 --- a/q3map2/BUILD +++ b/q3map2/BUILD @@ -91,9 +91,11 @@ cc_binary( ":picomodel", "//third_party/md:md4", "//third_party/md:md5", - "@glib_archive//:glib", "@jpeg_archive//:jpeg", "@libxml_archive//:libxml", "@png_archive//:png", - ], + ] + select({ + "//:is_linux": ["@glib_archive//:glib"], + "//:is_macos": ["@glib_local_archive//:glib_local"], + }), )