Borneq

HBASE_thirdparty_BUCK

Sep 29th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 3.95 KB | None | 0 0
  1. ##
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements.  See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership.  The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License.  You may obtain a copy of the License at
  9. #
  10. #     http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17.  
  18.  
  19. def add_system_libs(names=[],
  20.                     lib_dir="/usr/lib/x86_64-linux-gnu",
  21.                     deps=[],
  22.                     exported_deps=[],
  23.                     exported_linker_flags=[],
  24.                     compiler_flags=['-fPIC']):
  25.     rules = []
  26.     for name in names:
  27.         rule_visibility = ['PUBLIC']
  28.         gen_rule_name = "gen_lib{}".format(name)
  29.         genrule(
  30.             name=gen_rule_name,
  31.             out=gen_rule_name,
  32.             bash="mkdir -p $OUT && cp {}/lib{}.a $OUT".format(lib_dir, name),)
  33.         prebuilt_cxx_library(
  34.             name=name,
  35.             lib_name=name,
  36.             lib_dir='$(location :{})'.format(gen_rule_name),
  37.             deps=deps,
  38.             force_static=False,
  39.             exported_deps=exported_deps,
  40.             visibility=rule_visibility,)
  41.         rules.append(":" + name)
  42.     return rules
  43.  
  44.  
  45. def add_dynamic_libs(names=[]):
  46.     rules = []
  47.     for name in names:
  48.         prebuilt_cxx_library(
  49.             name=name,
  50.             header_only=True,
  51.             exported_linker_flags=["-l" + name],
  52.             visibility=["PUBLIC"],)
  53.         rules.append(":" + name)
  54.     return rules
  55.  
  56.  
  57. system_libs = [
  58.     "lzma",
  59.     "event",
  60. ]
  61. local_libs = [
  62.     "double-conversion",
  63.     "boost_regex",
  64.     "boost_context",
  65.     "boost_thread",
  66.     "boost_system",
  67.     "boost_filesystem",
  68.     "boost_program_options",
  69.     "boost_chrono",
  70.     "gflags",
  71.     "glog",
  72.     "protobuf",
  73. ]
  74. dynamic_libs = ["stdc++", "pthread", "ssl", "crypto", "dl", "atomic", "unwind"]
  75. dynamic_rules = add_dynamic_libs(dynamic_libs)
  76. tp_dep_rules =  add_system_libs(system_libs,) \
  77.   + add_system_libs(local_libs, lib_dir = "/usr/local/lib") \
  78.   + dynamic_rules
  79.  
  80. zookeeper = add_system_libs(["zookeeper_mt"], lib_dir="/usr/local/lib")
  81. folly = add_system_libs(
  82.     ['folly'],
  83.     lib_dir='/usr/local/lib',
  84.     exported_deps=tp_dep_rules,)
  85. folly_bench = add_system_libs(
  86.     ['follybenchmark'],
  87.     lib_dir='/usr/local/lib',
  88.     exported_deps=folly + tp_dep_rules,)
  89. wangle = add_system_libs(
  90.     ['wangle'], lib_dir='/usr/local/lib', exported_deps=folly + tp_dep_rules)
  91.  
  92. genrule(
  93.     name="gen_zk",
  94.     out="gen_zk",
  95.     bash=
  96.     "mkdir -p $OUT  && wget http://www-us.apache.org/dist/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz &&   tar zxf zookeeper-3.4.8.tar.gz &&   rm -rf zookeeper-3.4.8.tar.gz &&   cd zookeeper-3.4.8 &&   cd src/c && ./configure --prefix=$OUT &&   make &&   make install && cd $OUT && rm -rf zookeeper-3.4.8*"
  97. )
  98. cxx_library(
  99.     name='google-test',
  100.     srcs=[
  101.         'googletest/googletest/src/gtest-all.cc',
  102.         'googletest/googlemock/src/gmock-all.cc',
  103.         'googletest/googlemock/src/gmock_main.cc',
  104.     ],
  105.     header_namespace='',
  106.     exported_headers=subdir_glob([
  107.         ('googletest/googletest/include', '**/*.h'),
  108.         ('googletest/googlemock/include', '**/*.h'),
  109.     ]),
  110.     headers=subdir_glob([
  111.         ('googletest/googletest', 'src/*.h'),
  112.         ('googletest/googletest', 'src/*.cc'),
  113.         ('googletest/googlemock', 'src/*.h'),
  114.         ('googletest/googlemock', 'src/*.cc'),
  115.     ]),
  116.     exported_deps=dynamic_rules,
  117.     visibility=[
  118.         'PUBLIC',
  119.     ],)
Advertisement
Add Comment
Please, Sign In to add comment