From e35b7c5386c1bfacf47ed31bac9b503373dd26fc Mon Sep 17 00:00:00 2001 From: Zheng Junjie Date: Fri, 10 Nov 2023 01:37:10 +0800 Subject: gnu: ruby: Fix cross-compilation. * gnu/packages/ruby.scm (ruby-2.6,ruby-2.7): Fix cross-compilation. [native-inputs]: When cross compiling, add this-package. [arguments]<#:configure-flags>: When cross compiling, add LDFLAGS. Change-Id: Iba6665ba3b1b3d5b3a9b6830a01f0f3284e35efb Signed-off-by: Christopher Baines --- gnu/packages/ruby.scm | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'gnu') diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm index ff6829082c..1490c783fa 100644 --- a/gnu/packages/ruby.scm +++ b/gnu/packages/ruby.scm @@ -34,6 +34,7 @@ ;;; Copyright © 2023 Yovan Naumovski ;;; Copyright © 2023 gemmaro ;;; Copyright © 2023 Janneke Nieuwenhuizen +;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -129,7 +130,13 @@ (define-public ruby-2.6 (build-system gnu-build-system) (arguments `(#:test-target "test" - #:configure-flags '("--enable-shared") ; dynamic linking + #:configure-flags + ,(if (%current-target-system) + '(list (string-append + "LDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") "/lib") + "--enable-shared") + ''("--enable-shared")) ; dynamic linking #:phases (modify-phases %standard-phases (add-before 'configure 'replace-bin-sh-and-remove-libffi @@ -147,6 +154,9 @@ (define-public ruby-2.6 "tool/rbinstall.rb") (("/bin/sh") (which "sh"))) #t))))) + (native-inputs (if (%current-target-system) + (list this-package) + '())) (inputs (list readline openssl-1.1 libffi gdbm)) (propagated-inputs @@ -177,7 +187,13 @@ (define-public ruby-2.7 "042xrdk7hsv4072bayz3f8ffqh61i8zlhvck10nfshllq063n877")))) (arguments `(#:test-target "test" - #:configure-flags '("--enable-shared") ; dynamic linking + #:configure-flags + ,(if (%current-target-system) + '(list (string-append + "LDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") "/lib") + "--enable-shared") + ''("--enable-shared")) ; dynamic linking #:phases (modify-phases %standard-phases (add-before 'configure 'replace-bin-sh-and-remove-libffi @@ -204,7 +220,10 @@ (define-public ruby-2.7 (delete-file "test/ruby/test_io.rb")))) '())))) (native-inputs - (list autoconf)))) + (append (if (%current-target-system) + (list this-package) + '()) + (list autoconf))))) (define ruby-2.7-fixed (package -- cgit v1.2.3