From 7c1d8636dd990e4763659cc1a7b5134c2a4637b8 Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Sat, 22 May 2021 17:00:24 +0200 Subject: [PATCH] st: support cross-compilation (#123722) --- .../terminal-emulators/st/default.nix | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/terminal-emulators/st/default.nix b/pkgs/applications/terminal-emulators/st/default.nix index 4e43bed0a07..591b68b49ab 100644 --- a/pkgs/applications/terminal-emulators/st/default.nix +++ b/pkgs/applications/terminal-emulators/st/default.nix @@ -1,5 +1,17 @@ -{ lib, stdenv, fetchurl, pkg-config, writeText, libX11, ncurses -, libXft, conf ? null, patches ? [], extraLibs ? []}: +{ lib +, stdenv +, fetchurl +, pkg-config +, writeText +, libX11 +, ncurses +, fontconfig +, freetype +, libXft +, conf ? null +, patches ? [ ] +, extraLibs ? [ ] +}: with lib; @@ -14,18 +26,34 @@ stdenv.mkDerivation rec { inherit patches; - configFile = optionalString (conf!=null) (writeText "config.def.h" conf); + configFile = optionalString (conf != null) (writeText "config.def.h" conf); - postPatch = optionalString (conf!=null) "cp ${configFile} config.def.h" - + optionalString stdenv.isDarwin '' + postPatch = optionalString (conf != null) "cp ${configFile} config.def.h" + + optionalString stdenv.isDarwin '' substituteInPlace config.mk --replace "-lrt" "" ''; - nativeBuildInputs = [ pkg-config ncurses ]; - buildInputs = [ libX11 libXft ] ++ extraLibs; + strictDeps = true; + + makeFlags = [ + "PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config" + ]; + + nativeBuildInputs = [ + pkg-config + ncurses + fontconfig + freetype + ]; + buildInputs = [ + libX11 + libXft + ] ++ extraLibs; installPhase = '' + runHook preInstall TERMINFO=$out/share/terminfo make install PREFIX=$out + runHook postInstall ''; meta = {