Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
Release 0.11.1
  • Loading branch information
ilammy committed Apr 1, 2019
2 parents 8b937ed + 0dcba1f commit 39d995c
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 22 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ SHARED_BINARY_LIBRARY_MAP = $(foreach file,$(SHARED_LIBRARY_FILES),$(strip $(BIN
PKGCONFIG_FILES = $(shell ls $(BIN_PATH)/ | egrep *\.pc$$)
PKGCONFIG_MAP = $(foreach file,$(PKGCONFIG_FILES),$(strip $(BIN_PATH)/$(file)=$(PREFIX)/lib/pkgconfig/$(file)))

BINARY_LIBRARY_MAP = $(strip $(STATIC_BINARY_LIBRARY_MAP) $(SHARED_BINARY_LIBRARY_MAP) $(PKGCONFIG_MAP))
BINARY_LIBRARY_MAP = $(strip $(STATIC_BINARY_LIBRARY_MAP) $(SHARED_BINARY_LIBRARY_MAP))

POST_INSTALL_SCRIPT := $(BIN_PATH)/post_install.sh
POST_UNINSTALL_SCRIPT := $(BIN_PATH)/post_uninstall.sh
Expand All @@ -673,7 +673,7 @@ symlink_realname_to_soname:
strip:
@find . -name \*.$(SHARED_EXT)\.* -exec strip -o {} {} \;

deb: soter_static themis_static soter_shared themis_shared collect_headers install_shell_scripts strip symlink_realname_to_soname
deb: soter_static themis_static soter_shared themis_shared soter_pkgconfig themis_pkgconfig collect_headers install_shell_scripts strip symlink_realname_to_soname
@mkdir -p $(BIN_PATH)/deb

#libPACKAGE-dev
Expand All @@ -692,7 +692,7 @@ deb: soter_static themis_static soter_shared themis_shared collect_headers insta
--after-install $(POST_INSTALL_SCRIPT) \
--after-remove $(POST_UNINSTALL_SCRIPT) \
--category $(PACKAGE_CATEGORY) \
$(HEADER_FILES_MAP)
$(HEADER_FILES_MAP) $(PKGCONFIG_MAP)

#libPACKAGE
@fpm --input-type dir \
Expand All @@ -716,7 +716,7 @@ deb: soter_static themis_static soter_shared themis_shared collect_headers insta
@find $(BIN_PATH) -name \*.deb


rpm: themis_static themis_shared soter_static soter_shared collect_headers install_shell_scripts strip symlink_realname_to_soname
rpm: themis_static themis_shared themis_pkgconfig soter_static soter_shared soter_pkgconfig collect_headers install_shell_scripts strip symlink_realname_to_soname
@mkdir -p $(BIN_PATH)/rpm
#libPACKAGE-devel
@fpm --input-type dir \
Expand All @@ -733,7 +733,7 @@ rpm: themis_static themis_shared soter_static soter_shared collect_headers insta
--package $(BIN_PATH)/rpm/$(PACKAGE_NAME)-devel-$(NAME_SUFFIX) \
--version $(RPM_VERSION) \
--category $(PACKAGE_CATEGORY) \
$(HEADER_FILES_MAP)
$(HEADER_FILES_MAP) $(PKGCONFIG_MAP)

#libPACKAGE
@fpm --input-type dir \
Expand Down
10 changes: 10 additions & 0 deletions src/wrappers/themis/rust/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@

The version currently in development.

Version 0.11.1 - 2019-04-01
===========================

## Internal improvements

- `libthemis-sys` is now able to use core Themis library installed in
standard system paths, without _pkg-config_ assistance. ([#444])

[#444]: https://github.com/cossacklabs/themis/pull/444

Version 0.11.0 — 2019-03-28
===========================

Expand Down
4 changes: 2 additions & 2 deletions src/wrappers/themis/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "themis"
version = "0.11.0"
version = "0.11.1"
edition = "2018"
authors = ["rust-themis developers"]
description = "High-level cryptographic services for storage and messaging"
Expand All @@ -27,7 +27,7 @@ maintenance = { status = "actively-developed" }
vendored = ["bindings/vendored"]

[dependencies]
bindings = { package = "libthemis-sys", path = "libthemis-sys", version = "=0.11.0" }
bindings = { package = "libthemis-sys", path = "libthemis-sys", version = "0.11.1" }
zeroize = "0.5.2"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/wrappers/themis/rust/libthemis-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libthemis-sys"
version = "0.11.0"
version = "0.11.1"
edition = "2018"
authors = ["rust-themis developers"]
description = "FFI binding to libthemis"
Expand All @@ -22,7 +22,7 @@ vendored = ["libthemis-src"]
[build-dependencies]
bindgen = "0.46.0"
cc = "1.0.28"
libthemis-src = { path = "../libthemis-src", version = "=0.11.0", optional = true }
libthemis-src = { path = "../libthemis-src", version = "0.11.0", optional = true }
pkg-config = "0.3.14"

[package.metadata.docs.rs]
Expand Down
70 changes: 58 additions & 12 deletions src/wrappers/themis/rust/libthemis-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use std::env;
use std::path::{Path, PathBuf};

use pkg_config::Library;

fn main() {
let themis = get_themis();

Expand All @@ -38,6 +36,11 @@ fn main() {
.expect("writing bindings!");
}

struct Library {
include_paths: Vec<PathBuf>,
link_paths: Vec<PathBuf>,
}

/// Embarks on an incredible adventure and returns with a suitable Themis (or dies trying).
fn get_themis() -> Library {
#[cfg(feature = "vendored")]
Expand All @@ -50,15 +53,20 @@ fn get_themis() -> Library {
pkg_config.statik(true);

match pkg_config.probe("libthemis") {
Ok(library) => return library,
Err(error) => panic!(format!(
"
Ok(library) => {
return Library {
include_paths: library.include_paths,
link_paths: library.link_paths,
};
}
Err(error) => {
eprintln!(
"
`libthemis-sys` could not find Themis installation in your system.
Please make sure you have appropriate development package installed.
On Linux it's called `libthemis-dev`, not just `libthemis`.
On macOS Homebrew formula is called `themis` or `themis-openssl`.
On macOS Homebrew formula is called `libthemis`.
Please refer to the documentation for installation instructions:
Expand All @@ -68,11 +76,30 @@ This crate uses `pkg-config` to locate the library. If you use
non-standard installation of Themis then you can help pkg-config
to locate your library by setting the PKG_CONFIG_PATH environment
variable to the path where `libthemis.pc` file is located.
{}
",
error
)),
"
);
eprintln!("{}", error);

if let Some(library) = try_system_themis() {
eprintln!(
"\
`libthemis-sys` tried using standard system paths and it seems that Themis
is available on your system. (However, pkg-config failed to find it.)
We will link against the system library.
"
);
return library;
} else {
eprintln!(
"\
`libthemis-sys` also tried to use standard system paths, but without success.
It seems that Themis is really not installed in your system.
"
);
}

panic!("Themis Core not installed");
}
}
}

Expand Down Expand Up @@ -111,3 +138,22 @@ impl CCBuildEx for cc::Build {
self
}
}

fn try_system_themis() -> Option<Library> {
let mut build = cc::Build::new();
build.file("src/dummy.c");
build.flag("-lthemis");

match build.try_compile("dummy") {
Ok(_) => {
println!("cargo:rustc-link-lib=dylib=themis");

// Use only system paths for header and library lookup.
Some(Library {
include_paths: vec![],
link_paths: vec![],
})
}
Err(_) => None,
}
}
22 changes: 22 additions & 0 deletions src/wrappers/themis/rust/libthemis-sys/src/dummy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2019 (c) rust-themis developers
//
// Licensed 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.

//! Dummy file used to verify that the compiler sees native Themis library.

#include <themis/themis.h>

void libthemis_sys_unused(void)
{
themis_gen_ec_key_pair(NULL, NULL, NULL, NULL);
}
2 changes: 1 addition & 1 deletion third_party/boringssl/src
Submodule src updated from 0a54e9 to 749442

0 comments on commit 39d995c

Please sign in to comment.