2022-11-21 17:40:18 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, ocaml, writeText }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
lib.throwIfNot (lib.versionAtLeast ocaml.version "4.03")
|
|
|
|
"camlidl is not available for OCaml ${ocaml.version}"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ocaml${ocaml.version}-camlidl";
|
|
|
|
version = "1.11";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xavierleroy";
|
|
|
|
repo = "camlidl";
|
|
|
|
rev = "camlidl111";
|
|
|
|
sha256 = "sha256-8m0zem/6nvpEJtjJNP/+vafeVLlMvNQGdl8lyf/OeBg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [ ocaml ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
# build fails otherwise
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preBuild = ''
|
|
|
|
mv config/Makefile.unix config/Makefile
|
|
|
|
substituteInPlace config/Makefile --replace BINDIR=/usr/local/bin BINDIR=$out
|
2022-11-21 17:40:18 +00:00
|
|
|
substituteInPlace config/Makefile --replace 'OCAMLLIB=$(shell $(OCAMLC) -where)' OCAMLLIB=$out/lib/ocaml/${ocaml.version}/site-lib/camlidl
|
|
|
|
substituteInPlace config/Makefile --replace CPP=cpp CPP=${stdenv.cc}/bin/cpp
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/camlidl/caml
|
2022-11-21 17:40:18 +00:00
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/camlidl/stublibs
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
cat >$out/lib/ocaml/${ocaml.version}/site-lib/camlidl/META <<EOF
|
|
|
|
# Courtesy of GODI
|
|
|
|
description = "Stub generator"
|
|
|
|
version = "${version}"
|
|
|
|
archive(byte) = "com.cma"
|
|
|
|
archive(native) = "com.cmxa"
|
|
|
|
EOF
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -s $out/camlidl $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
setupHook = writeText "setupHook.sh" ''
|
|
|
|
export NIX_CFLAGS_COMPILE+=" -isystem $1/lib/ocaml/${ocaml.version}/site-lib/camlidl"
|
|
|
|
export NIX_LDFLAGS+=" -L $1/lib/ocaml/${ocaml.version}/site-lib/camlidl"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A stub code generator and COM binding for Objective Caml";
|
2022-11-21 17:40:18 +00:00
|
|
|
homepage = "https://xavierleroy.org/camlidl/";
|
|
|
|
license = lib.licenses.lgpl21;
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = [ lib.maintainers.roconnor ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|