summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/nc/ncftp/package.nix
blob: 85146b1b2527ef1f16caab119de64051f83a21e6 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
{
  lib,
  stdenv,
  fetchurl,
  ncurses,
  coreutils,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "ncftp";
  version = "3.3.0";

  src = fetchurl {
    url = "https://www.ncftp.com/public_ftp/ncftp/ncftp-${finalAttrs.version}-src.tar.gz";
    hash = "sha256-eSD4hMKtr8gsjkHEbW89ImmHhcez9W9Wd6jVyGY5Y4Y=";
  };

  buildInputs = [ ncurses ];

  enableParallelBuilding = true;

  env = {
    NIX_CFLAGS_COMPILE = toString [
      # 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
      "-fcommon"
      # configure fails due to ancient sample C program:
      # error: installation or configuration problem: C compiler cannot create executables.
      "-Wno-implicit-int"
      # error: two or more data types in declaration specifiers
      "-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 = {
    description = "Command line FTP (File Transfer Protocol) client";
    homepage = "https://www.ncftp.com/ncftp/";
    maintainers = with lib.maintainers; [ bjornfor ];
    platforms = lib.platforms.unix;
    license = lib.licenses.clArtistic;
    mainProgram = "ncftp";
  };
})