git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #137142 from AndersonTorres/new-asm

Assemblers for 8-bit chips

commit45d44fb1a123af82b62457d95486baa75df9071f authorAnderson Torres <torres.anderson.85@protonmail.com> dateThu 9 Sep 2021, 22:36 (5 years ago) parent336f8298d06eef
6 files changed+165
pkgs/development/compilers/as31/0000-getline-break.patch+24 pkgs/development/compilers/as31/default.nix+43 pkgs/development/compilers/atasm/0000-file-not-found.diff+16 pkgs/development/compilers/atasm/0001-select-flags.diff+14 pkgs/development/compilers/atasm/default.nix+64 pkgs/top-level/all-packages.nix+4
pkgs/development/compilers/as31/0000-getline-break.patchnew file+24
@@ -0,0 +1,24 @@
1+diff --git old/as31/run.c new/as31/run.c
2+index 28c5317..9e5263b 100644
3+--- old/as31/run.c
4++++ new/as31/run.c
5+@@ -113,7 +113,8 @@ int run_as31(const char *infile, int lst, int use_stdout,
6+ }
7+
8+ while (!feof(finPre)) {
9+- getline(&lineBuffer,&sizeBuf,finPre);
10++ if (getline(&lineBuffer,&sizeBuf,finPre) == -1)
11++ break;
12+ if ((includePtr=strstr(lineBuffer,INC_CMD))) {
13+ includePtr=includePtr+strlen(INC_CMD);
14+ while ((*includePtr==' ')|| //move includePtr to filename
15+@@ -138,7 +139,8 @@ int run_as31(const char *infile, int lst, int use_stdout,
16+ mesg_f("Cannot open include file: %s\n",includePtr);
17+ } else {
18+ while (!feof(includeFile)) {
19+- getline(&incLineBuffer,&incSizeBuf,includeFile);
20++ if (getline(&incLineBuffer,&incSizeBuf,includeFile) == -1)
21++ break;
22+ fprintf(fin,"%s",incLineBuffer);
23+ if (strlen(incLineBuffer)) {
24+ incLineCount++;
pkgs/development/compilers/as31/default.nixnew file+43
@@ -0,0 +1,43 @@
1+{ lib
2+, stdenv
3+, fetchurl
4+, bison
5+}:
6+
7+stdenv.mkDerivation rec {
8+ pname = "as31";
9+ version = "2.3.1";
10+
11+ src = fetchurl {
12+ url = "http://wiki.erazor-zone.de/_media/wiki:projects:linux:as31:${pname}-${version}.tar.gz";
13+ name = "${pname}-${version}.tar.gz";
14+ hash = "sha256-zSEyWHFon5nyq717Mpmdv1XZ5Hz0e8ZABqsP8M83c1U=";
15+ };
16+
17+ patches = [
18+ # Check return value of getline in run.c
19+ ./0000-getline-break.patch
20+ ];
21+
22+ postPatch = ''
23+ # parser.c is generated from parser.y; it is better to generate it via bison
24+ # instead of using the prebuilt one, especially in x86_64
25+ rm -f as31/parser.c
26+ '';
27+
28+ preConfigure = ''
29+ chmod +x configure
30+ '';
31+
32+ nativeBuildInputs = [
33+ bison
34+ ];
35+
36+ meta = with lib; {
37+ homepage = "http://wiki.erazor-zone.de/wiki:projects:linux:as31";
38+ description = "An 8031/8051 assembler";
39+ license = licenses.gpl2Plus;
40+ maintainers = with maintainers; [ AndersonTorres ];
41+ platforms = platforms.unix;
42+ };
43+}
pkgs/development/compilers/atasm/0000-file-not-found.diffnew file+16
@@ -0,0 +1,16 @@
1+diff -Naur atasm109-old/src/Makefile atasm109-new/src/Makefile
2+--- atasm109-old/src/Makefile 2021-09-08 09:53:25.581598063 -0300
3++++ atasm109-new/src/Makefile 2021-09-08 09:55:20.366131338 -0300
4+@@ -55,9 +55,9 @@
5+ chown root.root $(DESTDIR)/atasm || true
6+ chmod 711 $(DESTDIR)/atasm
7+ mkdir $(DOCDIR) >/dev/null 2>&1 || echo $(DOCDIR) already exists
8+- cp ../atasm.txt $(DOCDIR)
9+- chown root.root $(DOCDIR)/atasm.txt || true
10+- chmod 644 $(DOCDIR)/atasm.txt
11++ # cp ../atasm.txt $(DOCDIR)
12++ # chown root.root $(DOCDIR)/atasm.txt || true
13++ # chmod 644 $(DOCDIR)/atasm.txt
14+ sed -e 's,%%DOCDIR%%,$(DOCDIR),g' < atasm.1.in > atasm.1
15+ cp atasm.1 $(MANDIR)
16+ chown root.root $(MANDIR)/atasm.1 || true
pkgs/development/compilers/atasm/0001-select-flags.diffnew file+14
@@ -0,0 +1,14 @@
1+diff -Naur atasm109-old/src/Makefile atasm109-new/src/Makefile
2+--- atasm109-old/src/Makefile 2021-09-08 09:53:25.581598063 -0300
3++++ atasm109-new/src/Makefile 2021-09-08 09:55:20.366131338 -0300
4+@@ -16,8 +16,8 @@
5+ UNIX = -DUNIX
6+
7+ # Compiler flags, if you are using egcs, pgcs, or gcc >2.8.1 use:
8+-#CFLAGS = -g -Wall $(USEZ) $(DOS) $(UNIX) $(ARCH)
9+-CFLAGS = -Wall $(USEZ) $(DOS) $(UNIX) -O3 -fomit-frame-pointer $(ARCH)
10++CFLAGS = -g -Wall $(USEZ) $(DOS) $(UNIX) $(ARCH)
11++#CFLAGS = -Wall $(USEZ) $(DOS) $(UNIX) -O3 -fomit-frame-pointer $(ARCH)
12+
13+ L = $(ZLIB)
14+ CC = gcc
pkgs/development/compilers/atasm/default.nixnew file+64
@@ -0,0 +1,64 @@
1+{ lib
2+, stdenv
3+, fetchurl
4+, unzip
5+, zlib
6+}:
7+
8+stdenv.mkDerivation rec {
9+ pname = "atasm";
10+ version = "1.09";
11+
12+ src = fetchurl {
13+ url = "https://atari.miribilist.com/${pname}/${pname}${builtins.replaceStrings ["."] [""] version}.zip";
14+ hash = "sha256-26shhw2r30GZIPz6S1rf6dOLKRpgpLwrqCRZX3+8PvA=";
15+ };
16+
17+ patches = [
18+ # make install fails because atasm.txt was moved; report to upstream
19+ ./0000-file-not-found.diff
20+ # select flags for compilation
21+ ./0001-select-flags.diff
22+ ];
23+
24+ dontConfigure = true;
25+
26+ nativeBuildInputs = [
27+ unzip
28+ ];
29+
30+ buildInputs = [
31+ zlib
32+ ];
33+
34+ preBuild = ''
35+ makeFlagsArray+=(
36+ -C ./src
37+ CC=cc
38+ USEZ="-DZLIB_CAPABLE -I${zlib}/include"
39+ ZLIB="-L${zlib}/lib -lz"
40+ UNIX="-DUNIX"
41+ )
42+ '';
43+
44+ preInstall = ''
45+ install -d $out/share/doc/${pname} $out/man/man1
46+ installFlagsArray+=(
47+ DESTDIR=$out
48+ DOCDIR=$out/share/doc/${pname}
49+ MANDIR=$out/man/man1
50+ )
51+ '';
52+
53+ postInstall = ''
54+ mv docs/* $out/share/doc/${pname}
55+ '';
56+
57+ meta = with lib; {
58+ homepage = "https://atari.miribilist.com/atasm/";
59+ description = "A commandline 6502 assembler compatible with Mac/65";
60+ license = licenses.gpl2Plus;
61+ maintainers = with maintainers; [ AndersonTorres ];
62+ platforms = with platforms; unix;
63+ };
64+}
pkgs/top-level/all-packages.nix+4
@@ -10843,10 +10843,14 @@ with pkgs;
1084310843
1084410844 asciigraph = callPackage ../tools/text/asciigraph { };
1084510845
10846+ as31 = callPackage ../development/compilers/as31 { };
10847+
1084610848 asn1c = callPackage ../development/compilers/asn1c { };
1084710849
1084810850 aspectj = callPackage ../development/compilers/aspectj { };
1084910851
10852+ atasm = callPackage ../development/compilers/atasm { };
10853+
1085010854 ats = callPackage ../development/compilers/ats { };
1085110855 ats2 = callPackage ../development/compilers/ats2 { };
1085210856