st: support cross-compilation (#123722)
This commit is contained in:
parent
31aab8c980
commit
7c1d8636dd
1 changed files with 35 additions and 7 deletions
|
@ -1,5 +1,17 @@
|
||||||
{ lib, stdenv, fetchurl, pkg-config, writeText, libX11, ncurses
|
{ lib
|
||||||
, libXft, conf ? null, patches ? [], extraLibs ? []}:
|
, stdenv
|
||||||
|
, fetchurl
|
||||||
|
, pkg-config
|
||||||
|
, writeText
|
||||||
|
, libX11
|
||||||
|
, ncurses
|
||||||
|
, fontconfig
|
||||||
|
, freetype
|
||||||
|
, libXft
|
||||||
|
, conf ? null
|
||||||
|
, patches ? [ ]
|
||||||
|
, extraLibs ? [ ]
|
||||||
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
@ -14,18 +26,34 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
inherit patches;
|
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"
|
postPatch = optionalString (conf != null) "cp ${configFile} config.def.h"
|
||||||
+ optionalString stdenv.isDarwin ''
|
+ optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace config.mk --replace "-lrt" ""
|
substituteInPlace config.mk --replace "-lrt" ""
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config ncurses ];
|
strictDeps = true;
|
||||||
buildInputs = [ libX11 libXft ] ++ extraLibs;
|
|
||||||
|
makeFlags = [
|
||||||
|
"PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config"
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkg-config
|
||||||
|
ncurses
|
||||||
|
fontconfig
|
||||||
|
freetype
|
||||||
|
];
|
||||||
|
buildInputs = [
|
||||||
|
libX11
|
||||||
|
libXft
|
||||||
|
] ++ extraLibs;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
TERMINFO=$out/share/terminfo make install PREFIX=$out
|
TERMINFO=$out/share/terminfo make install PREFIX=$out
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
Loading…
Reference in a new issue