diff options
author | Yureka <yuka@yuka.dev> | 2022-10-18 14:53:53 +0200 |
---|---|---|
committer | Yureka <yuka@yuka.dev> | 2022-10-18 15:06:09 +0200 |
commit | 5b000479841ee5722061dd2980d5d3f66a28a208 (patch) | |
tree | c416caf1cbb5511674e5f5648423d060eab3cd45 /pkgs/tools/misc/ttmkfdir | |
parent | f7db217f3253c3c92ddc9b119dfeef8746c95b84 (diff) |
ttmkfdir: fix cross
Diffstat (limited to 'pkgs/tools/misc/ttmkfdir')
-rw-r--r-- | pkgs/tools/misc/ttmkfdir/default.nix | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/pkgs/tools/misc/ttmkfdir/default.nix b/pkgs/tools/misc/ttmkfdir/default.nix index 77bc9f172c6f3..47ff95c14f5f7 100644 --- a/pkgs/tools/misc/ttmkfdir/default.nix +++ b/pkgs/tools/misc/ttmkfdir/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, freetype, fontconfig, libunwind, libtool, flex, bison }: +{ lib, stdenv, fetchurl, freetype, libtool, flex, bison, pkg-config }: stdenv.mkDerivation { pname = "ttf-mkfontdir"; @@ -20,11 +20,21 @@ stdenv.mkDerivation { ./cstring.patch # also fixes some other compilation issues (freetype includes) ]; - preInstall = '' - mkdir -p $out; makeFlags="DESTDIR=$out BINDIR=/bin" + # cross-compilation fixes: + # - fix libtool, the reason it does not work in nativeBuildInputs is complicated + # see https://github.com/NixOS/nixpkgs/pull/192878 for more info + # - freetype-config doesn't properly support cross-compilation, but is just a thin + # wrapper around pkg-config anyways + postPatch = '' + substituteInPlace Makefile \ + --replace "libtool " "${libtool}/bin/libtool --tag=CXX " \ + --replace "freetype-config" "${stdenv.cc.targetPrefix}pkg-config freetype2" ''; - buildInputs = [freetype fontconfig libunwind libtool flex bison]; + makeFlags = [ "DESTDIR=${placeholder "out"}" "BINDIR=/bin" "CXX=${stdenv.cc.targetPrefix}c++" ]; + + nativeBuildInputs = [ flex bison pkg-config ]; + buildInputs = [ freetype ]; meta = { description = "Create fonts.dir for TTF font directory"; |