summary refs log tree commit diff
path: root/pkgs/development/libraries/physics
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2021-12-20 02:23:11 -0500
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2021-12-20 02:23:11 -0500
commit1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f (patch)
treee6b8a7fe733dbf68295195edbe713063789a3dc7 /pkgs/development/libraries/physics
parent98dd4745c96b0ce8c80cf355e33748eea28651f2 (diff)
downloadnixpkgs-1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f.tar
nixpkgs-1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f.tar.gz
nixpkgs-1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f.tar.bz2
nixpkgs-1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f.tar.lz
nixpkgs-1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f.tar.xz
nixpkgs-1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f.tar.zst
nixpkgs-1e3f4343ae3a2485c97e15a705aa51a56eb6cb1f.zip
cernlib: implement a more complete install using imake
The previous installation and build scheme was not producing a
complete installation. For example, the include headers were missing,
some programs were not installed as well.
Diffstat (limited to 'pkgs/development/libraries/physics')
-rw-r--r--pkgs/development/libraries/physics/cernlib/default.nix43
1 files changed, 29 insertions, 14 deletions
diff --git a/pkgs/development/libraries/physics/cernlib/default.nix b/pkgs/development/libraries/physics/cernlib/default.nix
index b2656f1cc99..7028c44b434 100644
--- a/pkgs/development/libraries/physics/cernlib/default.nix
+++ b/pkgs/development/libraries/physics/cernlib/default.nix
@@ -19,15 +19,23 @@ stdenv.mkDerivation rec {
   patches = [ ./patch.patch ./0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch ];
 
   postPatch = ''
+    echo 'InstallBinSubdirs(packlib scripts)' >> 2006/src/Imakefile
     substituteInPlace 2006/src/config/site.def \
       --replace "# define MakeCmd gmake" "# define MakeCmd make"
     substituteInPlace 2006/src/config/lnxLib.rules \
       --replace "# lib" "// lib"
+
+    substituteInPlace 2006/src/config/linux.cf \
+      --replace "# ifdef Hasgfortran" "# if 1" \
+      --replace "# define CcCmd			gcc4" "# define CcCmd			gcc"
+    substituteInPlace 2006/src/scripts/cernlib \
+      --replace "-lnsl" ""
+
     # binutils 2.37 fix
     substituteInPlace 2006/src/config/Imake.tmpl --replace "clq" "cq"
   '';
 
-  configurePhase = ''
+  preConfigure = ''
     export CERN=`pwd`
     export CERN_LEVEL=${version}
     export CERN_ROOT=$CERN/$CERN_LEVEL
@@ -43,32 +51,39 @@ stdenv.mkDerivation rec {
     "-fallow-argument-mismatch"
   ];
 
+  NIX_CFLAGS = [ "-Wno-return-type" ];
+
   makeFlags = [
     "FORTRANOPTIONS=$(FFLAGS)"
+    "CCOPTIONS=$(NIX_CFLAGS)"
   ];
 
-  buildPhase = ''
-    cd $CERN_ROOT
-    mkdir -p build bin lib
+  configurePhase = ''
+    runHook preConfigure
 
+    cd $CERN_ROOT
+    mkdir -p build
     cd $CERN_ROOT/build
     $CVSCOSRC/config/imake_boot
+
+    runHook postConfigure
+  '';
+
+  preBuild = ''
     make -j $NIX_BUILD_CORES $makeFlags bin/kuipc
     make -j $NIX_BUILD_CORES $makeFlags scripts/Makefile
     pushd scripts
-    make -j $NIX_BUILD_CORES $makeFlags install.bin
+    make -j $NIX_BUILD_CORES $makeFlags bin/cernlib
     popd
-    make -j $NIX_BUILD_CORES $makeFlags
   '';
 
-  installPhase = ''
-    mkdir "$out"
-    cp -r "$CERN_ROOT/bin" "$out"
-    cp -r "$CERN_ROOT/lib" "$out"
-    mkdir "$out/$CERN_LEVEL"
-    ln -s "$out/bin" "$out/$CERN_LEVEL/bin"
-    ln -s "$out/lib" "$out/$CERN_LEVEL/lib"
-  '';
+  installTargets = [ "install.bin" "install.lib" "install.include" ];
+  installFlags = [
+    "CERN_BINDIR=${placeholder "out"}/bin"
+    "CERN_INCLUDEDIR=${placeholder "out"}/include"
+    "CERN_LIBDIR=${placeholder "out"}/lib"
+    "CERN_SHLIBDIR=${placeholder "out"}/libexec"
+  ];
 
   setupHook = ./setup-hook.sh;