summary refs log tree commit diff
path: root/pkgs/development/libraries/expat
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/expat')
-rw-r--r--pkgs/development/libraries/expat/default.nix25
1 files changed, 16 insertions, 9 deletions
diff --git a/pkgs/development/libraries/expat/default.nix b/pkgs/development/libraries/expat/default.nix
index a356d7be1a9..3bfc215aea7 100644
--- a/pkgs/development/libraries/expat/default.nix
+++ b/pkgs/development/libraries/expat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, lib }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
@@ -6,29 +6,36 @@
 # files.
 
 stdenv.mkDerivation rec {
-  name = "expat-2.2.8";
+  pname = "expat";
+  version = "2.4.1";
 
   src = fetchurl {
-    url = "https://github.com/libexpat/libexpat/releases/download/R_2_2_8/${name}.tar.xz";
-    sha256 = "16vpj5mk3lps3x7fr8cs03rffx3ir4jilyqw0frayn6q94daijk1";
+    url = "https://github.com/libexpat/libexpat/releases/download/R_${lib.replaceStrings ["."] ["_"] version}/${pname}-${version}.tar.xz";
+    sha256 = "sha256-zwMtDbqbkoY2VI4ysyei1msaq2PE9KE90TLC0dLy+2o=";
   };
 
   outputs = [ "out" "dev" ]; # TODO: fix referrers
   outputBin = "dev";
 
-  configureFlags = stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
+  configureFlags = lib.optional stdenv.isFreeBSD "--with-pic";
 
   outputMan = "dev"; # tiny page for a dev tool
 
   doCheck = true; # not cross;
 
   preCheck = ''
-    patchShebangs ./run.sh
-    patchShebangs ./test-driver-wrapper.sh
+    patchShebangs ./configure ./run.sh ./test-driver-wrapper.sh
   '';
 
-  meta = with stdenv.lib; {
-    homepage = "http://www.libexpat.org/";
+  # CMake files incorrectly calculate library path from dev prefix
+  # https://github.com/libexpat/libexpat/issues/501
+  postFixup = ''
+    substituteInPlace $dev/lib/cmake/expat-${version}/expat-noconfig.cmake \
+      --replace "$"'{_IMPORT_PREFIX}' $out
+  '';
+
+  meta = with lib; {
+    homepage = "https://libexpat.github.io/";
     description = "A stream-oriented XML parser library written in C";
     platforms = platforms.all;
     license = licenses.mit; # expat version