From 5c7cfbc0f11e360f50467b20a407c675c976d3a0 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Wed, 25 Jul 2018 16:32:42 +0800 Subject: [PATCH] allow postgresql cross compiling --- .../libraries/libossp-uuid/default.nix | 8 +++++++- .../libraries/libossp-uuid/shtool.patch | 11 +++++++++++ pkgs/servers/sql/postgresql/default.nix | 16 ++++++++++++---- 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 pkgs/development/libraries/libossp-uuid/shtool.patch diff --git a/pkgs/development/libraries/libossp-uuid/default.nix b/pkgs/development/libraries/libossp-uuid/default.nix index ddfc2a5132c7..4cd68f2f1b53 100644 --- a/pkgs/development/libraries/libossp-uuid/default.nix +++ b/pkgs/development/libraries/libossp-uuid/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl}: +{stdenv, fetchurl, buildPackages}: let version = "1.6.2"; in @@ -12,6 +12,12 @@ stdenv.mkDerivation { configureFlags = stdenv.lib.optional stdenv.isFreeBSD "--with-pic"; + patches = [ ./shtool.patch ]; + + preConfigure = '' + export ac_cv_va_copy=yes + ''; + meta = with stdenv.lib; { homepage = http://www.ossp.org/pkg/lib/uuid/; description = "OSSP uuid ISO-C and C++ shared library"; diff --git a/pkgs/development/libraries/libossp-uuid/shtool.patch b/pkgs/development/libraries/libossp-uuid/shtool.patch new file mode 100644 index 000000000000..f0c7cc485f50 --- /dev/null +++ b/pkgs/development/libraries/libossp-uuid/shtool.patch @@ -0,0 +1,11 @@ +--- a/shtool 2008-07-05 05:43:08.000000000 +0800 ++++ b/shtool 2018-07-25 15:45:40.559587471 +0800 +@@ -1400,7 +1400,7 @@ + if [ ".$opt_t" = .yes ]; then + echo "strip $dsttmp" 1>&2 + fi +- strip $dsttmp || shtool_exit $? ++ $STRIP $dsttmp || shtool_exit $? + fi + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index a727b60dd9d4..e558e7ee5aed 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, glibc, fetchurl, zlib, readline, libossp_uuid, openssl, libxml2, makeWrapper }: +{ lib, stdenv, glibc, fetchurl, zlib, readline, libossp_uuid, openssl, libxml2, makeWrapper, tzdata, symlinkJoin }: let @@ -14,8 +14,15 @@ let outputs = [ "out" "lib" "doc" "man" ]; setOutputFlags = false; # $out retains configureFlags :-/ + combinedLibXML2 = symlinkJoin { + name = "libxml2-combined"; + paths = [ libxml2 libxml2.dev ]; + }; + + nativeBuildInputs = [ combinedLibXML2 ]; + buildInputs = - [ zlib readline openssl libxml2 makeWrapper ] + [ zlib readline openssl makeWrapper ] ++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ]; enableParallelBuilding = true; @@ -28,8 +35,9 @@ let "--sysconfdir=/etc" "--libdir=$(lib)/lib" ] - ++ lib.optional (stdenv.isDarwin) "--with-uuid=e2fs" - ++ lib.optional (!stdenv.isDarwin) "--with-ossp-uuid"; + ++ lib.optional stdenv.isDarwin "--with-uuid=e2fs" + ++ lib.optional (!stdenv.isDarwin) "--with-ossp-uuid" + ++ lib.optional stdenv.isCross "--with-system-tzdata=${tzdata}"; patches = [ (if atLeast "9.4" then ./disable-resolve_symlinks-94.patch else ./disable-resolve_symlinks.patch)