Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postfix/dovecot/nginx/bird: fix cross build #51848

Merged
merged 9 commits into from Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 22 additions & 4 deletions pkgs/applications/networking/browsers/w3m/default.nix
Expand Up @@ -4,7 +4,7 @@
, graphicsSupport ? true, imlib2 ? null
, x11Support ? graphicsSupport, libX11 ? null
, mouseSupport ? !stdenv.isDarwin, gpm-ncurses ? null
, perl, man, pkgconfig
, perl, man, pkgconfig, buildPackages, w3m
}:

assert sslSupport -> openssl != null;
Expand All @@ -14,7 +14,17 @@ assert mouseSupport -> gpm-ncurses != null;

with stdenv.lib;

stdenv.mkDerivation rec {
let
mktable = buildPackages.stdenv.mkDerivation rec {
name = "w3m-mktable";
inherit (w3m) src;
nativeBuildInputs = [ pkgconfig boehmgc ];
makeFlags = [ "mktable" ];
installPhase = ''
install -D mktable $out/bin/mktable
'';
};
in stdenv.mkDerivation rec {
name = "w3m-0.5.3+git20180125";

src = fetchFromGitHub {
Expand All @@ -31,6 +41,8 @@ stdenv.mkDerivation rec {
PERL = "${perl}/bin/perl";
MAN = "${man}/bin/man";

makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ];

patches = [
./RAND_egd.libressl.patch
(fetchpatch {
Expand All @@ -40,8 +52,14 @@ stdenv.mkDerivation rec {
})
] ++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ];

nativeBuildInputs = [ pkgconfig ];
buildInputs = [ ncurses boehmgc gettext zlib ]
postPatch = optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
ln -s ${mktable}/bin/mktable mktable
# stop make from recompiling mktable
sed -ie 's!mktable.*:.*!mktable:!' Makefile.in
'';

nativeBuildInputs = [ pkgconfig gettext ];
buildInputs = [ ncurses boehmgc zlib ]
++ optional sslSupport openssl
++ optional mouseSupport gpm-ncurses
++ optional graphicsSupport imlib2
Expand Down
8 changes: 8 additions & 0 deletions pkgs/development/libraries/clucene-core/2.x.nix
Expand Up @@ -16,6 +16,14 @@ stdenv.mkDerivation rec {
"-DBUILD_CONTRIBS=ON"
"-DBUILD_CONTRIBS_LIB=ON"
"-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-D_CL_HAVE_GCC_ATOMIC_FUNCTIONS=0"
"-D_CL_HAVE_NAMESPACES_EXITCODE=0"
"-D_CL_HAVE_NO_SNPRINTF_BUG_EXITCODE=0"
"-D_CL_HAVE_NO_SNWPRINTF_BUG_EXITCODE=0"
"-D_CL_HAVE_TRY_BLOCKS_EXITCODE=0"
"-D_CL_HAVE_PTHREAD_MUTEX_RECURSIVE=0"
"-DLUCENE_STATIC_CONSTANT_SYNTAX_EXITCODE=0"
];

patches = # From debian
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/libraries/geoip/default.nix
Expand Up @@ -17,6 +17,11 @@ in stdenv.mkDerivation {

nativeBuildInputs = [ autoreconfHook ];

configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes"
];

postConfigure = ''
find . -name Makefile.in -exec sed -i -r 's#^pkgdatadir\s*=.+$#pkgdatadir = ${dataDir}#' {} \;
'';
Expand Down
33 changes: 21 additions & 12 deletions pkgs/development/libraries/openldap/default.nix
Expand Up @@ -13,18 +13,27 @@ stdenv.mkDerivation rec {

enableParallelBuilding = true;

buildInputs = [ openssl cyrus_sasl db groff libtool ];

configureFlags =
[ "--enable-overlays"
"--disable-dependency-tracking" # speeds up one-time build
"--enable-modules"
"--sysconfdir=/etc"
"--localstatedir=/var"
"--enable-crypt"
] ++ stdenv.lib.optional (openssl == null) "--without-tls"
++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl"
++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
nativeBuildInputs = [ groff ];

buildInputs = [ openssl cyrus_sasl db libtool ];

# Disable install stripping as it breaks cross-compiling.
# We strip binaries anyway in fixupPhase.
makeFlags= [ "STRIP=" ];

configureFlags = [
"--enable-overlays"
"--disable-dependency-tracking" # speeds up one-time build
"--enable-modules"
"--sysconfdir=/etc"
"--localstatedir=/var"
"--enable-crypt"
] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--with-yielding_select=yes"
"ac_cv_func_memcmp_working=yes"
] ++ stdenv.lib.optional (openssl == null) "--without-tls"
++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl"
++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic";

doCheck = false; # needs a running LDAP server

Expand Down
9 changes: 8 additions & 1 deletion pkgs/servers/bird/default.nix
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, flex, bison, readline }:
{ lib, stdenv, fetchurl, fetchpatch, flex, bison, readline }:

with lib;

Expand All @@ -18,8 +18,15 @@ let

patches = [
(./. + "/dont-create-sysconfdir-${builtins.substring 0 1 version}.patch")
# https://github.com/BIRD/bird/pull/4
(fetchpatch {
url = "https://github.com/BIRD/bird/commit/fca9ab48e3823c734886f47156a92f6b804c16e9.patch";
sha256 = "1pnndc3n56lqqcy74ln0w5kn3i9rbzsm2dqiyp1qw7j33dpkln1b";
})
];

CPP="${stdenv.cc.targetPrefix}cpp -E";

configureFlags = [
"--localstatedir=/var"
] ++ optional enableIPv6 "--enable-ipv6";
Expand Down
19 changes: 18 additions & 1 deletion pkgs/servers/http/nginx/generic.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, openssl, zlib, pcre, libxml2, libxslt
{ stdenv, fetchurl, fetchpatch, openssl, zlib, pcre, libxml2, libxslt
, gd, geoip
, withDebug ? false
, withStream ? true
Expand Down Expand Up @@ -60,8 +60,25 @@ stdenv.mkDerivation {

NIX_CFLAGS_COMPILE = [ "-I${libxml2.dev}/include/libxml2" ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations";

configurePlatforms = [];

preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules);

patches = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
(fetchpatch {
url = "https://raw.githubusercontent.com/openwrt/packages/master/net/nginx/patches/102-sizeof_test_fix.patch";
sha256 = "0i2k30ac8d7inj9l6bl0684kjglam2f68z8lf3xggcc2i5wzhh8a";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/openwrt/packages/master/net/nginx/patches/101-feature_test_fix.patch";
sha256 = "0v6890a85aqmw60pgj3mm7g8nkaphgq65dj4v9c6h58wdsrc6f0y";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/openwrt/packages/master/net/nginx/patches/103-sys_nerr.patch";
sha256 = "0s497x6mkz947aw29wdy073k8dyjq8j99lax1a1mzpikzr4rxlmd";
})
];
globin marked this conversation as resolved.
Show resolved Hide resolved

hardeningEnable = optional (!stdenv.isDarwin) "pie";

enableParallelBuilding = true;
Expand Down
17 changes: 17 additions & 0 deletions pkgs/servers/mail/dovecot/default.nix
Expand Up @@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
sha256 = "01ggzf7b3jpl89mjiqr7xbpbs181g2gjf6wzg70qaqfzz3ppc6yr";
};

enableParallelBuilding = true;

preConfigure = ''
patchShebangs src/config/settings-get.pl
'';
Expand Down Expand Up @@ -57,6 +59,21 @@ stdenv.mkDerivation rec {
"--with-ldap"
"--with-lucene"
"--with-icu"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"i_cv_epoll_works=${if stdenv.isLinux then "yes" else "no"}"
"i_cv_posix_fallocate_works=${if stdenv.isDarwin then "no" else "yes"}"
"i_cv_inotify_works=${if stdenv.isLinux then "yes" else "no"}"
"i_cv_signed_size_t=no"
"i_cv_signed_time_t=yes"
"i_cv_c99_vsnprintf=yes"
"lib_cv_va_copy=yes"
"i_cv_mmap_plays_with_write=yes"
"i_cv_gmtime_max_time_t=${toString stdenv.hostPlatform.parsed.cpu.bits}"
"i_cv_signed_time_t=yes"
"i_cv_fd_passing=yes"
"lib_cv_va_copy=yes"
"lib_cv___va_copy=yes"
"lib_cv_va_val_copy=yes"
] ++ lib.optional (stdenv.isLinux) "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
++ lib.optional (stdenv.isDarwin) "--enable-static"
++ lib.optional withMySQL "--with-mysql"
Expand Down
9 changes: 8 additions & 1 deletion pkgs/servers/mail/postfix/default.nix
@@ -1,5 +1,6 @@
{ stdenv, lib, fetchurl, makeWrapper, gnused, db, openssl, cyrus_sasl, libnsl
, coreutils, findutils, gnugrep, gawk, icu, pcre, m4
, buildPackages
, withLDAP ? true, openldap
, withPgSQL ? false, postgresql
, withMySQL ? false, mysql
Expand Down Expand Up @@ -49,13 +50,17 @@ in stdenv.mkDerivation rec {
./relative-symlinks.patch
];

preBuild = ''
postPatch = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
sed -e 's!bin/postconf!${buildPackages.postfix}/bin/postconf!' -i postfix-install
'' + ''
sed -e '/^PATH=/d' -i postfix-install
sed -e "s|@PACKAGE@|$out|" -i conf/post-install

# post-install need skip permissions check/set on all symlinks following to /nix/store
sed -e "s|@NIX_STORE@|$NIX_STORE|" -i conf/post-install
'';

postConfigure = ''
export command_directory=$out/sbin
export config_directory=/etc/postfix
export meta_directory=$out/etc/postfix
Expand All @@ -69,6 +74,8 @@ in stdenv.mkDerivation rec {
export readme_directory=$out/share/postfix/doc
export sendmail_path=$out/bin/sendmail

makeFlagsArray+=(AR=$AR _AR=$AR RANLIB=$RANLIB _RANLIB=$RANLIB)

make makefiles CCARGS='${ccargs}' AUXLIBS='${auxlibs}'
'';

Expand Down
4 changes: 2 additions & 2 deletions pkgs/tools/typesetting/xmlto/default.nix
Expand Up @@ -22,8 +22,8 @@ stdenv.mkDerivation rec {

# `libxml2' provides `xmllint', needed at build-time and run-time.
# `libxslt' provides `xsltproc', used by `xmlto' at run-time.
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ libxml2 libxslt docbook_xml_dtd_45 docbook_xsl getopt ];
nativeBuildInputs = [ makeWrapper getopt ];
buildInputs = [ libxml2 libxslt docbook_xml_dtd_45 docbook_xsl ];

postInstall = ''
wrapProgram "$out/bin/xmlto" \
Expand Down