nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 flex,
7 meson,
8 ninja,
9 pkg-config,
10 testers,
11 validatePkgConfig,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "stc";
16 version = "5.0";
17
18 outputs = [
19 "out"
20 "dev"
21 "doc"
22 ];
23
24 src = fetchFromGitHub {
25 owner = "stclib";
26 repo = "STC";
27 tag = "v${finalAttrs.version}";
28 hash = "sha256-JiFyJN+hAbzTHqim1i6TJFmKfHlnOfP3yDLCZDE7uqo=";
29 };
30
31 patches = [
32 # Backport pkg-config support and follow-up fixes from upstream.
33 (fetchpatch {
34 url = "https://github.com/stclib/STC/commit/92751b4d04b2d980d640b28bd22a9cd651d77c6a.patch";
35 hash = "sha256-11sE5pS7sqdfCGsGlvajkfgCf+QIkRFp4Js2//kAI3s=";
36 })
37 (fetchpatch {
38 url = "https://github.com/stclib/STC/commit/0fa9ad03516ba0f71b38674f0ec631929368f385.patch";
39 hash = "sha256-e1rhrKaf9fFAmSi8Puo494iG+hAdHZFzyn8IJoKjdAI=";
40 })
41 ];
42
43 postPatch = ''
44 meson rewrite kwargs set project / version '${finalAttrs.version}'
45 '';
46
47 nativeBuildInputs = [
48 flex
49 meson
50 ninja
51 pkg-config
52 validatePkgConfig
53 ];
54
55 doCheck = true;
56
57 passthru.tests.pkg-config = testers.hasPkgConfigModules {
58 package = finalAttrs.finalPackage;
59 versionCheck = true;
60 };
61
62 meta = {
63 description = "C99 container library with generic and type-safe data structures";
64 homepage = "https://github.com/stclib/STC";
65 changelog = "https://github.com/stclib/STC/releases/tag/v${finalAttrs.version}";
66 license = lib.licenses.mit;
67 maintainers = with lib.maintainers; [ anthonyroussel ];
68 pkgConfigModules = [ "stc" ];
69 };
70})