Unverified Commit a0e6ea95 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

Merge pull request #325568 from atorres1985-contrib/sdl2-image-master

SDL2_Image: rework and modernize
parents ff7cfc2d cea3c9fb
Loading
Loading
Loading
Loading
+73 −0
Original line number Diff line number Diff line
{ lib, stdenv, fetchurl
, pkg-config
, SDL2, libpng, libjpeg, libtiff, giflib, libwebp, libXpm, zlib, Foundation
{
  lib,
  SDL2,
  darwin,
  fetchurl,
  giflib,
  libXpm,
  libjpeg,
  libpng,
  libtiff,
  libwebp,
  pkg-config,
  stdenv,
  zlib,
  # Boolean flags
  ## Darwin headless will hang when trying to run the SDL test program
  enableSdltest ? (!stdenv.isDarwin),
}:

let
  inherit (darwin.apple_sdk.frameworks) Foundation;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "SDL2_image";
  version = "2.8.2";
@@ -12,31 +29,45 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-j0hrv7z4Rk3VjJ5dkzlKsCVc5otRxalmqRgkSCCnbdw=";
  };

  nativeBuildInputs = [ pkg-config ];
  nativeBuildInputs = [
    SDL2
    pkg-config
  ];

  buildInputs = [ SDL2 libpng libjpeg libtiff giflib libwebp libXpm zlib ]
    ++ lib.optional stdenv.isDarwin Foundation;
  buildInputs = [
    SDL2
    giflib
    libXpm
    libjpeg
    libpng
    libtiff
    libwebp
    zlib
  ] ++ lib.optionals stdenv.isDarwin [ Foundation ];

  configureFlags = [
    # Disable dynamically loaded dependencies
    "--disable-jpg-shared"
    "--disable-png-shared"
    "--disable-tif-shared"
    "--disable-webp-shared"
    (lib.enableFeature false "jpg-shared")
    (lib.enableFeature false "png-shared")
    (lib.enableFeature false "tif-shared")
    (lib.enableFeature false "webp-shared")
    (lib.enableFeature enableSdltest "sdltest")
  ] ++ lib.optionals stdenv.isDarwin [
    # Darwin headless will hang when trying to run the SDL test program
    "--disable-sdltest"
    # Don't use native macOS frameworks
    "--disable-imageio"
    # Caution: do not set this as (!stdenv.isDarwin) since it would be true
    # outside Darwin - and ImageIO does not exist outisde Darwin
    (lib.enableFeature false "imageio")
  ];

  strictDeps = true;

  enableParallelBuilding = true;

  meta = with lib; {
  meta = {
    description = "SDL image library";
    homepage = "http://www.libsdl.org/projects/SDL_image/";
    platforms = platforms.unix;
    license = licenses.zlib;
    maintainers = with maintainers; [ cpages ];
    homepage = "https://github.com/libsdl-org/SDL_image";
    license = lib.licenses.zlib;
    maintainers = lib.teams.sdl.members ++ (with lib.maintainers; [ ]);
    platforms = lib.platforms.unix;
  };
})
+14 −0
Original line number Diff line number Diff line
# Dependency of pygame, toppler
{
  lib,
  SDL2_image,
  fetchurl,
}:

SDL2_image.overrideAttrs (oldAttrs: {
  version = "2.0.5";
  src = fetchurl {
    inherit (oldAttrs.src) url;
    hash = "sha256-vdX24CZoL31+G+C2BRsgnaL0AqLdi9HEvZwlrSYxCNA";
  };
})
+15 −0
Original line number Diff line number Diff line
# Dependency for hedgewars:
# https://github.com/NixOS/nixpkgs/pull/274185#issuecomment-1856764786
{
  lib,
  SDL2_image,
  fetchurl,
}:

SDL2_image.overrideAttrs (oldAttrs: {
  version = "2.6.3";
  src = fetchurl {
    inherit (oldAttrs.src) url;
    hash = "sha256-kxyb5b8dfI+um33BV4KLfu6HTiPH8ktEun7/a0g2MSw=";
  };
})
+0 −21
Original line number Diff line number Diff line
@@ -23972,27 +23972,6 @@ with pkgs;
    inherit (darwin.apple_sdk.frameworks) AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL;
  };
  SDL2_image = callPackage ../development/libraries/SDL2_image {
    inherit (darwin.apple_sdk.frameworks) Foundation;
  };
  # Pinned for pygame, toppler
  SDL2_image_2_0 = SDL2_image.overrideAttrs (oldAttrs: {
    version = "2.0.5";
    src = fetchurl {
      inherit (oldAttrs.src) url;
      hash = "sha256-vdX24CZoL31+G+C2BRsgnaL0AqLdi9HEvZwlrSYxCNA";
    };
  });
  # Pinned for hedgewars:
  #   https://github.com/NixOS/nixpkgs/pull/274185#issuecomment-1856764786
  SDL2_image_2_6 = SDL2_image.overrideAttrs (oldAttrs: {
    version = "2.6.3";
    src = fetchurl {
      inherit (oldAttrs.src) url;
      hash = "sha256-kxyb5b8dfI+um33BV4KLfu6HTiPH8ktEun7/a0g2MSw=";
    };
  });
  sdrplay = callPackage ../applications/radio/sdrplay { };
  sdr-j-fm = libsForQt5.callPackage ../applications/radio/sdr-j-fm { };