From be3d12d4e528a082693b90bd7e8e57e52b4de13e Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Oct 2021 01:55:35 +0300 Subject: [PATCH] libotf: fix cross-compilation by applying a patch from debian patch makes it so that pkg-config is used to find the avaibility of the freetype library instead of the freetype-config binary --- pkgs/tools/inputmethods/m17n-lib/otf.nix | 33 +++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/inputmethods/m17n-lib/otf.nix b/pkgs/tools/inputmethods/m17n-lib/otf.nix index f4d276e0a61d..fbf1009ea700 100644 --- a/pkgs/tools/inputmethods/m17n-lib/otf.nix +++ b/pkgs/tools/inputmethods/m17n-lib/otf.nix @@ -1,21 +1,46 @@ -{ lib, stdenv, fetchurl, libXaw, freetype }: +{ lib, stdenv, fetchurl, fetchpatch, pkg-config, autoreconfHook, libXaw, freetype }: stdenv.mkDerivation rec { - name = "libotf-0.9.16"; + pname = "libotf"; + version = "0.9.16"; src = fetchurl { - url = "https://download.savannah.gnu.org/releases/m17n/${name}.tar.gz"; + url = "https://download.savannah.gnu.org/releases/m17n/${pname}-${version}.tar.gz"; sha256 = "0sq6g3xaxw388akws6qrllp3kp2sxgk2dv4j79k6mm52rnihrnv8"; }; - outputs = [ "out" "dev" ]; + patches = [ + # https://salsa.debian.org/debian/libotf/-/tree/master/debian/patches + # Fix cross-compilation + (fetchpatch { + url = "https://salsa.debian.org/debian/libotf/-/raw/1be04cedf887720eb8f5efb3594dc2cefd96b1f1/debian/patches/0002-use-pkg-config-not-freetype-config.patch"; + sha256 = "sha256-VV9iGoNWIEie6UiLLTJBD+zxpvj0acgqkcBeAN1V6Kc="; + }) + # these 2 are required by the above patch + (fetchpatch { + url = "https://salsa.debian.org/debian/libotf/-/raw/1be04cedf887720eb8f5efb3594dc2cefd96b1f1/debian/patches/0001-do-not-add-flags-for-required-packages-to-pc-file.patch"; + sha256 = "sha256-3kzqNPAHNVJQ1F4fyifq3AqLdChWli/k7wOq+ha+iDs="; + }) + (fetchpatch { + url = "https://salsa.debian.org/debian/libotf/-/raw/1be04cedf887720eb8f5efb3594dc2cefd96b1f1/debian/patches/0001-libotf-config-modify-to-support-multi-arch.patch"; + sha256 = "sha256-SUlI87h+MtYWWtrAegzAnSds8JhxZwTJltDcj/se/Qc="; + }) + ]; + + strictDeps = true; + + nativeBuildInputs = [ pkg-config autoreconfHook ]; buildInputs = [ libXaw freetype ]; + outputs = [ "out" "dev" ]; + postInstall = '' mkdir -p $dev/bin mv $out/bin/libotf-config $dev/bin/ + substituteInPlace $dev/bin/libotf-config \ + --replace "pkg-config" "${pkg-config}/bin/pkg-config" ''; meta = {