Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 91 lines 3.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 enableNLS ? false, 6 libnatspec ? null, 7 libiconv, 8 fetchpatch, 9}: 10 11assert enableNLS -> libnatspec != null; 12 13stdenv.mkDerivation rec { 14 pname = "zip"; 15 version = "3.0"; 16 17 src = fetchurl { 18 urls = [ 19 "ftp://ftp.info-zip.org/pub/infozip/src/zip${lib.replaceStrings [ "." ] [ "" ] version}.tgz" 20 "https://src.fedoraproject.org/repo/pkgs/zip/zip30.tar.gz/7b74551e63f8ee6aab6fbc86676c0d37/zip30.tar.gz" 21 ]; 22 sha256 = "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h"; 23 }; 24 25 postPatch = '' 26 substituteInPlace unix/Makefile --replace 'CC = cc' "" 27 substituteInPlace unix/configure --replace-fail "O3" "O2" 28 ''; 29 30 makefile = "unix/Makefile"; 31 buildFlags = if stdenv.hostPlatform.isCygwin then [ "cygwin" ] else [ "generic" ]; 32 installFlags = [ 33 "prefix=${placeholder "out"}" 34 "INSTALL=cp" 35 ]; 36 37 patches = [ 38 # Implicit declaration of `closedir` and `opendir` cause dirent detection to fail with clang 16. 39 ./fix-implicit-declarations.patch 40 # Fixes forward declaration errors with timezone.c 41 ./fix-time.h-not-included.patch 42 # Without this patch, we get a runtime failures with GCC 14 when building OpenJDK 8: 43 # 44 # zip I/O error: No such file or directory 45 # zip error: Could not create output file (was replacing the original zip file) 46 # make[2]: *** [CreateJars.gmk:659: /build/source/build/linux-x86_64-normal-server-release/images/src.zip] Error 1 47 # 48 # Source: Debian 49 ./12-fix-build-with-gcc-14.patch 50 (fetchpatch { 51 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-pic.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a"; 52 hash = "sha256-OXgC9KqiOpH/o/bSabt3LqtoT/xifqfkvpLLPfPz+1c="; 53 }) 54 (fetchpatch { 55 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-no-crypt.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a"; 56 hash = "sha256-9bwV+uKST828PcRVbICs8xwz9jcIPk26gxLBbiEeta4="; 57 }) 58 (fetchpatch { 59 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-format-security.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a"; 60 hash = "sha256-YmGKivZ0iFCFmPjVYuOv9D8Y0xG2QnWOpas8gMgoQ3M="; 61 }) 62 (fetchpatch { 63 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-exec-stack.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a"; 64 hash = "sha256-akJFY+zGijPWCwaAL/xxCN4wQpVFBHkLMo2HowrSn/M="; 65 }) 66 (fetchpatch { 67 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-build.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a"; 68 hash = "sha256-MiupD7W+sxiRTsB5viKAiI4QeqtZC6VttfJktdt1ucI="; 69 }) 70 # Buffer overflow on Unicode characters in path names 71 # https://bugzilla.redhat.com/show_bug.cgi?id=2165653 72 # (included among other changes below) 73 (fetchpatch { 74 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-zipnote-freeze.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a"; 75 hash = "sha256-EVr7YS3IytnCRjAYUlkg05GA/kaAY9NRFG7uDt0QLAY="; 76 }) 77 ] 78 ++ lib.optionals (enableNLS && !stdenv.hostPlatform.isCygwin) [ ./natspec-gentoo.patch.bz2 ]; 79 80 buildInputs = 81 lib.optional enableNLS libnatspec ++ lib.optional stdenv.hostPlatform.isCygwin libiconv; 82 83 meta = with lib; { 84 description = "Compressor/archiver for creating and modifying zipfiles"; 85 homepage = "http://www.info-zip.org"; 86 license = licenses.bsdOriginal; 87 platforms = platforms.all; 88 maintainers = with maintainers; [ RossComputerGuy ]; 89 mainProgram = "zip"; 90 }; 91}