<commit_before>{ stdenv, fetchurl, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw
, cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas
, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages
}:

stdenv.mkDerivation {
  name = "grass-7.2.2";
  src = fetchurl {
    url = http://grass.osgeo.org/grass72/source/grass-7.2.2.tar.gz;
    sha256 = "0yzljbrxlqp4wbw08n1dvmm4vmwkg8glf1ff4xyh589r5ryb7gxv";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo
  readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.connector-c blas ]
    ++ (with python2Packages; [ python dateutil wxPython30 numpy ]);

  # On Darwin the installer tries to symlink the help files into a system
  # directory
  patches = [ ./no_symbolic_links.patch ];

  configureFlags = [
    "--with-proj-share=${proj}/share/proj"
    "--without-opengl"
    "--with-readline"
    "--with-wxwidgets"
    "--with-netcdf"
    "--with-geos"
    "--with-postgres"
    "--with-postgres-libs=${postgresql.lib}/lib/"
    # it complains about missing libmysqld but doesn't really seem to need it
    "--with-mysql"
    "--with-mysql-includes=${mysql.connector-c}/include/mysql"
    "--with-mysql-libs=${mysql.connector-c}/lib/mysql"
    "--with-blas"
  ];

  /* Ensures that the python script run at build time are actually executable;
   * otherwise, patchShebangs ignores them.  */
  postConfigure = ''
    chmod +x scripts/d.out.file/d.out.file.py \
      scripts/d.to.rast/d.to.rast.py \
      scripts/d.what.rast/d.what.rast.py \
      scripts/d.what.vect/d.what.vect.py \
      scripts/g.extension/g.extension.py \
      scripts/g.extension.all/g.extension.all.py \
      scripts/r.pack/r.pack.py \
      scripts/r.tileset/r.tileset.py \<commit_msg>grass: Fix Can't load GDAL library errors on darwin<commit_after>{ stdenv, fetchurl, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw
, cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas
, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages
}:

stdenv.mkDerivation {
  name = "grass-7.2.2";
  src = fetchurl {
    url = http://grass.osgeo.org/grass72/source/grass-7.2.2.tar.gz;
    sha256 = "0yzljbrxlqp4wbw08n1dvmm4vmwkg8glf1ff4xyh589r5ryb7gxv";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo
  readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.connector-c blas ]
    ++ (with python2Packages; [ python dateutil wxPython30 numpy ]);

  # On Darwin the installer tries to symlink the help files into a system
  # directory
  patches = [ ./no_symbolic_links.patch ];

  configureFlags = [
    "--with-proj-share=${proj}/share/proj"
    "--without-opengl"
    "--with-readline"
    "--with-wxwidgets"
    "--with-netcdf"
    "--with-geos"
    "--with-postgres"
    "--with-postgres-libs=${postgresql.lib}/lib/"
    # it complains about missing libmysqld but doesn't really seem to need it
    "--with-mysql"
    "--with-mysql-includes=${mysql.connector-c}/include/mysql"
    "--with-mysql-libs=${mysql.connector-c}/lib/mysql"
    "--with-blas"
  ];

  # Otherwise a very confusing "Can't load GDAL library" error
  makeFlags = stdenv.lib.optional stdenv.isDarwin "GDAL_DYNAMIC=";

  /* Ensures that the python script run at build time are actually executable;
   * otherwise, patchShebangs ignores them.  */
  postConfigure = ''
    chmod +x scripts/d.out.file/d.out.file.py \
      scripts/d.to.rast/d.to.rast.py \
      scripts/d.what.rast/d.what.rast.py \
      scripts/d.what.vect/d.what.vect.py \
      scripts/g.extension/g.extension.py \
      scripts/g.extension.all/g.extension.all.py \
      scripts/r.pack/r.pack.py \
      scripts/r.tileset/r.tileset.py \
{'fraction_non_alphanumeric': 0.13866102143424186, 'fraction_numerical': 0.01746493781423657, 'mean_word_length': 3.064516129032258, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1871972', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1379, 'n_words': 279}