mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
73 lines
2.0 KiB
Nix
73 lines
2.0 KiB
Nix
{ stdenv, lib, fetchFromGitHub, cmake, libetpan, icu, cyrus_sasl, libctemplate
|
|
, libuchardet, pkg-config, glib, html-tidy, libxml2, libuuid, openssl
|
|
, darwin
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "mailcore2";
|
|
|
|
version = "0.6.4";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "MailCore";
|
|
repo = "mailcore2";
|
|
rev = version;
|
|
sha256 = "0a69q11z194fdfwyazjyyylx57sqs9j4lz7jwh5qcws8syqgb23z";
|
|
};
|
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
|
buildInputs = [
|
|
libetpan cyrus_sasl libctemplate libuchardet
|
|
html-tidy libxml2 openssl
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
glib
|
|
icu
|
|
libuuid
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
darwin.apple_sdk.frameworks.Foundation
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace CMakeLists.txt \
|
|
--replace " icule iculx" "" \
|
|
--replace "tidy/tidy.h" "tidy.h" \
|
|
--replace "/usr/include/tidy" "${html-tidy}/include" \
|
|
--replace "/usr/include/libxml2" "${libxml2.dev}/include/libxml2"
|
|
substituteInPlace src/core/basetypes/MCHTMLCleaner.cpp \
|
|
--replace buffio.h tidybuffio.h
|
|
substituteInPlace src/core/basetypes/MCString.cpp \
|
|
--replace "xmlErrorPtr" "const xmlError *"
|
|
'' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
|
substituteInPlace src/core/basetypes/MCICUTypes.h \
|
|
--replace "__CHAR16_TYPE__ UChar" "char16_t UChar"
|
|
'';
|
|
|
|
cmakeFlags = lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
"-DBUILD_SHARED_LIBS=ON"
|
|
];
|
|
|
|
installPhase = ''
|
|
mkdir $out
|
|
cp -r src/include $out
|
|
|
|
mkdir $out/lib
|
|
cp src/libMailCore.* $out/lib
|
|
'';
|
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
checkPhase = ''
|
|
(
|
|
cd unittest
|
|
TZ=PST8PDT ./unittestcpp ../../unittest/data
|
|
)
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP";
|
|
homepage = "http://libmailcore.com";
|
|
license = licenses.bsd3;
|
|
maintainers = [ ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|