From 26db7273f4a761443c505e56d2ba3e36b3c7fcde Mon Sep 17 00:00:00 2001
From: Gabriel Ebner <gebner@gebner.org>
Date: Mon, 18 Jun 2018 10:07:03 +0200
Subject: [PATCH] mozjpeg: 3.2 -> 3.3.1

---
 pkgs/applications/graphics/mozjpeg/default.nix | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/pkgs/applications/graphics/mozjpeg/default.nix b/pkgs/applications/graphics/mozjpeg/default.nix
index 33785a279c7b..b48fd891a6ac 100644
--- a/pkgs/applications/graphics/mozjpeg/default.nix
+++ b/pkgs/applications/graphics/mozjpeg/default.nix
@@ -1,19 +1,17 @@
-{ stdenv, fetchurl, file, pkgconfig, libpng, nasm }:
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libpng, nasm }:
 
 stdenv.mkDerivation rec {
-  version = "3.2";
+  version = "3.3.1";
   name = "mozjpeg-${version}";
 
-  src = fetchurl {
-    url = "https://github.com/mozilla/mozjpeg/releases/download/v${version}/mozjpeg-${version}-release-source.tar.gz";
-    sha256 = "0wvv5qh1jasz8apq93c3j9d5wd22j7lld9dr06p76yj4mpnc3v4a";
+  src = fetchFromGitHub {
+    owner = "mozilla";
+    repo = "mozjpeg";
+    rev = "v${version}";
+    sha256 = "1na68860asn8b82ny5ilwbhh4nyl9gvx2yxmm4wr2v1v95v51fky";
   };
 
-  postPatch = ''
-    sed -i -e "s!/usr/bin/file!${file}/bin/file!g" configure
-  '';
-
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [ libpng nasm ];
 
   meta = {