1{ lib
2, stdenv
3, fetchzip
4, tex
5, buildDocs ? false
6}:
7
8stdenv.mkDerivation (finalAttrs: {
9 pname = "asl";
10 version = "142-bld232";
11
12 src = let inherit (finalAttrs) pname version; in fetchzip {
13 name = "${pname}-${version}";
14 url = "http://john.ccac.rwth-aachen.de:8000/ftp/as/source/c_version/asl-current-${version}.tar.bz2";
15 hash = "sha256-Q50GzXBxFMhbt5s9OgHPNH4bdqz2hhEmTnMmKowVn2E=";
16 };
17
18 outputs = [ "out" "doc" "man" ];
19
20 nativeBuildInputs = lib.optionals buildDocs [ tex ];
21
22 postPatch = lib.optionalString (!buildDocs) ''
23 substituteInPlace Makefile --replace "all: binaries docs" "all: binaries"
24 '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
25 substituteInPlace sysdefs.h --replace "x86_64" "aarch64"
26 '';
27
28 dontConfigure = true;
29
30 preBuild = ''
31 bindir="${placeholder "out"}/bin" \
32 docdir="${placeholder "doc"}/share/doc/asl" \
33 incdir="${placeholder "out"}/include/asl" \
34 libdir="${placeholder "out"}/lib/asl" \
35 mandir="${placeholder "man"}/share/man" \
36 substituteAll ${./Makefile-nixos.def} Makefile.def
37 mkdir -p .objdir
38 '';
39
40 meta = with lib; {
41 homepage = "http://john.ccac.rwth-aachen.de:8000/as/index.html";
42 description = "Portable macro cross assembler";
43 longDescription = ''
44 AS is a portable macro cross assembler for a variety of microprocessors
45 and -controllers. Though it is mainly targeted at embedded processors and
46 single-board computers, you also find CPU families in the target list that
47 are used in workstations and PCs.
48 '';
49 license = licenses.gpl2Plus;
50 maintainers = with maintainers; [ AndersonTorres ];
51 platforms = platforms.unix;
52 };
53})
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