github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/systemlibs/build_defs.bzl.tpl (about)

     1  # -*- Python -*-
     2  """Skylark macros for system libraries.
     3  """
     4  
     5  SYSTEM_LIBS_ENABLED = %{syslibs_enabled}
     6  
     7  SYSTEM_LIBS_LIST = [
     8  %{syslibs_list}
     9  ]
    10  
    11  
    12  def if_any_system_libs(a, b=[]):
    13    """Conditional which evaluates to 'a' if any system libraries are configured."""
    14    if SYSTEM_LIBS_ENABLED:
    15      return a
    16    else:
    17      return b
    18  
    19  
    20  def if_system_lib(lib, a, b=[]):
    21    """Conditional which evaluates to 'a' if we're using the system version of lib"""
    22  
    23    if SYSTEM_LIBS_ENABLED and lib in SYSTEM_LIBS_LIST:
    24      return a
    25    else:
    26      return b
    27  
    28  
    29  def if_not_system_lib(lib, a, b=[]):
    30    """Conditional which evaluates to 'a' if we're using the system version of lib"""
    31  
    32    return if_system_lib(lib, b, a)