From e8d9eb71f67c9d1995ef14c8bf005865c944fa6d Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 26 Mar 2023 00:45:29 +0200 Subject: [PATCH] gmime2,gmime3: fix cross by copying iconv-detect.h from void-packages https://github.com/void-linux/void-packages/tree/master/srcpkgs/gmime/files https://github.com/jstedfast/gmime/blob/1137d672654a1e8fdbda52c7e02482c810d237af/configure.ac#L298-L322 --- pkgs/development/libraries/gmime/2.nix | 8 +++++++- pkgs/development/libraries/gmime/3.nix | 19 ++++++++++++++++--- .../libraries/gmime/iconv-detect.h | 6 ++++++ .../libraries/gmime/musl-iconv-detect.h | 6 ++++++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/libraries/gmime/iconv-detect.h create mode 100644 pkgs/development/libraries/gmime/musl-iconv-detect.h diff --git a/pkgs/development/libraries/gmime/2.nix b/pkgs/development/libraries/gmime/2.nix index 2a953fa702c..d6369227739 100644 --- a/pkgs/development/libraries/gmime/2.nix +++ b/pkgs/development/libraries/gmime/2.nix @@ -13,7 +13,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config gobject-introspection ]; propagatedBuildInputs = [ glib zlib libgpg-error ]; - configureFlags = [ "--enable-introspection=yes" ]; + configureFlags = [ + "--enable-introspection=yes" + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "ac_cv_have_iconv_detect_h=yes" ]; postPatch = '' substituteInPlace tests/testsuite.c \ @@ -24,6 +26,10 @@ stdenv.mkDerivation rec { --replace /bin/mkdir mkdir ''; + preConfigure = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + cp ${if stdenv.hostPlatform.isMusl then ./musl-iconv-detect.h else ./iconv-detect.h} ./iconv-detect.h + ''; + nativeCheckInputs = [ gnupg ]; enableParallelBuilding = true; diff --git a/pkgs/development/libraries/gmime/3.nix b/pkgs/development/libraries/gmime/3.nix index 6816c108160..e5a70f23487 100644 --- a/pkgs/development/libraries/gmime/3.nix +++ b/pkgs/development/libraries/gmime/3.nix @@ -12,19 +12,32 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" ]; - buildInputs = [ vala gobject-introspection zlib gpgme libidn2 libunistring ]; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ pkg-config gobject-introspection vala ]; + buildInputs = [ + zlib + gpgme + libidn2 + libunistring + vala # for share/vala/Makefile.vapigen + ]; propagatedBuildInputs = [ glib ]; configureFlags = [ "--enable-introspection=yes" "--enable-vala=yes" - ]; + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "ac_cv_have_iconv_detect_h=yes" ]; postPatch = '' substituteInPlace tests/testsuite.c \ --replace /bin/rm rm ''; + preConfigure = '' + PKG_CONFIG_VAPIGEN_VAPIGEN="$(type -p vapigen)" + export PKG_CONFIG_VAPIGEN_VAPIGEN + '' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + cp ${if stdenv.hostPlatform.isMusl then ./musl-iconv-detect.h else ./iconv-detect.h} ./iconv-detect.h + ''; + nativeCheckInputs = [ gnupg ]; doCheck = true; diff --git a/pkgs/development/libraries/gmime/iconv-detect.h b/pkgs/development/libraries/gmime/iconv-detect.h new file mode 100644 index 00000000000..6d9dd05b59e --- /dev/null +++ b/pkgs/development/libraries/gmime/iconv-detect.h @@ -0,0 +1,6 @@ +/* This is an auto-generated header, DO NOT EDIT! */ + +#define ICONV_ISO_INT_FORMAT "iso-%u-%u" +#define ICONV_ISO_STR_FORMAT "iso-%u-%s" +#define ICONV_SHIFT_JIS "shift-jis" +#define ICONV_10646 "iso-10646" diff --git a/pkgs/development/libraries/gmime/musl-iconv-detect.h b/pkgs/development/libraries/gmime/musl-iconv-detect.h new file mode 100644 index 00000000000..569da106b94 --- /dev/null +++ b/pkgs/development/libraries/gmime/musl-iconv-detect.h @@ -0,0 +1,6 @@ +/* This is an auto-generated header, DO NOT EDIT! */ + +#define ICONV_ISO_INT_FORMAT "iso-%u-%u" +#define ICONV_ISO_STR_FORMAT "iso-%u-%s" +#define ICONV_SHIFT_JIS "shift-jis" +#define ICONV_10646 "UCS-4BE"