highlight: remove with lib; convert prePatch to postPatch

This commit is contained in:
Sandro Jäckel 2021-11-11 18:10:20 +01:00
parent b7d071664d
commit d3c28b6f84
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5

View file

@ -1,7 +1,5 @@
{ lib, stdenv, fetchFromGitLab, getopt, lua, boost, pkg-config, swig, perl, gcc }: { lib, stdenv, fetchFromGitLab, getopt, lua, boost, pkg-config, swig, perl, gcc }:
with lib;
let let
self = stdenv.mkDerivation rec { self = stdenv.mkDerivation rec {
pname = "highlight"; pname = "highlight";
@ -16,11 +14,12 @@ let
enableParallelBuilding = true; enableParallelBuilding = true;
nativeBuildInputs = [ pkg-config swig perl ] ++ optional stdenv.isDarwin gcc; nativeBuildInputs = [ pkg-config swig perl ]
++ lib.optional stdenv.isDarwin gcc;
buildInputs = [ getopt lua boost ]; buildInputs = [ getopt lua boost ];
prePatch = '' postPatch = ''
substituteInPlace src/makefile \ substituteInPlace src/makefile \
--replace "shell pkg-config" "shell $PKG_CONFIG" --replace "shell pkg-config" "shell $PKG_CONFIG"
substituteInPlace makefile \ substituteInPlace makefile \
@ -36,15 +35,15 @@ let
# This has to happen _before_ the main build because it does a # This has to happen _before_ the main build because it does a
# `make clean' for some reason. # `make clean' for some reason.
preBuild = optionalString (!stdenv.isDarwin) '' preBuild = lib.optionalString (!stdenv.isDarwin) ''
make -C extras/swig $makeFlags perl make -C extras/swig $makeFlags perl
''; '';
postCheck = optionalString (!stdenv.isDarwin) '' postCheck = lib.optionalString (!stdenv.isDarwin) ''
perl -Iextras/swig extras/swig/testmod.pl perl -Iextras/swig extras/swig/testmod.pl
''; '';
preInstall = optionalString (!stdenv.isDarwin) '' preInstall = lib.optionalString (!stdenv.isDarwin) ''
mkdir -p $out/${perl.libPrefix} mkdir -p $out/${perl.libPrefix}
install -m644 extras/swig/highlight.{so,pm} $out/${perl.libPrefix} install -m644 extras/swig/highlight.{so,pm} $out/${perl.libPrefix}
make -C extras/swig clean # Clean up intermediate files. make -C extras/swig clean # Clean up intermediate files.