fansehep commented on issue #1992:
URL: 
https://github.com/apache/incubator-brpc/issues/1992#issuecomment-1316267576

   > @fansehep
   > 
   > ```
   > http_archive(
   >     name = "rules_perl",  # 2021-09-23T03:21:58Z
   >     sha256 = 
"55fbe071971772758ad669615fc9aac9b126db6ae45909f0f36de499f6201dd3",
   >     strip_prefix = "rules_perl-2f4f36f454375e678e81e5ca465d4d497c5c02da",
   >     urls = [
   >         
"https://github.com/bazelbuild/rules_perl/archive/2f4f36f454375e678e81e5ca465d4d497c5c02da.tar.gz";,
   >     ],
   > )
   > # Use rules_foreign_cc as fewer as possible.
   > #
   > # 1. Build very basic libraries without any further dependencies.
   > # 2. Build too complex to bazelize library.
   > http_archive(
   >     name = "rules_foreign_cc",
   >     sha256 = 
"2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
   >     strip_prefix = "rules_foreign_cc-0.9.0",
   >     url = 
"https://github.com/bazelbuild/rules_foreign_cc/archive/0.9.0.tar.gz";,
   > )
   > #
   > # Starlark rules
   > #
   > load("@rules_foreign_cc//foreign_cc:repositories.bzl", 
"rules_foreign_cc_dependencies")
   > rules_foreign_cc_dependencies()
   > #
   > # Perl Dependencies
   > # (Required by building openssl)
   > #
   > load("@rules_perl//perl:deps.bzl", "perl_register_toolchains", 
"perl_rules_dependencies")
   > perl_rules_dependencies()
   > perl_register_toolchains()
   > 
   > # bRPC cannot use boringssl. Build openssl.
   > http_archive(
   >    name = "openssl",  # 2022-11-1
   >    build_file = "//third_party/openssl:openssl.foreign_rules.BUILD",
   >    sha256 = 
"c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa",
   >    strip_prefix = "openssl-1.1.1s",
   >    urls = [
   >        "https://www.openssl.org/source/openssl-1.1.1s.tar.gz";,
   >    ],
   > )
   > ```
   > 
   > `openssl.foreign_rules.BUILD`
   > 
   > ```
   > """An openssl build file based on a snippet found in the github issue:
   > https://github.com/bazelbuild/rules_foreign_cc/issues/337
   > 
   > Note that the $(PERL) "make variable" 
(https://docs.bazel.build/versions/main/be/make-variables.html)
   > is populated by the perl toolchain provided by rules_perl.
   > """
   > 
   > load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make", 
"configure_make_variant")
   > 
   > # Read https://wiki.openssl.org/index.php/Compilation_and_Installation
   > 
   > filegroup(
   >     name = "all_srcs",
   >     srcs = glob(
   >         include = ["**"],
   >         exclude = ["*.bazel"],
   >     ),
   > )
   > 
   > CONFIGURE_OPTIONS = [
   >     "no-comp",
   >     "no-idea",
   >     "no-weak-ssl-ciphers",
   >     "no-shared",
   > ]
   > 
   > LIB_NAME = "openssl"
   > 
   > MAKE_TARGETS = [
   >     "build_libs",
   >     "install_dev",
   > ]
   > 
   > config_setting(
   >     name = "msvc_compiler",
   >     flag_values = {
   >         "@bazel_tools//tools/cpp:compiler": "msvc-cl",
   >     },
   >     visibility = ["//visibility:public"],
   > )
   > 
   > alias(
   >     name = "openssl",
   >     actual = "openssl_default",
   >     visibility = ["//visibility:public"],
   > )
   > 
   > alias(
   >     name = "ssl",
   >     actual = "openssl_default",
   >     visibility = ["//visibility:public"],
   > )
   > 
   > alias(
   >     name = "crypto",
   >     actual = "openssl_default",
   >     visibility = ["//visibility:public"],
   > )
   > 
   > configure_make(
   >     name = "openssl_default",
   >     configure_command = "config",
   >     configure_in_place = True,
   >     configure_options = CONFIGURE_OPTIONS,
   >     args = ["-j `nproc`"],
   >     env = select({
   >         "@platforms//os:macos": {
   >             "AR": "",
   >             "PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
   >         },
   >         "//conditions:default": {
   >             "PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
   >         },
   >     }),
   >     lib_name = LIB_NAME,
   >     lib_source = ":all_srcs",
   >     copts = ["-fPIC"],
   >     # Note that for Linux builds, libssl must come before libcrypto on the 
linker command-line.
   >     # As such, libssl must be listed before libcrypto
   >     out_static_libs = [
   >         "libssl.a",
   >         "libcrypto.a",
   >     ],
   >     targets = MAKE_TARGETS,
   >     toolchains = ["@rules_perl//:current_toolchain"],
   > )
   > 
   > filegroup(
   >     name = "gen_dir",
   >     srcs = [":openssl"],
   >     output_group = "gen_dir",
   >     visibility = ["//visibility:public"],
   > )
   > ```
   
   Thank you. but it seems not only openssl. and leveldb or other deps. I know 
how to solve it. you can see my new pr.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to