From be3d12d4e528a082693b90bd7e8e57e52b4de13e Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Oct 2021 01:55:35 +0300 Subject: [PATCH 1/4] 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 f4d276e0a61dd..fbf1009ea700d 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 = { From c5ef7d7091930cf0818401d6752ea10aa732c759 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Oct 2021 22:53:01 +0300 Subject: [PATCH 2/4] m17n-db: fix cross-compilation enable strictDeps had to add gawk and bash as there are some scripts with the sh shebang and gawk shebang --- pkgs/tools/inputmethods/m17n-db/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/inputmethods/m17n-db/default.nix b/pkgs/tools/inputmethods/m17n-db/default.nix index 9344951dffe75..d24d1b44d8620 100644 --- a/pkgs/tools/inputmethods/m17n-db/default.nix +++ b/pkgs/tools/inputmethods/m17n-db/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, gettext }: +{ lib, stdenv, fetchurl, gettext, gawk, bash }: stdenv.mkDerivation rec { pname = "m17n-db"; @@ -9,7 +9,10 @@ stdenv.mkDerivation rec { sha256 = "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"; }; - buildInputs = [ gettext ]; + nativeBuildInputs = [ gettext ]; + buildInputs = [ gettext gawk bash ]; + + strictDeps = true; configureFlags = lib.optional (stdenv ? glibc) "--with-charmaps=${stdenv.glibc.out}/share/i18n/charmaps" From a354a240de8250ed3c46c7c6a87874c73e60e0ae Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 22 Oct 2021 01:47:09 +0300 Subject: [PATCH 3/4] m17n-lib: fix cross-compilation without reconf the build fails with ./configure: line 21532: syntax error near unexpected token `ANTHY,' ./configure: line 21532: `PKG_CHECK_MODULES(ANTHY, anthy, HAVE_ANTHY=yes, HAVE_ANTHY=no)' --- pkgs/tools/inputmethods/m17n-lib/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/inputmethods/m17n-lib/default.nix b/pkgs/tools/inputmethods/m17n-lib/default.nix index c80f973631162..946d18a80ccc7 100644 --- a/pkgs/tools/inputmethods/m17n-lib/default.nix +++ b/pkgs/tools/inputmethods/m17n-lib/default.nix @@ -1,4 +1,4 @@ -{lib, stdenv, fetchurl, m17n_db}: +{ lib, stdenv, fetchurl, m17n_db, autoreconfHook, pkg-config }: stdenv.mkDerivation rec { pname = "m17n-lib"; version = "1.8.0"; @@ -8,6 +8,11 @@ stdenv.mkDerivation rec { sha256 = "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"; }; + strictDeps = true; + + # reconf needed to sucesfully cross-compile + nativeBuildInputs = [ autoreconfHook pkg-config ]; + buildInputs = [ m17n_db ]; meta = { From e937fd52690d7b0f534ebd7867f24e9c1c453234 Mon Sep 17 00:00:00 2001 From: Sandro Date: Tue, 26 Oct 2021 17:20:43 +0200 Subject: [PATCH 4/4] libotf: format --- pkgs/tools/inputmethods/m17n-lib/otf.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkgs/tools/inputmethods/m17n-lib/otf.nix b/pkgs/tools/inputmethods/m17n-lib/otf.nix index fbf1009ea700d..b0d30a58d48eb 100644 --- a/pkgs/tools/inputmethods/m17n-lib/otf.nix +++ b/pkgs/tools/inputmethods/m17n-lib/otf.nix @@ -35,13 +35,12 @@ stdenv.mkDerivation rec { 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" - ''; + 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 = { homepage = "https://www.nongnu.org/m17n/";