Unverified Commit 496ea837 authored by Audrey Dutcher's avatar Audrey Dutcher Committed by GitHub
Browse files

various: extremely lightweight fixes to support FreeBSD build (#387230)

parents f4e5a303 84b8c066
Loading
Loading
Loading
Loading
+140 −85
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, libtool
, bzip2Support ? true, bzip2
, zlibSupport ? true, zlib
, libX11Support ? !stdenv.hostPlatform.isMinGW, libX11
, libXtSupport ? !stdenv.hostPlatform.isMinGW, libXt
, fontconfigSupport ? true, fontconfig
, freetypeSupport ? true, freetype
, ghostscriptSupport ? false, ghostscript
, libjpegSupport ? true, libjpeg
, djvulibreSupport ? true, djvulibre
, lcms2Support ? true, lcms2
, openexrSupport ? !stdenv.hostPlatform.isMinGW, openexr
, libjxlSupport ? true, libjxl
, libpngSupport ? true, libpng
, liblqr1Support ? true, liblqr1
, librawSupport ? true, libraw
, librsvgSupport ? !stdenv.hostPlatform.isMinGW, librsvg, pango
, libtiffSupport ? true, libtiff
, libxml2Support ? true, libxml2
, openjpegSupport ? !stdenv.hostPlatform.isMinGW, openjpeg
, libwebpSupport ? !stdenv.hostPlatform.isMinGW, libwebp
, libheifSupport ? true, libheif
, fftwSupport ? true, fftw
, potrace
, coreutils
, curl
, ApplicationServices
, Foundation
, testers
, nixos-icons
, perlPackages
, python3
{
  lib,
  stdenv,
  fetchFromGitHub,
  pkg-config,
  libtool,
  bzip2Support ? true,
  bzip2,
  zlibSupport ? true,
  zlib,
  libX11Support ? !stdenv.hostPlatform.isMinGW,
  libX11,
  libXtSupport ? !stdenv.hostPlatform.isMinGW,
  libXt,
  fontconfigSupport ? true,
  fontconfig,
  freetypeSupport ? true,
  freetype,
  ghostscriptSupport ? false,
  ghostscript,
  libjpegSupport ? true,
  libjpeg,
  djvulibreSupport ? true,
  djvulibre,
  lcms2Support ? true,
  lcms2,
  openexrSupport ? !stdenv.hostPlatform.isMinGW,
  openexr,
  libjxlSupport ? true,
  libjxl,
  libpngSupport ? true,
  libpng,
  liblqr1Support ? true,
  liblqr1,
  librawSupport ? true,
  libraw,
  librsvgSupport ? !stdenv.hostPlatform.isMinGW,
  librsvg,
  pango,
  libtiffSupport ? true,
  libtiff,
  libxml2Support ? true,
  libxml2,
  openjpegSupport ? !stdenv.hostPlatform.isMinGW,
  openjpeg,
  libwebpSupport ? !stdenv.hostPlatform.isMinGW,
  libwebp,
  libheifSupport ? true,
  libheif,
  fftwSupport ? true,
  fftw,
  potrace,
  coreutils,
  curl,
  ApplicationServices,
  Foundation,
  testers,
  nixos-icons,
  perlPackages,
  python3,
}:

assert libXtSupport -> libX11Support;

let
  arch =
    if stdenv.hostPlatform.system == "i686-linux" then "i686"
    else if stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin" then "x86-64"
    else if stdenv.hostPlatform.system == "armv7l-linux" then "armv7l"
    else if stdenv.hostPlatform.system == "aarch64-linux" || stdenv.hostPlatform.system == "aarch64-darwin" then "aarch64"
    else if stdenv.hostPlatform.system == "powerpc64le-linux" then "ppc64le"
    else null;
    if stdenv.hostPlatform.system == "i686-linux" then
      "i686"
    else if
      stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin"
    then
      "x86-64"
    else if stdenv.hostPlatform.system == "armv7l-linux" then
      "armv7l"
    else if
      stdenv.hostPlatform.system == "aarch64-linux" || stdenv.hostPlatform.system == "aarch64-darwin"
    then
      "aarch64"
    else if stdenv.hostPlatform.system == "powerpc64le-linux" then
      "ppc64le"
    else
      null;
in

stdenv.mkDerivation (finalAttrs: {
@@ -59,12 +93,17 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-DsJRTLMyjU2mMEGq/2qEJvjdYa698TEZZqkxuWtd/A4=";
  };

  outputs = [ "out" "dev" "doc" ]; # bin/ isn't really big
  outputs = [
    "out"
    "dev"
    "doc"
  ]; # bin/ isn't really big
  outputMan = "out"; # it's tiny

  enableParallelBuilding = true;

  configureFlags = [
  configureFlags =
    [
      # specify delegates explicitly otherwise `convert` will invoke the build
      # coreutils for filetypes it doesn't natively support.
      "MVDelegate=${lib.getExe' coreutils "mv"}"
@@ -78,14 +117,20 @@ stdenv.mkDerivation (finalAttrs: {
      (lib.withFeatureAs ghostscriptSupport "gs-font-dir" "${ghostscript.fonts}/share/fonts")
      (lib.withFeature ghostscriptSupport "gslib")
      (lib.withFeature fftwSupport "fftw")
  ] ++ lib.optionals stdenv.hostPlatform.isMinGW [
    ]
    ++ lib.optionals stdenv.hostPlatform.isMinGW [
      # due to libxml2 being without DLLs ATM
    "--enable-static" "--disable-shared"
      "--enable-static"
      "--disable-shared"
    ];

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

  buildInputs = [ potrace ]
  buildInputs =
    [ potrace ]
    ++ lib.optional zlibSupport zlib
    ++ lib.optional fontconfigSupport fontconfig
    ++ lib.optional ghostscriptSupport ghostscript
@@ -108,7 +153,8 @@ stdenv.mkDerivation (finalAttrs: {
      Foundation
    ];

  propagatedBuildInputs = [ curl ]
  propagatedBuildInputs =
    [ curl ]
    ++ lib.optional bzip2Support bzip2
    ++ lib.optional freetypeSupport freetype
    ++ lib.optional libjpegSupport libjpeg
@@ -118,7 +164,8 @@ stdenv.mkDerivation (finalAttrs: {
    ++ lib.optional libwebpSupport libwebp
    ++ lib.optional fftwSupport fftw;

  postInstall = ''
  postInstall =
    ''
      (cd "$dev/include" && ln -s ImageMagick* ImageMagick)
      # Q16HDRI = 16 bit quantum depth with HDRI support, and is the default ImageMagick configuration
      # If the default is changed, or the derivation is modified to use a different configuration
@@ -131,7 +178,8 @@ stdenv.mkDerivation (finalAttrs: {
        substituteInPlace "$file" --replace pkg-config \
          "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '$(command -v $PKG_CONFIG)'"
      done
  '' + lib.optionalString ghostscriptSupport ''
    ''
    + lib.optionalString ghostscriptSupport ''
      for la in $out/lib/*.la; do
        sed 's|-lgs|-L${lib.getLib ghostscript}/lib -lgs|' -i $la
      done
@@ -152,9 +200,16 @@ stdenv.mkDerivation (finalAttrs: {
    homepage = "http://www.imagemagick.org/";
    changelog = "https://github.com/ImageMagick/Website/blob/main/ChangeLog.md";
    description = "Software suite to create, edit, compose, or convert bitmap images";
    pkgConfigModules = [ "ImageMagick" "MagickWand" ];
    platforms = platforms.linux ++ platforms.darwin;
    maintainers = with maintainers; [ dotlambda rhendric bloxx12 ];
    pkgConfigModules = [
      "ImageMagick"
      "MagickWand"
    ];
    platforms = platforms.unix;
    maintainers = with maintainers; [
      dotlambda
      rhendric
      bloxx12
    ];
    license = licenses.asl20;
    mainProgram = "magick";
  };
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ stdenv.mkDerivation (finalAttrs: {
      "alsa"
      "alsa-topology"
    ];
    platforms = platforms.linux;
    platforms = platforms.linux ++ platforms.freebsd;
    maintainers = with maintainers; [ l-as ];
  };
})
+1 −1
Original line number Diff line number Diff line
@@ -35,6 +35,6 @@ stdenv.mkDerivation rec {

    license = licenses.bsd3;
    maintainers = [ maintainers.roastiek ];
    platforms = platforms.linux;
    platforms = platforms.linux ++ platforms.freebsd;
  };
}
+26 −21
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ stdenv.mkDerivation (finalAttrs: {

  dontBuild = true;

  installPhase = ''
  installPhase =
    ''
      runHook preInstall

      substituteInPlace ucm2/lib/card-init.conf \
@@ -33,10 +34,14 @@ stdenv.mkDerivation (finalAttrs: {
          "ucm2/Intel/bytcr-rt5640/bytcr-rt5640.conf"
      )

    ''
    + lib.optionalString stdenv.hostPlatform.isLinux ''
      for file in "''${files[@]}"; do
          substituteInPlace "$file" \
              --replace-fail '/sbin/modprobe' '${kmod}/bin/modprobe'
      done
    ''
    + ''

      mkdir -p $out/share/alsa
      cp -r ucm ucm2 $out/share/alsa
@@ -59,6 +64,6 @@ stdenv.mkDerivation (finalAttrs: {

    license = lib.licenses.bsd3;
    maintainers = [ lib.maintainers.roastiek ];
    platforms = lib.platforms.linux;
    platforms = lib.platforms.linux ++ lib.platforms.freebsd;
  };
})
+1 −1
Original line number Diff line number Diff line
@@ -49,6 +49,6 @@ stdenv.mkDerivation rec {
    description = "Minimalist, cross-platform, shared video plugins";
    license = licenses.gpl2Plus;
    maintainers = [ ];
    platforms = platforms.linux ++ platforms.darwin;
    platforms = platforms.unix;
  };
}
Loading