16dbb5987Sopenharmony_ci// Copyright (c) 2023 Huawei Device Co., Ltd. 26dbb5987Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); 36dbb5987Sopenharmony_ci// you may not use this file except in compliance with the License. 46dbb5987Sopenharmony_ci// You may obtain a copy of the License at 56dbb5987Sopenharmony_ci// 66dbb5987Sopenharmony_ci// http://www.apache.org/licenses/LICENSE-2.0 76dbb5987Sopenharmony_ci// 86dbb5987Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software 96dbb5987Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS, 106dbb5987Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 116dbb5987Sopenharmony_ci// See the License for the specific language governing permissions and 126dbb5987Sopenharmony_ci// limitations under the License. 136dbb5987Sopenharmony_ci 146dbb5987Sopenharmony_ci//! This crate depends on Openssl3.0. 156dbb5987Sopenharmony_ci//! Sets environment variables when use the feature `c_openssl_3_0`. 166dbb5987Sopenharmony_ci//! Needs export ``OPENSSL_LIB_DIR`` and ``OPENSSL_INCLUDE_DIR``. 176dbb5987Sopenharmony_ci//! ``OPENSSL_LIB_DIR`` is the path for ``libssl.so`` and ``libcrypto.so``. 186dbb5987Sopenharmony_ci//! ``OPENSSL_INCLUDE_DIR`` is the path for the Openssl header file. 196dbb5987Sopenharmony_ci 206dbb5987Sopenharmony_ciuse std::env; 216dbb5987Sopenharmony_ci// todo: check if needed 226dbb5987Sopenharmony_cifn main() { 236dbb5987Sopenharmony_ci let lib_dir = env::var("OPENSSL_LIB_DIR"); 246dbb5987Sopenharmony_ci let include_dir = env::var("OPENSSL_INCLUDE_DIR"); 256dbb5987Sopenharmony_ci 266dbb5987Sopenharmony_ci if let Ok(lib_dir) = lib_dir { 276dbb5987Sopenharmony_ci println!("cargo:rustc-link-lib=ssl"); 286dbb5987Sopenharmony_ci println!("cargo:rustc-link-lib=crypto"); 296dbb5987Sopenharmony_ci println!("cargo:rustc-link-search=native={lib_dir}"); 306dbb5987Sopenharmony_ci } 316dbb5987Sopenharmony_ci 326dbb5987Sopenharmony_ci if let Ok(include_dir) = include_dir { 336dbb5987Sopenharmony_ci println!("cargo:include={include_dir}"); 346dbb5987Sopenharmony_ci } 356dbb5987Sopenharmony_ci} 36