nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchpatch,
5 fetchurl,
6 cmake,
7 freetype,
8 gfortran,
9 openssl,
10 libnsl,
11 motif,
12 libxt,
13 libxft,
14 libxaw,
15 libx11,
16 libxcrypt,
17}:
18
19stdenv.mkDerivation rec {
20 version = "2024.06.12.0";
21 pname = "cernlib";
22 year = lib.versions.major version;
23
24 src = fetchurl {
25 urls = [
26 "https://ftp.riken.jp/cernlib/download/${year}_source/tar/cernlib-cernlib-${version}-free.tar.gz"
27 "https://cernlib.web.cern.ch/download/${year}_source/tar/cernlib-cernlib-${version}-free.tar.gz"
28 ];
29 hash = "sha256-SEFgQjPBkmRoaMD/7yXiXO9DZNrRhqZ01kptSDQur84=";
30 };
31
32 patches = [
33 (fetchpatch {
34 url = "https://github.com/user-attachments/files/16832928/geant321-fix-weak-alias-on-darwin.patch";
35 hash = "sha256-YzaUh4rJBszGdp5s/HDQMI5qQhCGrTt9P6XCgZOFn1I=";
36 })
37 ];
38
39 postPatch = ''
40 substituteInPlace CMakeLists.txt \
41 --replace-fail "cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)" \
42 "cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)" \
43 --replace-fail "find_program ( SED NAMES gsed" "find_program ( SED NAMES sed"
44 '';
45
46 # gfortran warning's on iframework messes with CMake's check_fortran_compiler_flag
47 # see also https://github.com/NixOS/nixpkgs/issues/27218
48 preConfigure = ''
49 export NIX_CFLAGS_COMPILE="$(echo $NIX_CFLAGS_COMPILE | sed 's|-iframework [^ ]*||g')"
50 '';
51
52 nativeBuildInputs = [ cmake ];
53 buildInputs = [
54 freetype
55 gfortran
56 openssl
57 libx11
58 libxaw
59 libxft
60 libxt
61 libxcrypt
62 motif
63 ]
64 ++ lib.optional stdenv.hostPlatform.isLinux libnsl;
65
66 setupHook = ./setup-hook.sh;
67
68 meta = {
69 homepage = "http://cernlib.web.cern.ch";
70 description = "Legacy collection of libraries and modules for data analysis in high energy physics";
71 platforms = [
72 "aarch64-linux"
73 "i686-linux"
74 "x86_64-linux"
75 "x86_64-darwin"
76 ];
77 maintainers = with lib.maintainers; [ veprbl ];
78 license = lib.licenses.gpl2;
79 };
80}