<commit_before>{ stdenv
, autoreconfHook
, fetchTritonPatch
, fetchurl
, gettext
, intltool
, makeWrapper
, perl
, perlPackages
, unzip

, aspell
, boehm-gc
, boost
, cairo
, cairomm
, dbus-glib
, fontconfig
, freetype
, glib
, glibmm
, gsl
, gtk2
, gtkmm_2
, gtkspell_2
, imagemagick
, lcms2
, libcdr
, libexif
, libjpeg
, libpng
, librevenge
, libsigcxx
, libvisio
, libwpg
, libxml2
, libxslt
, pango
, poppler
, popt
, pythonPackages
, pyxml
, xorg
, zlib

, boxMakerPlugin ? false
}:

let
  inherit (stdenv)
    cc;
  inherit (stdenv.lib)
    enFlag
    optional
    optionalString
    wtFlag;
in

let
  boxmaker = fetchurl {
    # http://www.inkscapeforum.com/viewtopic.php?f=11&t=10403
    url = "http://www.keppel.demon.co.uk/111000/files/BoxMaker0.91.zip";
    sha256 = "5c5697f43dc3a95468f61f479cb50b7e2b93379a1729abf19e4040ac9f43a1a8";
  };
in

stdenv.mkDerivation rec {
  name = "inkscape-0.91";

  src = fetchurl {
    url = "https://inkscape.global.ssl.fastly.net/media/resources/file/"
        + "${name}.tar.bz2";
    sha256 = "06ql3x732x2rlnanv0a8aharsnj91j5kplksg574090rks51z42d";
  };

  nativeBuildInputs = [
    autoreconfHook
    gettext
    intltool
    libxslt
    makeWrapper
    perl
    perlPackages.XMLParser
  ] ++ optional boxMakerPlugin unzip;

  propagatedBuildInputs = [
    /* Python is used at run-time to execute scripts, e.g.
       those in the "Effects" menu. */
    pyxml
    pythonPackages.lxml
    pythonPackages.python
  ];

  buildInputs = [
    aspell
    boehm-gc
    boost
    cairo
    cairomm
    dbus-glib
    fontconfig
    freetype
    glib
    glibmm
    #gnome-vfs
    gsl
    gtk2
    gtkmm_2
    gtkspell_2
    imagemagick
    lcms2
    libcdr
    libexif
    libjpeg
    libpng
    librevenge
    libsigcxx
    libvisio
    libwpg
    libxml2
    pango
    poppler
    popt
    xorg.libX11
    xorg.libXft
    zlib
  ];

  patches = [
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-automagic.patch";
      sha256 = "100b94eee2a9f5ffacafe0732735342cb14b873296de1e982e7db24ced31124e";
    })
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-desktop.patch";
      sha256 = "016adfaddb1c6c509318430fab9d74ee81f5ce9f71a85ccb4b06d6dc221fff03";
    })
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-exif.patch";
      sha256 = "ad4295f73e386ebe89c6f86d456853ceba0b7af24a584b51348b788280145ef0";
    })
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-sk-man.patch";
      sha256 = "56e24d84d5217308df178d64214ec13c4b81ba59541cc6f52415f2207825a274";
    })
    (fetchTritonPatch {
      rev = "6fda2c885b725f8d625b85d2e39b7ef2b18e7ff2";
      file = "inkscape/inkscape-0.48.4-epython.patch";
      sha256 = "279c1dd278bf69c69f4ac2351d8d069f08aa444e45c32ccd564f6962304f3cdb";
    })
  ];

  postPatch = ''
    patchShebangs ./share/extensions
  '' +
  /* Clang gets misdetected, so hardcode the right answer */
  optionalString cc.isClang ''
    sed -i src/ui/tool/node.h \
      -e 's/#if __cplusplus >= 201103L/#if true/'
  '' + ''
    sed -i src/extension/implementation/script.cpp \
      -e 's|@EPYTHON@|${pythonPackages.python.interpreter}|'
  '';

  preConfigure = (
    /* Tarballs do not contain autogen.sh and unique work-arounds
       are required. Run all commands manually instead of using
       autoreconfHook as it does not handle this situation. */
    /* This autoreconf hack is to work around an issue with autopoint and
       intltool both trying to take ownership of the same file.  Autopoint
       is automatically invoked if AM_GNU_GETTEXT_VERSION or
       AM_GNU_GETTEXT_VERSION exist in configure.ac.  To fix this make
       autoreconf execute intltool in place of autopoint */ ''
      autopoint --force<commit_msg>inkscape: fix deprecated scopedPtr for glibmm 2.48<commit_after>{ stdenv
, autoreconfHook
, fetchTritonPatch
, fetchurl
, gettext
, intltool
, makeWrapper
, perl
, perlPackages
, unzip

, aspell
, boehm-gc
, boost
, cairo
, cairomm
, dbus-glib
, fontconfig
, freetype
, glib
, glibmm
, gsl
, gtk2
, gtkmm_2
, gtkspell_2
, imagemagick
, lcms2
, libcdr
, libexif
, libjpeg
, libpng
, librevenge
, libsigcxx
, libvisio
, libwpg
, libxml2
, libxslt
, pango
, poppler
, popt
, pythonPackages
, pyxml
, xorg
, zlib

, boxMakerPlugin ? false
}:

let
  inherit (stdenv)
    cc;
  inherit (stdenv.lib)
    enFlag
    optional
    optionalString
    wtFlag;
in

let
  boxmaker = fetchurl {
    # http://www.inkscapeforum.com/viewtopic.php?f=11&t=10403
    url = "http://www.keppel.demon.co.uk/111000/files/BoxMaker0.91.zip";
    sha256 = "5c5697f43dc3a95468f61f479cb50b7e2b93379a1729abf19e4040ac9f43a1a8";
  };
in

stdenv.mkDerivation rec {
  name = "inkscape-0.91";

  src = fetchurl {
    url = "https://inkscape.global.ssl.fastly.net/media/resources/file/"
        + "${name}.tar.bz2";
    sha256 = "06ql3x732x2rlnanv0a8aharsnj91j5kplksg574090rks51z42d";
  };

  nativeBuildInputs = [
    autoreconfHook
    gettext
    intltool
    libxslt
    makeWrapper
    perl
    perlPackages.XMLParser
  ] ++ optional boxMakerPlugin unzip;

  propagatedBuildInputs = [
    /* Python is used at run-time to execute scripts, e.g.
       those in the "Effects" menu. */
    pyxml
    pythonPackages.lxml
    pythonPackages.python
  ];

  buildInputs = [
    aspell
    boehm-gc
    boost
    cairo
    cairomm
    dbus-glib
    fontconfig
    freetype
    glib
    glibmm
    #gnome-vfs
    gsl
    gtk2
    gtkmm_2
    gtkspell_2
    imagemagick
    lcms2
    libcdr
    libexif
    libjpeg
    libpng
    librevenge
    libsigcxx
    libvisio
    libwpg
    libxml2
    pango
    poppler
    popt
    xorg.libX11
    xorg.libXft
    zlib
  ];

  patches = [
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-automagic.patch";
      sha256 = "100b94eee2a9f5ffacafe0732735342cb14b873296de1e982e7db24ced31124e";
    })
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-desktop.patch";
      sha256 = "016adfaddb1c6c509318430fab9d74ee81f5ce9f71a85ccb4b06d6dc221fff03";
    })
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-exif.patch";
      sha256 = "ad4295f73e386ebe89c6f86d456853ceba0b7af24a584b51348b788280145ef0";
    })
    (fetchTritonPatch {
      rev = "d8eca8b601a550b5ec33beced51f73ccb1ce5e51";
      file = "inkscape/inkscape-0.91_pre3-sk-man.patch";
      sha256 = "56e24d84d5217308df178d64214ec13c4b81ba59541cc6f52415f2207825a274";
    })
    (fetchTritonPatch {
      rev = "6fda2c885b725f8d625b85d2e39b7ef2b18e7ff2";
      file = "inkscape/inkscape-0.48.4-epython.patch";
      sha256 = "279c1dd278bf69c69f4ac2351d8d069f08aa444e45c32ccd564f6962304f3cdb";
    })
    (fetchTritonPatch {
      rev = "be944e6046862c9d2c0e39daf007ae8c26dc4c1e";
      file = "inkscape/inkscape-0.91-deprecated-scopedptr.patch";
      sha256 = "02c77e84c4abd8d20c7c92a02c53cf488cd6452ff2957d0d22406201a11b1cf6";
    })
  ];

  postPatch = ''
    patchShebangs ./share/extensions
  '' +
  /* Clang gets misdetected, so hardcode the right answer */
  optionalString cc.isClang ''
    sed -i src/ui/tool/node.h \
      -e 's/#if __cplusplus >= 201103L/#if true/'
  '' + ''
    sed -i src/extension/implementation/script.cpp \
      -e 's|@EPYTHON@|${pythonPackages.python.interpreter}|'
  '';

  preConfigure = (
    /* Tarballs do not contain autogen.sh and unique work-arounds
       are required. Run all commands manually instead of using
       autoreconfHook as it does not handle this situation. */
    /* This autoreconf hack is to work around an issue with autopoint and
       intltool both trying to take ownership of the same file.  Autopoint
       is automatically invoked if AM_GNU_GETTEXT_VERSION or
       AM_GNU_GETTEXT_VERSION exist in configure.ac.  To fix this make
       autoreconf execute intltool in place of autopoint */ ''
      autopoint --force
{'fraction_non_alphanumeric': 0.09014903671392221, 'fraction_numerical': 0.11620016963528414, 'mean_word_length': 3.0185004868549172, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '108693', 'n_tokens_mistral': 3876, 'n_tokens_neox': 3416, 'n_words': 558}