1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00
nixpkgs/pkgs/servers/ftp/vsftpd/default.nix
Lluís Batlle i Rossell 2169b0ab2e vsftpd: fixing build in x86_64/i686
It was building fine in the sheevaplug though.
2013-01-03 19:52:14 +01:00

46 lines
1.2 KiB
Nix

{ stdenv, fetchurl, openssl, sslEnable ? false, libcap, pam }:
stdenv.mkDerivation (rec {
name = "vsftpd-3.0.2";
src = fetchurl {
url = "https://security.appspot.com/downloads/${name}.tar.gz";
sha256 = "0mjy345wszskz1vnk83360c1y37arwgap3gwz8hy13sjqpig0imy";
};
# The gcc-wrappers use -idirafter for glibc, and vsftpd also, and
# their dummyinc come before those of glibc, then the build works bad.
prePatch = ''
sed -i -e 's/-idirafter.*//' Makefile
'';
preBuild = let
sslLibs = if sslEnable then "-lcrypt -lssl -lcrypto " else "";
in ''
makeFlagsArray=( "LIBS=${sslLibs}-lpam -lcap -fstack-protector" )
'';
# It won't link without this flag, used in CFLAGS
buildInputs = [ openssl libcap pam ];
installPhase = ''
mkdir -pv $out/sbin
install -v -m 755 vsftpd $out/sbin/vsftpd
mkdir -pv $out/share/man/man{5,8}
install -v -m 644 vsftpd.8 $out/share/man/man8/vsftpd.8
install -v -m 644 vsftpd.conf.5 $out/share/man/man5/vsftpd.conf.5
mkdir -pv $out/etc/xinetd.d
install -v -m 644 xinetd.d/vsftpd $out/etc/xinetd.d/vsftpd
'';
} // (if sslEnable then {
preConfigure = ''
echo "Will enable SSL"
sed -i "/VSF_BUILD_SSL/s/^#undef/#define/" builddefs.h
'';
} else { })
)