Skip to contentSkip to conversation

ruby: Add sysroot dir to the ldflags and process all the existing extconf.rb

PATCH In review Pablo Saavedra Rodi?o 2 participants 2 messages Apr 29, 2020 – May 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ruby: Add sysroot dir to the ldflags and process all the existing extconf.rb

* add lib path of the sysroot directory [1] to avoid ld errors during the installation
* ruby_do_compile() find the extconf.rb file in the sources instance of assume a single file.

[1] https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-STAGING_LIBDIR

---
 classes/ruby.bbclass | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
classes/ruby.bbclass +21 -13
index 15ac9f4..5fb8e6b 100644
@@ -104,23 +104,31 @@ EOF
   system("perl -p -i -e 's#^arch =.*#arch = ${ruby_arch}#' Makefile")
   system("perl -p -i -e 's#^LIBPATH =.*#LIBPATH = -L.#' Makefile")
   system("perl -p -i -e 's#^dldflags =.*#dldflags = ${LDFLAGS}#' Makefile")
+  system("perl -p -i -e 's#^ldflags  =.*#ldflags = -L${STAGING_LIBDIR}#' Makefile")
 EOF
 }
 
 ruby_do_compile() {
-	if [ -f extconf.rb -a ! -f extconf.rb.orig ] ; then
-		grep create_makefile extconf.rb > append2 || (exit 0)
-		ruby_gen_extconf_fix
-		cp extconf.rb extconf.rb.orig
-		# Patch extconf.rb for cross compile
-		cat append >> extconf.rb
-	fi
-	for gem in ${RUBY_BUILD_GEMS}; do
-		${RUBY_COMPILE_FLAGS} gem build $gem
-	done
-	if [ -f extconf.rb.orig ] ; then
-		mv extconf.rb.orig extconf.rb
-	fi
+    EXTCONF_FILES=$(find . -name extconf.rb -exec ls {} \;)
+    for e in $EXTCONF_FILES
+    do
+        if [ -f $e -a ! -f $e.orig ] ; then
+            grep create_makefile $e > append2 || continue
+            ruby_gen_extconf_fix
+            cp $e $e.orig
+            # Patch extconf.rb for cross compile
+            cat append >> $e
+        fi
+    done
+    for gem in ${RUBY_BUILD_GEMS}; do
+            ${RUBY_COMPILE_FLAGS} gem build $gem
+    done
+    for e in $EXTCONF_FILES
+    do
+        if [ -f $e.orig ] ; then
+            mv $e.orig $e
+        fi
+    done
 }
 
 
Signature · 1 line
2.11.0
#1 lore raw

merged!

Bruce

In message: [meta-virtualization][m-c-s][PATCH] ruby: Add sysroot dir to the ldflags and process all the existing extconf.rb

Quoted 66 lines · on 29/04/2020 Pablo Saavedra Rodi?o wrote:

* add lib path of the sysroot directory [1] to avoid ld errors during the installation
* ruby_do_compile() find the extconf.rb file in the sources instance of assume a single file.

[1] https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-STAGING_LIBDIR

---
 classes/ruby.bbclass | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
classes/ruby.bbclass +21 -13
index 15ac9f4..5fb8e6b 100644
@@ -104,23 +104,31 @@ EOF
   system("perl -p -i -e 's#^arch =.*#arch = ${ruby_arch}#' Makefile")
   system("perl -p -i -e 's#^LIBPATH =.*#LIBPATH = -L.#' Makefile")
   system("perl -p -i -e 's#^dldflags =.*#dldflags = ${LDFLAGS}#' Makefile")
+  system("perl -p -i -e 's#^ldflags  =.*#ldflags = -L${STAGING_LIBDIR}#' Makefile")
 EOF
 }
 
 ruby_do_compile() {
-	if [ -f extconf.rb -a ! -f extconf.rb.orig ] ; then
-		grep create_makefile extconf.rb > append2 || (exit 0)
-		ruby_gen_extconf_fix
-		cp extconf.rb extconf.rb.orig
-		# Patch extconf.rb for cross compile
-		cat append >> extconf.rb
-	fi
-	for gem in ${RUBY_BUILD_GEMS}; do
-		${RUBY_COMPILE_FLAGS} gem build $gem
-	done
-	if [ -f extconf.rb.orig ] ; then
-		mv extconf.rb.orig extconf.rb
-	fi
+    EXTCONF_FILES=$(find . -name extconf.rb -exec ls {} \;)
+    for e in $EXTCONF_FILES
+    do
+        if [ -f $e -a ! -f $e.orig ] ; then
+            grep create_makefile $e > append2 || continue
+            ruby_gen_extconf_fix
+            cp $e $e.orig
+            # Patch extconf.rb for cross compile
+            cat append >> $e
+        fi
+    done
+    for gem in ${RUBY_BUILD_GEMS}; do
+            ${RUBY_COMPILE_FLAGS} gem build $gem
+    done
+    for e in $EXTCONF_FILES
+    do
+        if [ -f $e.orig ] ; then
+            mv $e.orig $e
+        fi
+    done
 }
 
 
Signature · 1 line
2.11.0