summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/bw/bwbasic/package.nix
blob: 9b3c6a441f939dcfed0c9d7000db8884fd752cf7 (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
{
  lib,
  stdenv,
  dos2unix,
  fetchurl,
  unzip,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "bwbasic";
  version = "3.40";

  src = fetchurl {
    url = "mirror://sourceforge/project/bwbasic/bwbasic/version%20${finalAttrs.version}/bwbasic-${finalAttrs.version}.zip";
    hash = "sha256-tWiUIqCdBarhFDSX0iV55VxOEh7iuAbnOLSDuMAAog8=";
  };

  nativeBuildInputs = [
    dos2unix
    unzip
  ];

  sourceRoot = ".";

  postPatch = ''
    dos2unix configure
    patchShebangs configure
    chmod +x configure
    substituteInPlace bwbasic.h \
      --replace-fail "extern int putenv (const char *buffer)" "extern int putenv (char *buffer)"
  '';

  env.NIX_CFLAGS_COMPILE = "-std=c89";

  hardeningDisable = [ "format" ];

  preInstall = ''
    mkdir -p $out/bin
  '';

  meta = {
    description = "Bywater BASIC Interpreter";
    mainProgram = "bwbasic";
    license = lib.licenses.gpl2Only;
    maintainers = with lib.maintainers; [ irenes ];
    platforms = lib.platforms.all;
    homepage = "https://sourceforge.net/projects/bwbasic/";
  };
})