Skip to content

Commit

Permalink
remove pkg-config hack
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Apr 2, 2023
1 parent 4f9ac23 commit 34f688d
Showing 1 changed file with 20 additions and 37 deletions.
57 changes: 20 additions & 37 deletions ocaml/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ oself: osuper:
let
nativeCairo = cairo;
lmdb-pkg = lmdb;
pkg-config-script =
let
pkg-config-pkg =
if stdenv.cc.targetPrefix == ""
then "${pkg-config}/bin/pkg-config"
else "${stdenv.cc.targetPrefix}pkg-config";
in
writeScriptBin "pkg-config" ''
#!${stdenv.shell}
${pkg-config-pkg} $@
'';

disableTests = d: d.overrideAttrs (_: { doCheck = false; });
addBase = p: p.overrideAttrs (o: {
propagatedBuildInputs = o.propagatedBuildInputs ++ [ oself.base ];
Expand Down Expand Up @@ -152,11 +140,19 @@ with oself;
});

bigarray-overlap = osuper.bigarray-overlap.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config ];
postPatch = ''
substituteInPlace ./freestanding/Makefile --replace "pkg-config" "\$(PKG_CONFIG)"
'';
});

bigstringaf = osuper.bigstringaf.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config ];
buildInputs = [ dune-configurator ];
src = fetchFromGitHub {
owner = "inhabitedtype";
repo = "bigstringaf";
rev = "0.9.1";
hash = "sha256-SFp5QBb4GDcTzEzvgkGKCiuUUm1k8jlgjP6ndzcQBP8=";
};
});

binaryen = callPackage ./binaryen { };
Expand Down Expand Up @@ -227,7 +223,6 @@ with oself;
url = https://github.com/mirage/checkseum/releases/download/v0.5.0/checkseum-0.5.0.tbz;
sha256 = "0bnyzxvagc4cvpz0a434xngk9ra1mjjh67nhyv3qz5ghk5s6a5bv";
};
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script ];
});

coin = osuper.coin.overrideAttrs (_: {
Expand Down Expand Up @@ -403,9 +398,6 @@ with oself;
];
};

angstrom = osuper.angstrom.overrideAttrs (_: {
doCheck = false;
});
cookie = callPackage ./cookie { };
session-cookie = callPackage ./cookie/session.nix { };
session-cookie-lwt = callPackage ./cookie/session-lwt.nix { };
Expand All @@ -429,7 +421,7 @@ with oself;
sha256 = "sha256-YMaKJK8gqsUdYglB4xGdMUpTXbgUgZLLvUG/lSvJesE=";
};

nativeBuildInputs = [ pkg-config pkg-config-script ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ dune-configurator ];
propagatedBuildInputs = [ integers bigarray-compat libffi-oc.dev ];

Expand Down Expand Up @@ -562,8 +554,8 @@ with oself;
repo = "dune";
# rev = "649031728346482a83441c26c0bbe06ecd89cce2";
# hash = "sha256-IbvAumstRp7JE+UQDArrwYWyZtbe8q8bZo05eVzA/MU=";
rev = "69bc73c86a45fb72408994e0cbd49e5314e5c2ff";
hash = "sha256-SxCSQZZDHcu29ULdmQ+n9LAzxvUbzCj7IaiuB30zuZg=";
rev = "1264b11fa71257acb4a396e74dd1a7b63d4f321f";
hash = "sha256-t6qEDUrVlJcq0REjDMqmThPjejQIwPyg6MfIraYYP0I=";
};
nativeBuildInputs = o.nativeBuildInputs ++ [ makeWrapper ];

Expand Down Expand Up @@ -940,10 +932,6 @@ with oself;
propagatedBuildInputs = [ lev-fiber csexp ];
} else null;

digestif = osuper.digestif.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config ];
});

lmdb = buildDunePackage {
pname = "lmdb";
version = "1.0";
Expand All @@ -953,7 +941,7 @@ with oself;
rev = "1.0";
sha256 = "sha256-NbiM7xNpuihzqAMiAaYXVeItspWufnr1/e3WZEkMhsA=";
};
nativeBuildInputs = [ pkg-config-script pkg-config ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ lmdb-pkg dune-configurator ];
propagatedBuildInputs = [ bigstringaf ];
};
Expand Down Expand Up @@ -993,9 +981,7 @@ with oself;
sha256 = "sha256-QIxKQEoA5EOGqhwCKdIWQ09RhPKYoleTWdbT1GI397o=";
};

nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config cppo ];
propagatedBuildInputs = [ libev-oc ocplib-endian ];

postPatch = ''
substituteInPlace src/unix/dune --replace "bigarray" ""
'';
Expand Down Expand Up @@ -1025,12 +1011,6 @@ with oself;
sha256 = "176dywi6d1s1jn1g1c8f9bznj1r6ajgqp5g196fgszld52598dfq";
};
});
mirage-crypto = osuper.mirage-crypto.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config ];
});
mirage-crypto-ec = osuper.mirage-crypto-ec.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config ];
});
mirage-crypto-pk = osuper.mirage-crypto-pk.override { gmp = gmp-oc; };

# `mirage-fs` needs to be updated to match `mirage-kv`'s new interface
Expand Down Expand Up @@ -1194,7 +1174,11 @@ with oself;
ocamlformat-rpc-lib = callPackage ./ocamlformat/rpc-lib.nix { };

ocaml_sqlite3 = osuper.ocaml_sqlite3.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config ];
postPatch = ''
substituteInPlace "src/config/discover.ml" --replace \
'let cmd = pkg_export ^ " pkg-config ' \
'let cmd = let pkg_config = match Sys.getenv "PKG_CONFIG" with | s -> s | exception Not_found -> "pkg-config" in pkg_export ^ " " ^ pkg_config ^ " '
'';
});

odep = buildDunePackage {
Expand Down Expand Up @@ -1331,7 +1315,7 @@ with oself;
sha256 = "0n621cxb9012pj280c7821qqsdhypj8qy9qgrah79dkh6a8h2py6";
};

nativeBuildInputs = [ pkg-config-script pkg-config ocaml findlib ];
nativeBuildInputs = [ pkg-config ocaml findlib ];
propagatedBuildInputs = [ curl lwt ];
createFindlibDestdir = true;
};
Expand Down Expand Up @@ -1450,7 +1434,6 @@ with oself;
postPatch = ''
substituteInPlace src/dune --replace " bigarray" ""
'';
nativeBuildInputs = o.nativeBuildInputs ++ [ pkg-config-script pkg-config ];
propagatedBuildInputs = [ libpq ];
});

Expand Down

0 comments on commit 34f688d

Please sign in to comment.