about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/ocaml
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/ocaml')
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/dune/1.nix8
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/dune/2.nix5
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix27
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/oasis/default.nix18
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/ocamlbuild/default.nix10
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/opaline/default.nix3
6 files changed, 50 insertions, 21 deletions
diff --git a/nixpkgs/pkgs/development/tools/ocaml/dune/1.nix b/nixpkgs/pkgs/development/tools/ocaml/dune/1.nix
index ad908787911b..74deb9d2fa55 100644
--- a/nixpkgs/pkgs/development/tools/ocaml/dune/1.nix
+++ b/nixpkgs/pkgs/development/tools/ocaml/dune/1.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, ocaml, findlib }:
+{ stdenv, lib, fetchurl, ocaml, findlib, ncurses }:
 
 if !lib.versionAtLeast ocaml.version "4.02"
 || lib.versionAtLeast ocaml.version "4.12"
@@ -13,7 +13,9 @@ stdenv.mkDerivation rec {
     sha256 = "1rkc8lqw30ifjaz8d81la6i8j05ffd0whpxqsbg6dci16945zjvp";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ ncurses ];
+  strictDeps = true;
 
   buildFlags = [ "release" ];
   makeFlags = [
@@ -22,6 +24,8 @@ stdenv.mkDerivation rec {
   ];
 
   dontAddPrefix = true;
+  dontAddStaticConfigureFlags = true;
+  configurePlatforms = [];
 
   meta = with lib; {
     homepage = "https://dune.build/";
diff --git a/nixpkgs/pkgs/development/tools/ocaml/dune/2.nix b/nixpkgs/pkgs/development/tools/ocaml/dune/2.nix
index 00d593f75107..f80fabedebe4 100644
--- a/nixpkgs/pkgs/development/tools/ocaml/dune/2.nix
+++ b/nixpkgs/pkgs/development/tools/ocaml/dune/2.nix
@@ -13,11 +13,14 @@ stdenv.mkDerivation rec {
     sha256 = "09lzq04b642iy0ljp59p32lgk3q8iphjh8fkdp69q29l5frgwx5k";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+  strictDeps = true;
 
   buildFlags = "release";
 
   dontAddPrefix = true;
+  dontAddStaticConfigureFlags = true;
+  configurePlatforms = [];
 
   installFlags = [ "PREFIX=${placeholder "out"}" "LIBDIR=$(OCAMLFIND_DESTDIR)" ];
 
diff --git a/nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix b/nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix
index 2286c0945fcf..497a8ce91c1d 100644
--- a/nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix
+++ b/nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix
@@ -9,25 +9,23 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-K0K4vVRIjWTEvzy3BUtLN70wwdwSvUMeoeTXrYqYD+I=";
   };
 
-  buildInputs = [m4 ncurses ocaml];
+  nativeBuildInputs = [m4 ocaml];
+  buildInputs = [ ncurses ];
 
   patches = [ ./ldconf.patch ./install_topfind.patch ];
 
   dontAddPrefix=true;
+  dontAddStaticConfigureFlags = true;
+  configurePlatforms = [];
 
-  preConfigure=''
-    configureFlagsArray=(
-      -bindir $out/bin
-      -mandir $out/share/man
-      -sitelib $out/lib/ocaml/${ocaml.version}/site-lib
-      -config $out/etc/findlib.conf
-    )
-  '';
+  configureFlags = [
+      "-bindir" "${placeholder "out"}/bin"
+      "-mandir" "${placeholder "out"}/share/man"
+      "-sitelib" "${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib"
+      "-config" "${placeholder "out"}/etc/findlib.conf"
+  ];
 
-  buildPhase = ''
-    make all
-    make opt
-  '';
+  buildFlags = [ "all" "opt" ];
 
   setupHook = writeText "setupHook.sh" ''
     addOCamlPath () {
@@ -37,6 +35,8 @@ stdenv.mkDerivation rec {
         if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"; then
             export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"
         fi
+    }
+    createOcamlDestDir () {
         export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/"
         if test -n "''${createFindlibDestdir-}"; then
           mkdir -p $OCAMLFIND_DESTDIR
@@ -44,6 +44,7 @@ stdenv.mkDerivation rec {
     }
 
     addEnvHooks "$targetOffset" addOCamlPath
+    preConfigureHooks+=(createOcamlDestDir)
   '';
 
   meta = {
diff --git a/nixpkgs/pkgs/development/tools/ocaml/oasis/default.nix b/nixpkgs/pkgs/development/tools/ocaml/oasis/default.nix
index 6854c7c20ca3..10c7bf63aa41 100644
--- a/nixpkgs/pkgs/development/tools/ocaml/oasis/default.nix
+++ b/nixpkgs/pkgs/development/tools/ocaml/oasis/default.nix
@@ -18,9 +18,21 @@ stdenv.mkDerivation {
       ocaml findlib ocamlbuild ocamlmod ocamlify
     ];
 
-  configurePhase = "ocaml setup.ml -configure --prefix $out";
-  buildPhase     = "ocaml setup.ml -build";
-  installPhase   = "ocaml setup.ml -install";
+  configurePhase = ''
+    runHook preConfigure
+    ocaml setup.ml -configure --prefix $out
+    runHook postConfigure
+  '';
+  buildPhase = ''
+    runHook preBuild
+    ocaml setup.ml -build
+    runHook postBuild
+  '';
+  installPhase = ''
+    runHook preInstall
+    ocaml setup.ml -install
+    runHook postInstall
+  '';
 
   meta = with lib; {
     homepage = "http://oasis.forge.ocamlcore.org/";
diff --git a/nixpkgs/pkgs/development/tools/ocaml/ocamlbuild/default.nix b/nixpkgs/pkgs/development/tools/ocaml/ocamlbuild/default.nix
index 926838ede545..e3043d46ee5e 100644
--- a/nixpkgs/pkgs/development/tools/ocaml/ocamlbuild/default.nix
+++ b/nixpkgs/pkgs/development/tools/ocaml/ocamlbuild/default.nix
@@ -12,14 +12,22 @@ stdenv.mkDerivation rec {
 
   createFindlibDestdir = true;
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+  strictDeps = true;
+
+  # x86_64-unknown-linux-musl-ld: -r and -pie may not be used together
+  hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
 
   configurePhase = ''
+  runHook preConfigure
+
   make -f configure.make Makefile.config \
     "OCAMLBUILD_PREFIX=$out" \
     "OCAMLBUILD_BINDIR=$out/bin" \
     "OCAMLBUILD_MANDIR=$out/share/man" \
     "OCAMLBUILD_LIBDIR=$OCAMLFIND_DESTDIR"
+
+  runHook postConfigure
   '';
 
   meta = with lib; {
diff --git a/nixpkgs/pkgs/development/tools/ocaml/opaline/default.nix b/nixpkgs/pkgs/development/tools/ocaml/opaline/default.nix
index 9cdacd289d49..d9ba33bb473e 100644
--- a/nixpkgs/pkgs/development/tools/ocaml/opaline/default.nix
+++ b/nixpkgs/pkgs/development/tools/ocaml/opaline/default.nix
@@ -11,7 +11,8 @@ stdenv.mkDerivation rec {
     sha256 = "1aj1fdqymq3pnr39h47hn3kxk5v9pnwx0jap1z2jzh78x970z21m";
   };
 
-  buildInputs = with ocamlPackages; [ ocaml findlib ocamlbuild opam-file-format ];
+  nativeBuildInputs = with ocamlPackages; [ ocaml findlib ocamlbuild ];
+  buildInputs = with ocamlPackages; [ opam-file-format ];
 
   preInstall = "mkdir -p $out/bin";