nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 pkg-config,
7 openssl,
8 boost,
9 testers,
10 asioVersion ? "1.36.0",
11}:
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "asio";
15 version = asioVersion;
16
17 src = fetchFromGitHub {
18 owner = "chriskohlhoff";
19 repo = "asio";
20 tag = "asio-${lib.replaceStrings [ "." ] [ "-" ] finalAttrs.version}";
21 hash =
22 {
23 # Preserve 1.32.0 because some project depends on asio/io_service.hpp
24 "1.32.0" = "sha256-PBoa4OAOOmHas9wCutjz80rWXc3zGONntb9vTQk3FNY=";
25 "1.36.0" = "sha256-BhJpE5+t0WXsuQ5CtncU0P8Kf483uFoV+OGlFLc7TpQ=";
26 }
27 .${asioVersion} or (throw "Unsupported asio version. Please use overrideAttrs directly");
28 };
29
30 sourceRoot = "${finalAttrs.src.name}/asio";
31
32 nativeBuildInputs = [
33 autoreconfHook
34 pkg-config
35 ];
36
37 # Only used for test coverage
38 checkInputs = [
39 openssl
40 boost
41 ];
42
43 configureFlags = lib.optionals finalAttrs.finalPackage.doCheck [
44 # Only used in tests, "HAVE_BOOST_COROUTINE"
45 "--enable-boost-coroutine"
46
47 # There is also the "--with-boost" flag, but
48 # after several tests, it doesn't make any difference
49 # in the output.
50 ];
51
52 enableParallelBuilding = true;
53
54 doCheck = true;
55
56 passthru.tests.pkg-config = testers.hasPkgConfigModules {
57 package = finalAttrs.finalPackage;
58 versionCheck = true;
59 };
60
61 meta = {
62 homepage = "https://think-async.com/Asio";
63 description = "Cross-platform C++ library for network and low-level I/O programming";
64 license = lib.licenses.boost;
65 maintainers = with lib.maintainers; [ aleksana ];
66 platforms = lib.platforms.unix;
67 pkgConfigModules = [ "asio" ];
68 };
69})