Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 196 lines 5.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 pkg-config, 6 libtool, 7 bzip2Support ? true, 8 bzip2, 9 zlibSupport ? true, 10 zlib, 11 libX11Support ? !stdenv.hostPlatform.isMinGW, 12 libX11, 13 libXtSupport ? !stdenv.hostPlatform.isMinGW, 14 libXt, 15 fontconfigSupport ? true, 16 fontconfig, 17 freetypeSupport ? true, 18 freetype, 19 ghostscriptSupport ? false, 20 ghostscript, 21 libjpegSupport ? true, 22 libjpeg, 23 djvulibreSupport ? true, 24 djvulibre, 25 lcms2Support ? true, 26 lcms2, 27 openexrSupport ? !stdenv.hostPlatform.isMinGW, 28 openexr, 29 libpngSupport ? true, 30 libpng, 31 liblqr1Support ? true, 32 liblqr1, 33 librsvgSupport ? !stdenv.hostPlatform.isMinGW, 34 librsvg, 35 libtiffSupport ? true, 36 libtiff, 37 libxml2Support ? true, 38 libxml2, 39 openjpegSupport ? !stdenv.hostPlatform.isMinGW, 40 openjpeg, 41 libwebpSupport ? !stdenv.hostPlatform.isMinGW, 42 libwebp, 43 libheifSupport ? true, 44 libheif, 45 libde265Support ? true, 46 libde265, 47 fftw, 48 testers, 49}: 50 51let 52 arch = 53 if stdenv.hostPlatform.system == "i686-linux" then 54 "i686" 55 else if 56 stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin" 57 then 58 "x86-64" 59 else if stdenv.hostPlatform.system == "armv7l-linux" then 60 "armv7l" 61 else if 62 stdenv.hostPlatform.system == "aarch64-linux" || stdenv.hostPlatform.system == "aarch64-darwin" 63 then 64 "aarch64" 65 else if stdenv.hostPlatform.system == "powerpc64le-linux" then 66 "ppc64le" 67 else 68 null; 69in 70 71stdenv.mkDerivation (finalAttrs: { 72 pname = "imagemagick"; 73 version = "6.9.13-10"; 74 75 src = fetchFromGitHub { 76 owner = "ImageMagick"; 77 repo = "ImageMagick6"; 78 rev = finalAttrs.version; 79 sha256 = "sha256-AdlJaCJOrN+NkkzzzgELtgAr5iZ9dvlVYVc7tYiM+R8="; 80 }; 81 82 outputs = [ 83 "out" 84 "dev" 85 "doc" 86 ]; # bin/ isn't really big 87 outputMan = "out"; # it's tiny 88 89 enableParallelBuilding = true; 90 91 configureFlags = [ 92 "--with-frozenpaths" 93 (lib.withFeatureAs (arch != null) "gcc-arch" arch) 94 (lib.withFeature librsvgSupport "rsvg") 95 (lib.withFeature liblqr1Support "lqr") 96 (lib.withFeatureAs ghostscriptSupport "gs-font-dir" "${ghostscript.fonts}/share/fonts") 97 (lib.withFeature ghostscriptSupport "gslib") 98 ] 99 ++ lib.optionals stdenv.hostPlatform.isMinGW [ 100 # due to libxml2 being without DLLs ATM 101 "--enable-static" 102 "--disable-shared" 103 ]; 104 105 nativeBuildInputs = [ 106 pkg-config 107 libtool 108 ]; 109 110 buildInputs = 111 [ ] 112 ++ lib.optional zlibSupport zlib 113 ++ lib.optional fontconfigSupport fontconfig 114 ++ lib.optional ghostscriptSupport ghostscript 115 ++ lib.optional liblqr1Support liblqr1 116 ++ lib.optional libpngSupport libpng 117 ++ lib.optional libtiffSupport libtiff 118 ++ lib.optional libxml2Support libxml2 119 ++ lib.optional libheifSupport libheif 120 ++ lib.optional libde265Support libde265 121 ++ lib.optional djvulibreSupport djvulibre 122 ++ lib.optional openexrSupport openexr 123 ++ lib.optional librsvgSupport librsvg 124 ++ lib.optional openjpegSupport openjpeg; 125 126 propagatedBuildInputs = [ 127 fftw 128 ] 129 ++ lib.optional bzip2Support bzip2 130 ++ lib.optional freetypeSupport freetype 131 ++ lib.optional libjpegSupport libjpeg 132 ++ lib.optional lcms2Support lcms2 133 ++ lib.optional libX11Support libX11 134 ++ lib.optional libXtSupport libXt 135 ++ lib.optional libwebpSupport libwebp; 136 137 doCheck = false; # fails 2 out of 76 tests 138 139 postInstall = '' 140 (cd "$dev/include" && ln -s ImageMagick* ImageMagick) 141 moveToOutput "bin/*-config" "$dev" 142 moveToOutput "lib/ImageMagick-*/config-Q16" "$dev" # includes configure params 143 for file in "$dev"/bin/*-config; do 144 substituteInPlace "$file" --replace "${pkg-config}/bin/pkg-config -config" \ 145 ${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config 146 substituteInPlace "$file" --replace ${pkg-config}/bin/pkg-config \ 147 "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config'" 148 done 149 '' 150 + lib.optionalString ghostscriptSupport '' 151 for la in $out/lib/*.la; do 152 sed 's|-lgs|-L${lib.getLib ghostscript}/lib -lgs|' -i $la 153 done 154 ''; 155 156 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 157 158 meta = with lib; { 159 homepage = "https://legacy.imagemagick.org/"; 160 changelog = "https://legacy.imagemagick.org/script/changelog.php"; 161 description = "Software suite to create, edit, compose, or convert bitmap images"; 162 pkgConfigModules = [ 163 "ImageMagick" 164 "MagickWand" 165 ]; 166 platforms = platforms.linux ++ platforms.darwin; 167 maintainers = [ ]; 168 license = licenses.asl20; 169 knownVulnerabilities = [ 170 "CVE-2019-13136" 171 "CVE-2019-17547" 172 "CVE-2020-25663" 173 "CVE-2020-27768" 174 "CVE-2020-27769" 175 "CVE-2020-27829" 176 "CVE-2021-20243" 177 "CVE-2021-20244" 178 "CVE-2021-20310" 179 "CVE-2021-20311" 180 "CVE-2021-20312" 181 "CVE-2021-20313" 182 "CVE-2021-3596" 183 "CVE-2022-0284" 184 "CVE-2022-2719" 185 "CVE-2023-1289" 186 "CVE-2023-2157" 187 "CVE-2023-34151" 188 "CVE-2023-34152" 189 "CVE-2023-34153" 190 "CVE-2023-3428" 191 "CVE-2023-34474" 192 "CVE-2023-34475" 193 "CVE-2023-5341" 194 ]; 195 }; 196})