2020-08-14 18:26:05 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitLab
|
|
|
|
, lib
|
|
|
|
, darwin
|
|
|
|
, git
|
|
|
|
, nettle
|
|
|
|
# Use the same llvmPackages version as Rust
|
|
|
|
, llvmPackages_10
|
|
|
|
, cargo
|
|
|
|
, rustc
|
|
|
|
, rustPlatform
|
|
|
|
, pkg-config
|
|
|
|
, glib
|
|
|
|
, openssl
|
|
|
|
, sqlite
|
|
|
|
, capnproto
|
|
|
|
, ensureNewerSourcesForZipFilesHook
|
|
|
|
, pythonSupport ? true
|
|
|
|
, pythonPackages ? null
|
2019-07-31 09:07:19 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert pythonSupport -> pythonPackages != null;
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "sequoia";
|
2021-02-06 16:04:41 +00:00
|
|
|
# Upstream has separate version numbering for the library and the CLI frontend.
|
|
|
|
# This derivation provides the CLI frontend, and thus uses its version number.
|
2021-05-12 21:42:17 +01:00
|
|
|
version = "0.25.0";
|
2019-07-31 09:07:19 +01:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "sequoia-pgp";
|
2020-08-14 18:26:05 +01:00
|
|
|
repo = "sequoia";
|
2021-02-06 16:04:41 +00:00
|
|
|
rev = "sq/v${version}";
|
2021-05-12 21:42:17 +01:00
|
|
|
sha256 = "13f582g10vba0cpbdmqkkfzgd5jgagb640jaz1w425wf5nbh6q50";
|
2019-07-31 09:07:19 +01:00
|
|
|
};
|
|
|
|
|
2021-05-12 21:42:17 +01:00
|
|
|
cargoSha256 = "sha256-qIGP48uj2iQ6MVgy5anKI9QrX9vnuKh46Fmmcczda4w=";
|
2019-07-31 09:07:19 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2020-08-14 18:26:05 +01:00
|
|
|
pkg-config
|
2019-07-31 09:07:19 +01:00
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
git
|
2021-05-17 23:40:10 +01:00
|
|
|
llvmPackages_10.libclang.lib
|
2020-08-14 18:26:05 +01:00
|
|
|
llvmPackages_10.clang
|
2019-07-31 09:07:19 +01:00
|
|
|
ensureNewerSourcesForZipFilesHook
|
2020-03-29 09:23:57 +01:00
|
|
|
capnproto
|
2019-07-31 09:07:19 +01:00
|
|
|
] ++
|
|
|
|
lib.optionals pythonSupport [ pythonPackages.setuptools ]
|
|
|
|
;
|
|
|
|
|
|
|
|
checkInputs = lib.optionals pythonSupport [
|
|
|
|
pythonPackages.pytest
|
2021-07-20 22:07:53 +01:00
|
|
|
pythonPackages.pytest-runner
|
2019-07-31 09:07:19 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
nettle
|
2020-03-29 09:23:57 +01:00
|
|
|
] ++ lib.optionals pythonSupport [ pythonPackages.python pythonPackages.cffi ]
|
2019-07-31 09:07:19 +01:00
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]
|
|
|
|
;
|
|
|
|
|
|
|
|
makeFlags = [
|
2019-09-03 17:38:57 +01:00
|
|
|
"PREFIX=${placeholder "out"}"
|
2020-10-26 12:18:42 +00:00
|
|
|
# Defaults to "ginstall" from some reason, although upstream's Makefiles check uname
|
|
|
|
"INSTALL=install"
|
2019-07-31 09:07:19 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"build-release"
|
|
|
|
];
|
|
|
|
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 09:23:57 +01:00
|
|
|
LIBCLANG_PATH = "${llvmPackages_10.libclang.lib}/lib";
|
2019-07-31 09:07:19 +01:00
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
# Sometimes, tests fail on CI (ofborg) & hydra without this
|
|
|
|
CARGO_TEST_ARGS = "--workspace --exclude sequoia-store";
|
2020-06-17 11:44:24 +01:00
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
# Without this, the examples won't build
|
2019-07-31 09:07:19 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace openpgp-ffi/examples/Makefile \
|
|
|
|
--replace '-O0 -g -Wall -Werror' '-g'
|
|
|
|
substituteInPlace ffi/examples/Makefile \
|
|
|
|
--replace '-O0 -g -Wall -Werror' '-g'
|
|
|
|
'';
|
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
|
2019-07-31 09:07:19 +01:00
|
|
|
preInstall = lib.optionalString pythonSupport ''
|
|
|
|
export installFlags="PYTHONPATH=$PYTHONPATH:$out/${pythonPackages.python.sitePackages}"
|
|
|
|
'' + lib.optionalString (!pythonSupport) ''
|
2020-08-14 18:26:05 +01:00
|
|
|
export makeFlags="PYTHON=disable"
|
2019-07-31 09:07:19 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Don't use buildRustPackage phases, only use it for rust deps setup
|
|
|
|
configurePhase = null;
|
|
|
|
buildPhase = null;
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = null;
|
|
|
|
installPhase = null;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-07-31 09:07:19 +01:00
|
|
|
description = "A cool new OpenPGP implementation";
|
|
|
|
homepage = "https://sequoia-pgp.org/";
|
2021-08-31 16:10:47 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2019-07-31 09:07:19 +01:00
|
|
|
maintainers = with maintainers; [ minijackson doronbehar ];
|
|
|
|
};
|
|
|
|
}
|