mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 11:53:27 +00:00
e0464e4788
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" ```
47 lines
1.3 KiB
Nix
47 lines
1.3 KiB
Nix
{ lib, stdenv, fetchFromGitHub, nasm }:
|
|
|
|
let arch =
|
|
if stdenv.hostPlatform.isi686 then "i386"
|
|
else if stdenv.hostPlatform.isx86_64 then "x86_64"
|
|
else throw "Unknown architecture";
|
|
in stdenv.mkDerivation {
|
|
pname = "grub4dos";
|
|
version = "0.4.6a-2019-05-12";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "chenall";
|
|
repo = "grub4dos";
|
|
rev = "e8224a2d20760139ffaeafa07838e2c3c54de783";
|
|
sha256 = "0i7n71za43qnlsxfvjrv1z5g1w5jl9snpbnas7rw97rry7cgyswf";
|
|
};
|
|
|
|
nativeBuildInputs = [ nasm ];
|
|
|
|
hardeningDisable = [ "stackprotector" ];
|
|
|
|
configureFlags = [ "--host=${arch}-pc-linux-gnu" ];
|
|
|
|
postInstall = ''
|
|
mv $out/lib/grub/${arch}-pc/* $out/lib/grub
|
|
rmdir $out/lib/grub/${arch}-pc
|
|
chmod +x $out/lib/grub/bootlace.com
|
|
'';
|
|
|
|
dontStrip = true;
|
|
dontPatchELF = true;
|
|
|
|
# make[2]: *** No rule to make target 'pre_stage2_fullsize', needed by 'all-am'. Stop.
|
|
enableParallelBuilding = false;
|
|
|
|
meta = with lib; {
|
|
homepage = "http://grub4dos.chenall.net/";
|
|
description = "GRUB for DOS is the dos extension of GRUB";
|
|
maintainers = with maintainers; [ abbradar ];
|
|
platforms = platforms.linux;
|
|
license = licenses.gpl2Plus;
|
|
# Needs a port to modern binutils:
|
|
# https://github.com/chenall/grub4dos/issues/160
|
|
broken = true;
|
|
};
|
|
}
|