Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##
- # Licensed to the Apache Software Foundation (ASF) under one
- # or more contributor license agreements. See the NOTICE file
- # distributed with this work for additional information
- # regarding copyright ownership. The ASF licenses this file
- # to you under the Apache License, Version 2.0 (the
- # "License"); you may not use this file except in compliance
- # with the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- def add_system_libs(names=[],
- lib_dir="/usr/lib/x86_64-linux-gnu",
- deps=[],
- exported_deps=[],
- exported_linker_flags=[],
- compiler_flags=['-fPIC']):
- rules = []
- for name in names:
- rule_visibility = ['PUBLIC']
- gen_rule_name = "gen_lib{}".format(name)
- genrule(
- name=gen_rule_name,
- out=gen_rule_name,
- bash="mkdir -p $OUT && cp {}/lib{}.a $OUT".format(lib_dir, name),)
- prebuilt_cxx_library(
- name=name,
- lib_name=name,
- lib_dir='$(location :{})'.format(gen_rule_name),
- deps=deps,
- force_static=False,
- exported_deps=exported_deps,
- visibility=rule_visibility,)
- rules.append(":" + name)
- return rules
- def add_dynamic_libs(names=[]):
- rules = []
- for name in names:
- prebuilt_cxx_library(
- name=name,
- header_only=True,
- exported_linker_flags=["-l" + name],
- visibility=["PUBLIC"],)
- rules.append(":" + name)
- return rules
- system_libs = [
- "lzma",
- "event",
- ]
- local_libs = [
- "double-conversion",
- "boost_regex",
- "boost_context",
- "boost_thread",
- "boost_system",
- "boost_filesystem",
- "boost_program_options",
- "boost_chrono",
- "gflags",
- "glog",
- "protobuf",
- ]
- dynamic_libs = ["stdc++", "pthread", "ssl", "crypto", "dl", "atomic", "unwind"]
- dynamic_rules = add_dynamic_libs(dynamic_libs)
- tp_dep_rules = add_system_libs(system_libs,) \
- + add_system_libs(local_libs, lib_dir = "/usr/local/lib") \
- + dynamic_rules
- zookeeper = add_system_libs(["zookeeper_mt"], lib_dir="/usr/local/lib")
- folly = add_system_libs(
- ['folly'],
- lib_dir='/usr/local/lib',
- exported_deps=tp_dep_rules,)
- folly_bench = add_system_libs(
- ['follybenchmark'],
- lib_dir='/usr/local/lib',
- exported_deps=folly + tp_dep_rules,)
- wangle = add_system_libs(
- ['wangle'], lib_dir='/usr/local/lib', exported_deps=folly + tp_dep_rules)
- genrule(
- name="gen_zk",
- out="gen_zk",
- bash=
- "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*"
- )
- cxx_library(
- name='google-test',
- srcs=[
- 'googletest/googletest/src/gtest-all.cc',
- 'googletest/googlemock/src/gmock-all.cc',
- 'googletest/googlemock/src/gmock_main.cc',
- ],
- header_namespace='',
- exported_headers=subdir_glob([
- ('googletest/googletest/include', '**/*.h'),
- ('googletest/googlemock/include', '**/*.h'),
- ]),
- headers=subdir_glob([
- ('googletest/googletest', 'src/*.h'),
- ('googletest/googletest', 'src/*.cc'),
- ('googletest/googlemock', 'src/*.h'),
- ('googletest/googlemock', 'src/*.cc'),
- ]),
- exported_deps=dynamic_rules,
- visibility=[
- 'PUBLIC',
- ],)
Advertisement
Add Comment
Please, Sign In to add comment