Unverified Commit b8f09609 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #307966 from donovanglover/picoc

picoc: 2015-05-04 -> 2.1-unstable-2018-06-05
parents bca2c03f efd76ba1
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub, readline }:
{ lib, stdenv, fetchFromGitLab, readline }:

stdenv.mkDerivation rec {
stdenv.mkDerivation {
  pname = "picoc";
  version = "2015-05-04";
  version = "2.1-unstable-2018-06-05";

  src = fetchFromGitHub {
    sha256 = "01w3jwl0vn9fsmh7p20ad4nl9ljzgfn576yvncd9pk9frx3pd8y4";
    rev = "4555e8456f020554bcac50751fbb9b36c7d8c13b";
    repo = "picoc";
  src = fetchFromGitLab {
    owner = "zsaleeba";
    repo = "picoc";
    rev = "dc85a51e9211cfb644f0a85ea9546e15dc1141c3";
    hash = "sha256-yWPRbJLT09E7pqqs9E2k48ECoRR2nhcgTgK5pumkrxo=";
  };

  buildInputs = [ readline ];

  makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];

  postPatch = ''
    substituteInPlace Makefile --replace '`svnversion -n`' "${version}"
  '';
  env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
    "-Wno-error=implicit-function-declaration"
  ]);

  enableParallelBuilding = true;

  # Tests are currently broken on i686 see
  # https://hydra.nixos.org/build/24003763/nixlog/1
  doCheck = if stdenv.isi686 then false else true;
  doCheck = !stdenv.isi686 && !stdenv.isAarch64;
  checkTarget = "test";

  installPhase = ''
    runHook preInstall

    install -Dm755 picoc $out/bin/picoc

    mkdir -p $out/include
    install -m644 *.h $out/include

    runHook postInstall
  '';

  meta = with lib; {
    broken = (stdenv.isLinux && stdenv.isAarch64);
    description = "Very small C interpreter for scripting";
    mainProgram = "picoc";
    longDescription = ''
@@ -47,7 +50,7 @@ stdenv.mkDerivation rec {
      very sparing of data space. This means it can work well in small embedded
      devices.
    '';
    homepage = "https://github.com/zsaleeba/picoc";
    homepage = "https://gitlab.com/zsaleeba/picoc";
    downloadPage = "https://code.google.com/p/picoc/downloads/list";
    license = licenses.bsd3;
    platforms = platforms.unix;