2022-11-12 06:05:58 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, ocaml, writeText }:
|
2016-10-05 07:32:30 +00:00
|
|
|
|
2022-11-12 06:05:58 +00:00
|
|
|
lib.throwIfNot (lib.versionAtLeast ocaml.version "4.03")
|
|
|
|
"camlidl is not available for OCaml ${ocaml.version}"
|
2011-10-04 01:40:45 +00:00
|
|
|
|
2022-11-12 06:05:58 +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=";
|
2011-10-04 01:40:45 +00:00
|
|
|
};
|
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
nativeBuildInputs = [ ocaml ];
|
2011-10-04 01:40:45 +00:00
|
|
|
|
2022-02-02 10:57:19 +00:00
|
|
|
# build fails otherwise
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
2011-10-04 01:40:45 +00:00
|
|
|
preBuild = ''
|
|
|
|
mv config/Makefile.unix config/Makefile
|
|
|
|
substituteInPlace config/Makefile --replace BINDIR=/usr/local/bin BINDIR=$out
|
2022-11-12 06:05:58 +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
|
2016-10-05 07:32:30 +00:00
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/camlidl/caml
|
2022-11-12 06:05:58 +00:00
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/camlidl/stublibs
|
2011-10-04 01:40:45 +00:00
|
|
|
'';
|
|
|
|
|
2015-01-25 21:08:33 +00:00
|
|
|
postInstall = ''
|
2016-10-05 07:32:30 +00:00
|
|
|
cat >$out/lib/ocaml/${ocaml.version}/site-lib/camlidl/META <<EOF
|
2015-01-25 21:08:33 +00:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2017-06-15 18:37:43 +00:00
|
|
|
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"
|
|
|
|
'';
|
|
|
|
|
2011-10-04 01:40:45 +00:00
|
|
|
meta = {
|
2015-04-30 15:05:14 +00:00
|
|
|
description = "A stub code generator and COM binding for Objective Caml";
|
2022-11-12 06:05:58 +00:00
|
|
|
homepage = "https://xavierleroy.org/camlidl/";
|
|
|
|
license = lib.licenses.lgpl21;
|
2021-01-23 12:26:19 +00:00
|
|
|
maintainers = [ lib.maintainers.roconnor ];
|
2011-10-04 01:40:45 +00:00
|
|
|
};
|
|
|
|
}
|