Unverified Commit fc1dd6b8 authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

otpw: fix build with gcc15 (#516208)

parents 3f5c5025 a91c6671
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  stdenv,
  coreutils,
  fetchDebianPatch,
  fetchurl,
  libxcrypt,
  pam,
@@ -20,7 +21,17 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-mKyjimHHcTZ3uW8kQmynBTSAwP0HfZGx6ZvJ+SzLgyo=";
  };

  patchPhase = ''
  patches = [
    (fetchDebianPatch {
      pname = "otpw";
      version = "1.5";
      debianRevision = "6";
      patch = "gcc15.patch";
      hash = "sha256-lR/FZannn9YVCTj+DWZvIyu99lmkaUxG48TGzckyolU=";
    })
  ];

  postPatch = ''
    sed -i 's/^CFLAGS.*/CFLAGS=-O2 -fPIC/' Makefile
    substituteInPlace otpw-gen.c \
      --replace "head -c 20 /dev/urandom 2>&1" "${coreutils}/bin/head -c 20 /dev/urandom 2>&1" \