nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchurl, gfortran, gnumake, imake, makedepend, motif, xorg }:
2
3stdenv.mkDerivation rec {
4 version = "2006";
5 pname = "cernlib";
6
7 src = fetchurl {
8 urls = [
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"
11 ];
12 sha256 = "0awla1rl96z82br7slcmg8ks1d2a7slk6dj79ywb871j2ksi3fky";
13 };
14
15 buildInputs = with xorg; [ gfortran motif libX11 libXft libXt ];
16 nativeBuildInputs = [ gnumake imake makedepend ];
17 sourceRoot = ".";
18
19 patches = [ ./patch.patch ];
20
21 postPatch = ''
22 substituteInPlace 2006/src/config/site.def \
23 --replace "# define MakeCmd gmake" "# define MakeCmd make"
24 substituteInPlace 2006/src/config/lnxLib.rules \
25 --replace "# lib" "// lib"
26 '';
27
28 configurePhase = ''
29 export CERN=`pwd`
30 export CERN_LEVEL=${version}
31 export CERN_ROOT=$CERN/$CERN_LEVEL
32 export CVSCOSRC=`pwd`/$CERN_LEVEL/src
33 export PATH=$PATH:$CERN_ROOT/bin
34 '';
35
36 buildPhase = ''
37 cd $CERN_ROOT
38 mkdir -p build bin lib
39
40 cd $CERN_ROOT/build
41 $CVSCOSRC/config/imake_boot
42 make bin/kuipc
43 make scripts/Makefile
44 pushd scripts
45 make install.bin
46 popd
47 make
48 '';
49
50 installPhase = ''
51 mkdir "$out"
52 cp -r "$CERN_ROOT/bin" "$out"
53 cp -r "$CERN_ROOT/lib" "$out"
54 mkdir "$out/$CERN_LEVEL"
55 ln -s "$out/bin" "$out/$CERN_LEVEL/bin"
56 ln -s "$out/lib" "$out/$CERN_LEVEL/lib"
57 '';
58
59 setupHook = ./setup-hook.sh;
60
61 meta = {
62 homepage = "http://cernlib.web.cern.ch";
63 description = "Legacy collection of libraries and modules for data analysis in high energy physics";
64 broken = stdenv.isDarwin;
65 platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
66 maintainers = with stdenv.lib.maintainers; [ veprbl ];
67 license = stdenv.lib.licenses.gpl2;
68 };
69}