nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 86 lines 3.0 kB view raw
1{ lib, stdenv, fetchurl, makeWrapper, apr, expat, gnused 2, sslSupport ? true, openssl 3, bdbSupport ? true, db 4, ldapSupport ? !stdenv.isCygwin, openldap 5, libiconv, libxcrypt 6, cyrus_sasl, autoreconfHook 7}: 8 9assert sslSupport -> openssl != null; 10assert bdbSupport -> db != null; 11assert ldapSupport -> openldap != null; 12 13stdenv.mkDerivation rec { 14 pname = "apr-util"; 15 version = "1.6.1"; 16 17 src = fetchurl { 18 url = "mirror://apache/apr/${pname}-${version}.tar.bz2"; 19 sha256 = "0nq3s1yn13vplgl6qfm09f7n0wm08malff9s59bqf9nid9xjzqfk"; 20 }; 21 22 patches = [ ./fix-libxcrypt-build.patch ] 23 ++ lib.optional stdenv.isFreeBSD ./include-static-dependencies.patch; 24 25 NIX_CFLAGS_LINK = [ "-lcrypt" ]; 26 27 outputs = [ "out" "dev" ]; 28 outputBin = "dev"; 29 30 nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isFreeBSD autoreconfHook; 31 32 configureFlags = [ "--with-apr=${apr.dev}" "--with-expat=${expat.dev}" ] 33 ++ lib.optional (!stdenv.isCygwin) "--with-crypto" 34 ++ lib.optional sslSupport "--with-openssl=${openssl.dev}" 35 ++ lib.optional bdbSupport "--with-berkeley-db=${db.dev}" 36 ++ lib.optional ldapSupport "--with-ldap=ldap" 37 ++ lib.optionals stdenv.isCygwin 38 [ "--without-pgsql" "--without-sqlite2" "--without-sqlite3" 39 "--without-freetds" "--without-berkeley-db" "--without-crypto" ] 40 ; 41 42 postConfigure = '' 43 echo '#define APR_HAVE_CRYPT_H 1' >> confdefs.h 44 '' + 45 # For some reason, db version 6.9 is selected when cross-compiling. 46 # It's unclear as to why, it requires someone with more autotools / configure knowledge to go deeper into that. 47 # Always replacing the link flag with a generic link flag seems to help though, so let's do that for now. 48 lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' 49 substituteInPlace Makefile \ 50 --replace "-ldb-6.9" "-ldb" 51 substituteInPlace apu-1-config \ 52 --replace "-ldb-6.9" "-ldb" 53 ''; 54 55 propagatedBuildInputs = [ apr expat libiconv libxcrypt ] 56 ++ lib.optional sslSupport openssl 57 ++ lib.optional bdbSupport db 58 ++ lib.optional ldapSupport openldap 59 ++ lib.optional stdenv.isFreeBSD cyrus_sasl; 60 61 postInstall = '' 62 for f in $out/lib/*.la $out/lib/apr-util-1/*.la $dev/bin/apu-1-config; do 63 substituteInPlace $f \ 64 --replace "${expat.dev}/lib" "${expat.out}/lib" \ 65 --replace "${db.dev}/lib" "${db.out}/lib" \ 66 --replace "${openssl.dev}/lib" "${lib.getLib openssl}/lib" 67 done 68 69 # Give apr1 access to sed for runtime invocations. 70 wrapProgram $dev/bin/apu-1-config --prefix PATH : "${gnused}/bin" 71 ''; 72 73 enableParallelBuilding = true; 74 75 passthru = { 76 inherit sslSupport bdbSupport ldapSupport; 77 }; 78 79 meta = with lib; { 80 homepage = "https://apr.apache.org/"; 81 description = "A companion library to APR, the Apache Portable Runtime"; 82 maintainers = [ maintainers.eelco ]; 83 platforms = platforms.unix; 84 license = licenses.asl20; 85 }; 86}