Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 60 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 cmake, 6 hdf5, 7}: 8 9stdenv.mkDerivation (finalAttrs: { 10 pname = "medfile"; 11 version = "5.0.0"; 12 13 src = fetchurl { 14 url = "https://files.salome-platform.org/Salome/medfile/med-${finalAttrs.version}.tar.bz2"; 15 hash = "sha256-Jn520MZ+xRwQ4xmUhOwVCLqo1e2EXGKK32YFKdzno9Q="; 16 }; 17 18 outputs = [ 19 "out" 20 "doc" 21 "dev" 22 ]; 23 24 postPatch = '' 25 # Patch cmake and source files to work with hdf5 26 substituteInPlace config/cmake_files/medMacros.cmake --replace-fail \ 27 "IF (NOT HDF_VERSION_MAJOR_REF EQUAL 1 OR NOT HDF_VERSION_MINOR_REF EQUAL 12 OR NOT HDF_VERSION_RELEASE_REF GREATER 0)" \ 28 "IF (HDF5_VERSION VERSION_LESS 1.12.0)" 29 substituteInPlace src/*/*.c --replace-warn \ 30 "#if H5_VERS_MINOR > 12" \ 31 "#if H5_VERS_MINOR > 14" 32 '' 33 + lib.optionalString stdenv.hostPlatform.isDarwin '' 34 # Some medfile test files #define _a, which 35 # breaks system header files that use _a as a function parameter 36 substituteInPlace tests/c/*.c \ 37 --replace-warn "_a" "_A" \ 38 --replace-warn "_b" "_B" 39 # Fix compiler errors in test files 40 substituteInPlace tests/c/*.c \ 41 --replace-warn "med_Bool" "med_bool" \ 42 --replace-warn "med_Axis_type" "med_axis_type" \ 43 --replace-warn "med_Access_mode" "med_access_mode" 44 ''; 45 46 nativeBuildInputs = [ cmake ]; 47 48 buildInputs = [ hdf5 ]; 49 50 checkPhase = "make test"; 51 52 postInstall = "rm -r $out/bin/testc"; 53 54 meta = with lib; { 55 description = "Library to read and write MED files"; 56 homepage = "https://salome-platform.org/"; 57 platforms = platforms.linux ++ platforms.darwin; 58 license = licenses.lgpl3Plus; 59 }; 60})