nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 pkgs,
3 lib,
4 stdenv,
5 fetchFromGitHub,
6 fetchpatch,
7 cmake,
8 withStatic ? stdenv.hostPlatform.isStatic,
9 withShared ? !withStatic,
10 buildExamples ? false,
11}:
12
13# Ensure build examples with static library.
14assert buildExamples -> withStatic;
15
16stdenv.mkDerivation (finalAttrs: {
17 pname = "sobjectizer";
18 version = "5.8.4";
19
20 src = fetchFromGitHub {
21 owner = "Stiffstream";
22 repo = "sobjectizer";
23 tag = "v.${finalAttrs.version}";
24 hash = "sha256-tIqWgd6TppHfqZk3XHzhG0t+Nn8BQCTP81UD7ls67UE=";
25 };
26
27 patches = [
28 (fetchpatch {
29 name = "tests-do-not-require-static-library.patch";
30 url = "https://github.com/Stiffstream/sobjectizer/commit/10eb34c65ccdaa4fea62d0c4354b83104256370d.patch";
31 hash = "sha256-a2g6jDGDC/y8cmbAD0KtVQKhVS5ZAjKtMhbAUyoQIvg=";
32 })
33 ];
34
35 nativeBuildInputs = [ cmake ];
36
37 cmakeDir = "../dev";
38
39 cmakeFlags = [
40 (lib.cmakeBool "SOBJECTIZER_BUILD_STATIC" withStatic)
41 (lib.cmakeBool "SOBJECTIZER_BUILD_SHARED" withShared)
42 (lib.cmakeBool "BUILD_EXAMPLES" (buildExamples && withStatic))
43 (lib.cmakeBool "BUILD_TESTS" (finalAttrs.doCheck && withShared))
44 ];
45
46 # The tests require the shared library thanks to the patch.
47 doCheck = withShared;
48
49 # Receive semi-automated updates.
50 passthru.updateScript = pkgs.nix-update-script { };
51
52 meta = {
53 homepage = "https://github.com/Stiffstream/sobjectizer/tree/master";
54 changelog = "https://github.com/Stiffstream/sobjectizer/releases/tag/v.${finalAttrs.version}";
55 description = "Implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework";
56 license = lib.licenses.bsd3;
57 maintainers = [ lib.maintainers.ivalery111 ];
58 platforms = lib.platforms.all;
59 };
60})