Unverified Commit 7f06d157 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

qqwing: fix cross compilation and pkgconfig generation (#337264)

parents e74612b0 948c196e
Loading
Loading
Loading
Loading
+37 −18
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub, perl, autoconf, automake, libtool }:
{
  lib,
  stdenv,
  fetchFromGitHub,
  perl,
  autoconf,
  automake,
  libtool,
}:

stdenv.mkDerivation rec {
  pname = "qqwing";
@@ -7,31 +15,42 @@ stdenv.mkDerivation rec {
  src = fetchFromGitHub {
    owner = "stephenostermiller";
    repo = "qqwing";
    rev = "v${version}";
    sha256 = "1qq0vi4ch4y3a5fb1ncr0yzkj3mbvdiwa3d51qpabq94sh0cz09i";
    rev = "refs/tags/v${version}";
    hash = "sha256-MYHPANQk4aUuDqUNxWPbqw45vweZ2bBcUcMTyEjcAOM=";
  };

  postPatch = ''
    for file in "src-first-comment.pl" "src_neaten.pl"; do
      substituteInPlace "build/$file" \
        --replace "#!/usr/bin/perl" "#!${perl}/bin/perl"
    done
  strictDeps = true;

    substituteInPlace "build/cpp_install.sh" \
      --replace "sudo " ""
  '';
  nativeBuildInputs = [
    autoconf
    automake
    libtool
    perl
  ];

  configureFlags = [
    "--prefix=${placeholder "out"}"
  ];

  nativeBuildInputs = [ autoconf automake ];
  buildInputs = [ perl libtool ];
  buildFlags = [
    "cppcompile"
  ];

  makeFlags = [ "prefix=$(out)" "tgz" ];
  postPatch = ''
    patchShebangs --build build/src-first-comment.pl build/src_neaten.pl

    substituteInPlace build/cpp_configure.sh \
      --replace-fail "./configure" "./configure $configureFlags"
    substituteInPlace build/cpp_install.sh \
      --replace-fail "sudo " ""
  '';

  meta = with lib; {
  meta = {
    homepage = "https://qqwing.com";
    description = "Sudoku generating and solving software";
    license = lib.licenses.gpl2Plus;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ nickcao ];
    mainProgram = "qqwing";
    license = licenses.gpl2Plus;
    platforms = platforms.unix;
    maintainers = [ ];
  };
}