nixpkgs/pkgs/by-name/as/asl/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

58 lines
1.9 KiB
Nix

{ lib
, stdenv
, fetchzip
, texliveMedium
, buildDocs ? false
}:
stdenv.mkDerivation (finalAttrs: {
pname = "asl";
version = "142-bld232";
src = let inherit (finalAttrs) pname version; in fetchzip {
name = "${pname}-${version}";
url = "http://john.ccac.rwth-aachen.de:8000/ftp/as/source/c_version/asl-current-${version}.tar.bz2";
hash = "sha256-Q50GzXBxFMhbt5s9OgHPNH4bdqz2hhEmTnMmKowVn2E=";
};
outputs = [ "out" "doc" "man" ];
nativeBuildInputs = lib.optionals buildDocs [ texliveMedium ];
postPatch = lib.optionalString (!buildDocs) ''
substituteInPlace Makefile --replace "all: binaries docs" "all: binaries"
'' + lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) ''
substituteInPlace sysdefs.h --replace "x86_64" "aarch64"
'';
dontConfigure = true;
preBuild = ''
bindir="${placeholder "out"}/bin" \
docdir="${placeholder "doc"}/share/doc/asl" \
incdir="${placeholder "out"}/include/asl" \
libdir="${placeholder "out"}/lib/asl" \
mandir="${placeholder "man"}/share/man" \
substituteAll ${./Makefile-nixos.def} Makefile.def
mkdir -p .objdir
'';
meta = with lib; {
homepage = "http://john.ccac.rwth-aachen.de:8000/as/index.html";
description = "Portable macro cross assembler";
longDescription = ''
AS is a portable macro cross assembler for a variety of microprocessors
and -controllers. Though it is mainly targeted at embedded processors and
single-board computers, you also find CPU families in the target list that
are used in workstations and PCs.
'';
license = licenses.gpl2Plus;
maintainers = with maintainers; [ AndersonTorres ];
platforms = platforms.unix;
};
})
# TODO: cross-compilation support
# TODO: customize TeX input
# TODO: report upstream about `mkdir -p .objdir/`
# TODO: suggest upstream about building docs as an option