@@ -0,0 +1,57 @@
1+{ lib
2+, stdenv
3+, fetchzip
4+, buildDocs? false, tex
5+}:
6+
7+stdenv.mkDerivation rec {
8+ pname = "asl";
9+ version = "142-bld211";
10+
11+ src = fetchzip {
12+ name = "${pname}-${version}";
13+ url = "http://john.ccac.rwth-aachen.de:8000/ftp/as/source/c_version/asl-current-${version}.tar.bz2";
14+ hash = "sha256-Sbm16JX7kC/7Ws7YgNBUXNqOCl6u+RXgfNjTODhCzSM=";
15+ };
16+
17+ nativeBuildInputs = lib.optional buildDocs [ tex ];
18+
19+ postPatch = lib.optionalString (!buildDocs) ''
20+ substituteInPlace Makefile --replace "all: binaries docs" "all: binaries"
21+ '';
22+
23+ dontConfigure = true;
24+
25+ preBuild = ''
26+ bindir="${placeholder "out"}/bin" \
27+ docdir="${placeholder "out"}/doc/asl" \
28+ incdir="${placeholder "out"}/include/asl" \
29+ libdir="${placeholder "out"}/lib/asl" \
30+ mandir="${placeholder "out"}/share/man" \
31+ substituteAll ${./Makefile-nixos.def} Makefile.def
32+ mkdir -p .objdir
33+ '';
34+
35+ hardenedDisable = [ "all" ];
36+
37+ # buildTargets = [ "binaries" "docs" ];
38+
39+ meta = with lib; {
40+ homepage = "http://john.ccac.rwth-aachen.de:8000/as/index.html";
41+ description = "Portable macro cross assembler";
42+ longDescription = ''
43+ AS is a portable macro cross assembler for a variety of microprocessors
44+ and -controllers. Though it is mainly targeted at embedded processors and
45+ single-board computers, you also find CPU families in the target list that
46+ are used in workstations and PCs.
47+ '';
48+ license = licenses.gpl2Plus;
49+ maintainers = with maintainers; [ AndersonTorres ];
50+ platforms = platforms.unix;
51+ };
52+}
53+# TODO: multiple outputs
54+# TODO: cross-compilation support
55+# TODO: customize TeX input
56+# TODO: report upstream about `mkdir -p .objdir/`
57+# TODO: suggest upstream about building docs as an option