summary refs log tree commit diff
path: root/pkgs/development/libraries/pcre/default.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-10-28 11:45:32 +0100
committerVladimír Čunát <vcunat@gmail.com>2015-10-28 11:50:06 +0100
commit30845d07d8110c034156407c71d71e22f92d194a (patch)
tree09a26ce2c8ce3991a072376b29d79426a3c8790a /pkgs/development/libraries/pcre/default.nix
parentfd1619cf605fa2d9986ceac9d9e70fb0ca4817bd (diff)
downloadnixpkgs-30845d07d8110c034156407c71d71e22f92d194a.tar
nixpkgs-30845d07d8110c034156407c71d71e22f92d194a.tar.gz
nixpkgs-30845d07d8110c034156407c71d71e22f92d194a.tar.bz2
nixpkgs-30845d07d8110c034156407c71d71e22f92d194a.tar.lz
nixpkgs-30845d07d8110c034156407c71d71e22f92d194a.tar.xz
nixpkgs-30845d07d8110c034156407c71d71e22f92d194a.tar.zst
nixpkgs-30845d07d8110c034156407c71d71e22f92d194a.zip
pcre: separate variants of the library
- don't include the cxx variant in the default build,
  as it depends on libstdc++ (and it seems rarely used anyway)
- allow building pcre16 and pcre32 variants;
  pcre16 is the one needed by qt*, I think
- share the basic libs with all of the variants
Diffstat (limited to 'pkgs/development/libraries/pcre/default.nix')
-rw-r--r--pkgs/development/libraries/pcre/default.nix30
1 files changed, 17 insertions, 13 deletions
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index cc655579289..fa4a640bd0b 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -1,9 +1,11 @@
-{ stdenv, fetchurl, unicodeSupport ? true, cplusplusSupport ? true
-, windows ? null
+{ stdenv, fetchurl
+, windows ? null, variant ? null, pcre
 }:
 
 with stdenv.lib;
 
+assert elem variant [ null "cpp" "pcre16" "pcre32" ];
+
 stdenv.mkDerivation rec {
   name = "pcre-8.37";
 
@@ -19,26 +21,28 @@ stdenv.mkDerivation rec {
 
   outputs = [ "dev" "out" "bin" "doc" "man" ];
 
-  configureFlags = ''
-    --enable-jit
-    ${if unicodeSupport then "--enable-unicode-properties" else ""}
-    ${if !cplusplusSupport then "--disable-cpp" else ""}
-  '';
+  configureFlags = [
+    "--enable-jit"
+    "--enable-unicode-properties"
+    "--disable-cpp"
+  ]
+    ++ optional (variant != null) "--enable-${variant}";
 
   doCheck = with stdenv; !(isCygwin || isFreeBSD);
     # XXX: test failure on Cygwin
     # we are running out of stack on both freeBSDs on Hydra
 
+  postFixup = ''
+    _moveToOutput bin/pcre-config "$dev"
+  ''
+    + optionalString (variant != null) ''
+    ln -sf -t "$out/lib/" '${pcre.out}'/lib/libpcre{,posix}.so.*.*.*
+  '';
+
   crossAttrs = optionalAttrs (stdenv.cross.libc == "msvcrt") {
     buildInputs = [ windows.mingw_w64_pthreads.crossDrv ];
   };
 
-  postInstall =
-    ''
-      mkdir $dev/bin
-      mv $bin/bin/pcre-config $dev/bin/
-    '';
-
   meta = {
     homepage = "http://www.pcre.org/";
     description = "A library for Perl Compatible Regular Expressions";