diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix index a8e8fde96f63..ec929272dea0 100644 --- a/pkgs/development/libraries/gettext/default.nix +++ b/pkgs/development/libraries/gettext/default.nix @@ -54,9 +54,13 @@ stdenv.mkDerivation rec { xz xz.bin ]; - buildInputs = [ bash ] - # HACK, see #10874 (and 14664) - ++ lib.optionals (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) [ libiconv ]; + buildInputs = lib.optionals (!stdenv.hostPlatform.isMinGW) [ + bash + ] + ++ lib.optionals (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) [ + # HACK, see #10874 (and 14664) + libiconv + ]; setupHooks = [ ../../../build-support/setup-hooks/role.bash diff --git a/pkgs/development/libraries/giflib/default.nix b/pkgs/development/libraries/giflib/default.nix index 5202dc0edabc..8c8a587ed548 100644 --- a/pkgs/development/libraries/giflib/default.nix +++ b/pkgs/development/libraries/giflib/default.nix @@ -1,8 +1,15 @@ -{ lib, stdenv, fetchurl, fetchpatch, xmlto, docbook_xml_dtd_412, docbook_xsl, libxml2, fixDarwinDylibNames, pkgsStatic }: +{ stdenv +, lib +, fetchurl +, fetchpatch +, fixDarwinDylibNames +, pkgsStatic +}: stdenv.mkDerivation rec { pname = "giflib"; version = "5.2.1"; + src = fetchurl { url = "mirror://sourceforge/giflib/giflib-${version}.tar.gz"; sha256 = "1gbrg03z1b6rlrvjyc6d41bc8j1bsr7rm8206gb1apscyii5bnii"; @@ -14,33 +21,48 @@ stdenv.mkDerivation rec { url = "https://src.fedoraproject.org/rpms/giflib/raw/2e9917bf13df114354163f0c0211eccc00943596/f/CVE-2022-28506.patch"; sha256 = "sha256-TBemEXkuox8FdS9RvjnWcTWPaHRo4crcwSR9czrUwBY="; }) - ] ++ lib.optional stdenv.hostPlatform.isDarwin + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # https://sourceforge.net/p/giflib/bugs/133/ (fetchpatch { - # https://sourceforge.net/p/giflib/bugs/133/ name = "darwin-soname.patch"; url = "https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/c323/attachment/Makefile.patch"; sha256 = "12afkqnlkl3n1hywwgx8sqnhp3bz0c5qrwcv8j9hifw1lmfhv67r"; extraPrefix = "./"; - }); + }) + ] ++ lib.optionals stdenv.hostPlatform.isMinGW [ + # Build dll libraries. + (fetchurl { + url = "https://aur.archlinux.org/cgit/aur.git/plain/001-mingw-build.patch?h=mingw-w64-giflib&id=4cf1e519bcf51338dc607d23388fca47d71790c0"; + sha256 = "KyJi3eqH/Ae+guEK6znraZI5+IPImaoYoW5NTkCvjsg="; + }) - postPatch = '' - substituteInPlace Makefile \ - --replace 'PREFIX = /usr/local' 'PREFIX = ${builtins.placeholder "out"}' - '' - # Upstream build system does not support NOT building shared libraries. - + lib.optionalString stdenv.hostPlatform.isStatic '' + # Install executables. + ./mingw-install-exes.patch + ]; + + nativeBuildInputs = lib.optionals stdenv.isDarwin [ + fixDarwinDylibNames + ]; + + makeFlags = [ + "PREFIX=${builtins.placeholder "out"}" + ]; + + postPatch = lib.optionalString stdenv.hostPlatform.isStatic '' + # Upstream build system does not support NOT building shared libraries. sed -i '/all:/ s/libgif.so//' Makefile sed -i '/all:/ s/libutil.so//' Makefile sed -i '/-m 755 libgif.so/ d' Makefile sed -i '/ln -sf libgif.so/ d' Makefile ''; - nativeBuildInputs = lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ]; - - passthru.tests.static = pkgsStatic.giflib; + passthru.tests = { + static = pkgsStatic.giflib; + }; meta = { description = "A library for reading and writing gif images"; + homepage = "https://giflib.sourceforge.net/"; platforms = lib.platforms.unix; license = lib.licenses.mit; maintainers = with lib.maintainers; [ ]; diff --git a/pkgs/development/libraries/giflib/mingw-install-exes.patch b/pkgs/development/libraries/giflib/mingw-install-exes.patch new file mode 100644 index 000000000000..5ec3fdad7e65 --- /dev/null +++ b/pkgs/development/libraries/giflib/mingw-install-exes.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -92,7 +92,7 @@ + install: all install-bin install-include install-lib install-man + install-bin: $(INSTALLABLE) + $(INSTALL) -d "$(DESTDIR)$(BINDIR)" +- $(INSTALL) $^ "$(DESTDIR)$(BINDIR)" ++ $(INSTALL) $(^:=.exe) "$(DESTDIR)$(BINDIR)" + install-include: + $(INSTALL) -d "$(DESTDIR)$(INCDIR)" + $(INSTALL) -m 644 gif_lib.h "$(DESTDIR)$(INCDIR)" diff --git a/pkgs/development/libraries/popt/default.nix b/pkgs/development/libraries/popt/default.nix index 37d83ff5b2b2..fdccb4d09336 100644 --- a/pkgs/development/libraries/popt/default.nix +++ b/pkgs/development/libraries/popt/default.nix @@ -1,4 +1,8 @@ -{ lib, stdenv, fetchurl }: +{ lib +, stdenv +, fetchurl +, fetchpatch2 +}: stdenv.mkDerivation rec { pname = "popt"; @@ -12,6 +16,23 @@ stdenv.mkDerivation rec { patches = lib.optionals stdenv.isCygwin [ ./1.16-cygwin.patch ./1.16-vpath.patch + ] ++ lib.optionals stdenv.hostPlatform.isMinGW [ + # Do not require + (fetchpatch2 { + url = "https://aur.archlinux.org/cgit/aur.git/plain/get-w32-console-maxcols.mingw32.patch?h=mingw-w64-popt&id=63f2cdb0de116362c49681cef20f7a8b4355e85a"; + sha256 = "zv43l1RBqNzT/JG+jQaMVFaFv+ZYPuIiAtKUDzJJBbc="; + stripLen = 1; + extraPrefix = "src/"; + }) + + # Do not try to detect setuid, it is not a thing. + (fetchpatch2 { + url = "https://github.com/rpm-software-management/popt/commit/905544c5d9767894edaf71a1e3ce5126944c5695.patch"; + sha256 = "3PmcxeiEZ/Hof0zoVFSytEXvQ8gE8Sp5UdagExPVICU="; + stripLen = 1; + extraPrefix = "src/"; + revert = true; + }) ]; doCheck = false; # fails diff --git a/pkgs/development/libraries/science/astronomy/cfitsio/default.nix b/pkgs/development/libraries/science/astronomy/cfitsio/default.nix index 8a6b72f52130..87aa5a701c31 100644 --- a/pkgs/development/libraries/science/astronomy/cfitsio/default.nix +++ b/pkgs/development/libraries/science/astronomy/cfitsio/default.nix @@ -1,4 +1,9 @@ -{ stdenv, lib, fetchurl, bzip2, zlib }: +{ stdenv +, lib +, fetchurl +, bzip2 +, zlib +}: stdenv.mkDerivation rec { pname = "cfitsio"; @@ -9,31 +14,41 @@ stdenv.mkDerivation rec { sha256 = "sha256-66U9Gz9uNFYyuwmnt1LsfO09Y+xRU6hIOA84gMXWGIk="; }; - buildInputs = [ bzip2 zlib ]; + patches = [ + ./darwin-rpath-universal.patch + ]; - patches = [ ./darwin-rpath-universal.patch ]; + buildInputs = [ + bzip2 + zlib + ]; - configureFlags = [ "--with-bzip2=${bzip2.out}" "--enable-reentrant" ]; + configureFlags = [ + "--with-bzip2=${bzip2.out}" + "--enable-reentrant" + ]; hardeningDisable = [ "format" ]; # Shared-only build buildFlags = [ "shared" ]; - postPatch = '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in - ''; + + postPatch = '' + sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in + ''; meta = with lib; { homepage = "https://heasarc.gsfc.nasa.gov/fitsio/"; description = "Library for reading and writing FITS data files"; - longDescription = - '' CFITSIO is a library of C and Fortran subroutines for reading and - writing data files in FITS (Flexible Image Transport System) data - format. CFITSIO provides simple high-level routines for reading and - writing FITS files that insulate the programmer from the internal - complexities of the FITS format. CFITSIO also provides many - advanced features for manipulating and filtering the information in - FITS files. - ''; + longDescription = '' + CFITSIO is a library of C and Fortran subroutines for reading and + writing data files in FITS (Flexible Image Transport System) data + format. CFITSIO provides simple high-level routines for reading and + writing FITS files that insulate the programmer from the internal + complexities of the FITS format. CFITSIO also provides many + advanced features for manipulating and filtering the information in + FITS files. + ''; changelog = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/docs/changes.txt"; license = licenses.mit; maintainers = with maintainers; [ xbreak hjones2199 ];