Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
lib,
makeWrapper,
perl,
stdenv,
gccStdenv,
texinfo,
unzip,
which,
}:

let
s = import ./sources.nix { inherit fetchurl fetchFromGitHub; };
stdenv = gccStdenv;
in
assert lib.elem targetArchitecture [
"i586"
Expand All @@ -28,22 +29,21 @@ stdenv.mkDerivation rec {
version = s.gccVersion;
src = s.src;

patchPhase = ''
runHook prePatch
postPatch = ''
for f in "build-djgpp.sh" "script/${version}" "setenv/copyfile.sh"; do
substituteInPlace "$f" --replace '/usr/bin/env' '${buildPackages.coreutils}/bin/env'
substituteInPlace "$f" --replace-fail '/usr/bin/env' '${buildPackages.coreutils}/bin/env'
done

# Fix for x86_64-darwin: Apple's older cctools strip fails on GCC binaries.
substituteInPlace script/${version} \
--replace-fail '} install-strip' '} install'
''
# i686 patches from https://github.com/andrewwutw/build-djgpp/issues/45#issuecomment-1484010755
# The build script unpacks some files so we can't patch ahead of time, instead patch the script
# to patch after it extracts

+ lib.optionalString (targetArchitecture == "i686") ''
sed -i 's/i586/i686/g' setenv/setenv script/${version}
sed -i '/Building DXE tools./a sed -i "s/i586/i686/g" src/makefile.def src/dxe/makefile.dxe' script/${version}
''
+ ''
runHook postPatch
'';

nativeBuildInputs = [
Expand All @@ -61,7 +61,14 @@ stdenv.mkDerivation rec {
which
];

hardeningDisable = [ "format" ];
# Added strictflexarrays1 to prevent the new stdenv flag from breaking old C code
hardeningDisable = [
"format"
"strictflexarrays1"
];

# Force GCC to use the older C17 standard for GMP 6.2.1 configure compatibility
NIX_CFLAGS_COMPILE = "-std=gnu17";

# stripping breaks static libs, causing this when you attempt to compile a binary:
# error adding symbols: Archive has no index; run ranlib to add one
Expand Down
10 changes: 10 additions & 0 deletions pkgs/by-name/dj/djgpp_i686/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
lib,
djgpp_i586,
}:

lib.lowPrio (
djgpp_i586.override {
targetArchitecture = "i686";
}
)
10 changes: 0 additions & 10 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -334,16 +334,6 @@ with pkgs;
dinghy = with python3Packages; toPythonApplication dinghy;

djgpp = djgpp_i586;
djgpp_i586 = callPackage ../development/compilers/djgpp {
targetArchitecture = "i586";
stdenv = gccStdenv;
};
djgpp_i686 = lowPrio (
callPackage ../development/compilers/djgpp {
targetArchitecture = "i686";
stdenv = gccStdenv;
}
);

dnf-plugins-core = with python3Packages; toPythonApplication dnf-plugins-core;

Expand Down
Loading