about summary refs log tree commit diff
path: root/pkgs/tools/networking/ncftp/default.nix
blob: c31e6333b68469837cda4dedaa0e6d9c550f9a21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ lib, stdenv, fetchurl, ncurses, coreutils }:

stdenv.mkDerivation rec {
  pname = "ncftp";
  version = "3.2.6";

  src = fetchurl {
    url = "ftp://ftp.ncftp.com/ncftp/ncftp-${version}-src.tar.xz";
    sha256 = "1389657cwgw5a3kljnqmhvfh4vr2gcr71dwz1mlhf22xq23hc82z";
  };

  buildInputs = [ ncurses ];

  enableParallelBuilding = true;

  # Workaround build failure on -fno-common toolchains like upstream
  # gcc-10. Otherwise build fails as:
  #   ld: bookmark.o: (.bss+0x20): multiple definition of `gBm';
  #     gpshare.o:(.bss+0x0): first defined here
  env.NIX_CFLAGS_COMPILE = toString ([ "-fcommon" ]
    # these are required for the configure script to work with clang
    ++ lib.optionals stdenv.isDarwin [
      "-Wno-implicit-int"
      "-Wno-implicit-function-declaration"
    ]);

  preConfigure = ''
    find -name Makefile.in | xargs sed -i '/^TMPDIR=/d'

    find . -name '*.sh' -or -name '*.in' -or -name '*.c' -or -name configure | xargs sed -i \
      -e 's@/bin/ls@${coreutils}/bin/ls@g' \
      -e 's@/bin/rm@${coreutils}/bin/rm@g'
  '';

  postInstall = ''
    rmdir $out/etc
    mkdir -p $out/share/doc
    cp -r doc $out/share/doc/ncftp
  '';

  configureFlags = [
    "--enable-ssp"
    "--mandir=$(out)/share/man/"
  ];

  meta = with lib; {
    description = "Command line FTP (File Transfer Protocol) client";
    homepage = "https://www.ncftp.com/ncftp/";
    maintainers = with maintainers; [ bjornfor ];
    platforms = platforms.unix;
    license = licenses.clArtistic;
  };
}