1 { lib, stdenv, fetchurl, gfortran, imake, makedepend, motif, xorg, libxcrypt }:
3 stdenv.mkDerivation rec {
9 "https://ftp.riken.jp/cernlib/download/${version}_source/tar/${version}_src.tar.gz"
10 "https://cernlib.web.cern.ch/cernlib/download/${version}_source/tar/${version}_src.tar.gz"
12 sha256 = "0awla1rl96z82br7slcmg8ks1d2a7slk6dj79ywb871j2ksi3fky";
15 buildInputs = with xorg; [ gfortran motif libX11 libXft libXt libxcrypt ];
16 nativeBuildInputs = [ imake makedepend ];
19 patches = [ ./patch.patch ./0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch ];
22 echo 'InstallBinSubdirs(packlib scripts)' >> 2006/src/Imakefile
23 substituteInPlace 2006/src/config/site.def \
24 --replace "# define MakeCmd gmake" "# define MakeCmd make"
25 substituteInPlace 2006/src/config/lnxLib.rules \
26 --replace "# lib" "// lib"
28 substituteInPlace 2006/src/config/linux.cf \
29 --replace "# ifdef Hasgfortran" "# if 1" \
30 --replace "# define CcCmd gcc4" "# define CcCmd gcc"
31 substituteInPlace 2006/src/scripts/cernlib \
35 substituteInPlace 2006/src/config/Imake.tmpl --replace "clq" "cq"
40 export CERN_LEVEL=${version}
41 export CERN_ROOT=$CERN/$CERN_LEVEL
42 export CVSCOSRC=`pwd`/$CERN_LEVEL/src
43 export PATH=$PATH:$CERN_ROOT/bin
46 FFLAGS = lib.optionals (lib.versionAtLeast gfortran.version "10.0.0") [
47 # Fix https://github.com/vmc-project/geant3/issues/17
51 "-fallow-argument-mismatch"
54 NIX_CFLAGS = [ "-Wno-return-type" ];
56 # Workaround build failure on -fno-common toolchains:
57 # ld: libpacklib.a(kedit.o):kuip/klink1.h:11: multiple definition of `klnkaddr';
58 # libzftplib.a(zftpcdf.o):zftp/zftpcdf.c:155: first defined here
59 NIX_CFLAGS_COMPILE = "-fcommon";
62 "FORTRANOPTIONS=$(FFLAGS)"
63 "CCOPTIONS=$(NIX_CFLAGS)"
72 $CVSCOSRC/config/imake_boot
78 make -j $NIX_BUILD_CORES $makeFlags bin/kuipc
79 make -j $NIX_BUILD_CORES $makeFlags scripts/Makefile
81 make -j $NIX_BUILD_CORES $makeFlags bin/cernlib
85 installTargets = [ "install.bin" "install.lib" "install.include" ];
87 "CERN_BINDIR=${placeholder "out"}/bin"
88 "CERN_INCLUDEDIR=${placeholder "out"}/include"
89 "CERN_LIBDIR=${placeholder "out"}/lib"
90 "CERN_SHLIBDIR=${placeholder "out"}/libexec"
93 setupHook = ./setup-hook.sh;
96 homepage = "http://cernlib.web.cern.ch";
97 description = "Legacy collection of libraries and modules for data analysis in high energy physics";
98 broken = stdenv.isDarwin;
99 platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
100 maintainers = with lib.maintainers; [ veprbl ];
101 license = lib.licenses.gpl2;