All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] utils: Avoid need to relocate wrapper scripts
@ 2017-01-31  0:14 Richard Purdie
  2017-01-31  0:14 ` [PATCH 2/5] relocatable: Make native .pc files relocatable Richard Purdie
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Richard Purdie @ 2017-01-31  0:14 UTC (permalink / raw)
  To: openembedded-core

Whilst the path to the executable is dynamically determined, the passed in
environment variables or parameters are not relocatable and rely on the sstate
remapping code. In the recipe specific sysroot case this has become more costly.

This patch translates such paths into relocatable entries which means that
a sed replacement at final installation isn't needed.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/utils.bbclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 549e4b8..16f42b4 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -264,10 +264,14 @@ create_cmdline_wrapper () {
 
 	mv $cmd $cmd.real
 	cmdname=`basename $cmd`
+	dirname=`dirname $cmd`
+	relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
+	cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
 	cat <<END >$cmd
 #!/bin/bash
 realpath=\`readlink -fn \$0\`
-exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $@ "\$@"
+realdir=\`dirname \$realpath\`
+exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $cmdoptions "\$@"
 END
 	chmod +x $cmd
 }
@@ -287,10 +291,14 @@ create_wrapper () {
 
 	mv $cmd $cmd.real
 	cmdname=`basename $cmd`
+	dirname=`dirname $cmd`
+	relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
+	exportstring=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
 	cat <<END >$cmd
 #!/bin/bash
 realpath=\`readlink -fn \$0\`
-export $@
+realdir=\`dirname \$realpath\`
+export $exportstring
 exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real "\$@"
 END
 	chmod +x $cmd
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] relocatable: Make native .pc files relocatable
  2017-01-31  0:14 [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Richard Purdie
@ 2017-01-31  0:14 ` Richard Purdie
  2017-01-31  0:14 ` [PATCH 3/5] distro/defaultsetup: Enable removal of libtool .la files by default Richard Purdie
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2017-01-31  0:14 UTC (permalink / raw)
  To: openembedded-core

The native .pc files currently have hardcoded paths in them meaning each has
to be relocated at final install time. pkg-config has built in functionality
to avoid this, namely the pcfiledir variable.

This function translates .pc files to use the variable meaning further
relocation later is unnecessary.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/relocatable.bbclass | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/meta/classes/relocatable.bbclass b/meta/classes/relocatable.bbclass
index 4ca9981..582812c 100644
--- a/meta/classes/relocatable.bbclass
+++ b/meta/classes/relocatable.bbclass
@@ -1,7 +1,18 @@
 inherit chrpath
 
-SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
+SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"
 
 python relocatable_binaries_preprocess() {
     rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d)
 }
+
+relocatable_native_pcfiles () {
+	if [ -d ${SYSROOT_DESTDIR}${libdir}/pkgconfig ]; then
+		rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('libdir') + "/pkgconfig")}
+		sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${libdir}/pkgconfig/*.pc
+	fi
+	if [ -d ${SYSROOT_DESTDIR}${datadir}/pkgconfig ]; then
+		rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('datadir') + "/pkgconfig")}
+		sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${datadir}/pkgconfig/*.pc
+	fi
+}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] distro/defaultsetup: Enable removal of libtool .la files by default
  2017-01-31  0:14 [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Richard Purdie
  2017-01-31  0:14 ` [PATCH 2/5] relocatable: Make native .pc files relocatable Richard Purdie
@ 2017-01-31  0:14 ` Richard Purdie
  2017-01-31  0:14 ` [PATCH 4/5] binutils-cross: Remove exec_prefix from the linker search path Richard Purdie
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2017-01-31  0:14 UTC (permalink / raw)
  To: openembedded-core

Relocation of native .la files during recipe specific sysroot relocation
is probably the final straw in just killing these files off.

Change things so this class is inherited by default. If distros don't want to
do this, they can opt out but it seems like the best thing to do now since
.la files aren't needed on Linux.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/conf/distro/defaultsetup.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/distro/defaultsetup.conf b/meta/conf/distro/defaultsetup.conf
index 1055b9b..ca2f917 100644
--- a/meta/conf/distro/defaultsetup.conf
+++ b/meta/conf/distro/defaultsetup.conf
@@ -20,5 +20,5 @@ CACHE = "${TMPDIR}/cache/${TCMODE}-${TCLIBC}${@['', '/' + str(d.getVar('MACHINE'
 USER_CLASSES ?= ""
 PACKAGE_CLASSES ?= "package_ipk"
 INHERIT_BLACKLIST = "blacklist"
-INHERIT_DISTRO ?= "debian devshell sstate license"
+INHERIT_DISTRO ?= "debian devshell sstate license remove-libtool"
 INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO} ${INHERIT_BLACKLIST}"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] binutils-cross: Remove exec_prefix from the linker search path
  2017-01-31  0:14 [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Richard Purdie
  2017-01-31  0:14 ` [PATCH 2/5] relocatable: Make native .pc files relocatable Richard Purdie
  2017-01-31  0:14 ` [PATCH 3/5] distro/defaultsetup: Enable removal of libtool .la files by default Richard Purdie
@ 2017-01-31  0:14 ` Richard Purdie
  2017-01-31  0:14 ` [PATCH 5/5] xmlto: Don't hardcode the path to tail Richard Purdie
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2017-01-31  0:14 UTC (permalink / raw)
  To: openembedded-core

We don't put target libs into a native/cross ${exec_prefix} but having
this in the default search path means all linker scripts have to be relocated.
This is a considerable chunk of files to create multiple copies of for no good
reason.

Instead, patch out the paths we don't need.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/recipes-devtools/binutils/binutils-cross.inc  |  5 +++
 .../binutils/binutils/no-tooldirpaths.patch        | 47 ++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/no-tooldirpaths.patch

diff --git a/meta/recipes-devtools/binutils/binutils-cross.inc b/meta/recipes-devtools/binutils/binutils-cross.inc
index fd3d801..7ebd7e3 100644
--- a/meta/recipes-devtools/binutils/binutils-cross.inc
+++ b/meta/recipes-devtools/binutils/binutils-cross.inc
@@ -7,9 +7,14 @@ BPN = "binutils"
 INHIBIT_DEFAULT_DEPS = "1"
 INHIBIT_AUTOTOOLS_DEPS = "1"
 
+SRC_URI += "file://no-tooldirpaths.patch"
+
+# Specify lib-path else we use a load of search dirs which we don't use
+# and mean the linker scripts have to be relocated.
 EXTRA_OECONF += "--with-sysroot=${STAGING_DIR_TARGET} \
                 --disable-install-libbfd \
                 --enable-poison-system-directories \
+                --with-lib-path==${target_base_libdir}:=${target_libdir} \
                 "
 do_install () {
 	oe_runmake 'DESTDIR=${D}' install
diff --git a/meta/recipes-devtools/binutils/binutils/no-tooldirpaths.patch b/meta/recipes-devtools/binutils/binutils/no-tooldirpaths.patch
new file mode 100644
index 0000000..2bfc8d4
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/no-tooldirpaths.patch
@@ -0,0 +1,47 @@
+We don't place target libraries within ${exec_prefix}, we'd always place these
+within the target sysroot within the standard library directories. Worse, the
+append_to_lib_path code prefixes these paths with the sysroot which makes even
+less sense.
+
+These directories therefore don't make sense in our case and mean we have to 
+relocate all the linker scripts if they're present. Dropping them 
+gives a reasonable performance improvement/simplification.
+
+Upstream-Status: Inappropriate
+
+RP 2017/01/30
+
+Index: git/ld/genscripts.sh
+===================================================================
+--- git.orig/ld/genscripts.sh
++++ git/ld/genscripts.sh
+@@ -189,29 +189,6 @@ append_to_lib_path()
+   fi
+ }
+ 
+-# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib when native
+-# except when LIBPATH=":".
+-if [ "${LIB_PATH}" != ":" ] ; then
+-  libs=
+-  if [ "x${TOOL_LIB}" = "x" ] ; then
+-    if [ "x${NATIVE}" = "xyes" ] ; then
+-      libs="${exec_prefix}/${target_alias}/lib"
+-    fi
+-  else
+-    # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX}
+-    # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} are in the default search path,
+-    # because 64bit libraries may be in both places, depending on
+-    # cross-development setup method (e.g.: /usr/s390x-linux/lib64
+-    # vs. /usr/s390-linux/lib64)
+-    case "${NATIVE}:${LIBPATH_SUFFIX}:${TOOL_LIB}" in
+-      :* | *::* | *:*:*${LIBPATH_SUFFIX}) ;;
+-      *) libs="${exec_prefix}/${target_alias}/lib${LIBPATH_SUFFIX}" ;;
+-    esac
+-    libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}"
+-  fi
+-  append_to_lib_path ${libs}
+-fi
+-
+ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
+   libs=${NATIVE_LIB_DIRS}
+   if [ "x${NATIVE}" = "xyes" ] ; then
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] xmlto: Don't hardcode the path to tail
  2017-01-31  0:14 [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Richard Purdie
                   ` (2 preceding siblings ...)
  2017-01-31  0:14 ` [PATCH 4/5] binutils-cross: Remove exec_prefix from the linker search path Richard Purdie
@ 2017-01-31  0:14 ` Richard Purdie
  2017-01-31  0:23 ` ✗ patchtest: failure for "utils: Avoid need to relocate ..." and 4 more Patchwork
  2017-01-31  2:37 ` [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Christopher Larson
  5 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2017-01-31  0:14 UTC (permalink / raw)
  To: openembedded-core

We don't need to hardcode a path to tail, follow the other tools examples and
don't specify a path since PATH is good enough for us.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/recipes-devtools/xmlto/xmlto_0.0.28.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb
index aaaeb6e..ce5d1e0 100644
--- a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb
+++ b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb
@@ -26,7 +26,7 @@ RDEPENDS_${PN}_append_class-target = " \
                   libxslt-bin \
                   coreutils \
 "
-CACHED_CONFIGUREVARS += "ac_cv_path_TAIL=${bindir}/tail"
+CACHED_CONFIGUREVARS += "ac_cv_path_TAIL=tail"
 
 BBCLASSEXTEND = "native"
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* ✗ patchtest: failure for "utils: Avoid need to relocate ..." and 4 more
  2017-01-31  0:14 [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Richard Purdie
                   ` (3 preceding siblings ...)
  2017-01-31  0:14 ` [PATCH 5/5] xmlto: Don't hardcode the path to tail Richard Purdie
@ 2017-01-31  0:23 ` Patchwork
  2017-01-31  2:37 ` [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Christopher Larson
  5 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2017-01-31  0:23 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

== Series Details ==

Series: "utils: Avoid need to relocate ..." and 4 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/5072/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             A patch file has been added, but does not have a Signed-off-by tag [test_signed_off_by_presence] 
  Suggested fix    Sign off the added patch file (meta/recipes-devtools/binutils/binutils/no-tooldirpaths.patch)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/5] utils: Avoid need to relocate wrapper scripts
  2017-01-31  0:14 [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Richard Purdie
                   ` (4 preceding siblings ...)
  2017-01-31  0:23 ` ✗ patchtest: failure for "utils: Avoid need to relocate ..." and 4 more Patchwork
@ 2017-01-31  2:37 ` Christopher Larson
  5 siblings, 0 replies; 7+ messages in thread
From: Christopher Larson @ 2017-01-31  2:37 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

On Mon, Jan 30, 2017 at 5:14 PM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> Whilst the path to the executable is dynamically determined, the passed in
> environment variables or parameters are not relocatable and rely on the
> sstate
> remapping code. In the recipe specific sysroot case this has become more
> costly.
>
> This patch translates such paths into relocatable entries which means that
> a sed replacement at final installation isn't needed.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>

Nice.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 1256 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-31  2:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31  0:14 [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Richard Purdie
2017-01-31  0:14 ` [PATCH 2/5] relocatable: Make native .pc files relocatable Richard Purdie
2017-01-31  0:14 ` [PATCH 3/5] distro/defaultsetup: Enable removal of libtool .la files by default Richard Purdie
2017-01-31  0:14 ` [PATCH 4/5] binutils-cross: Remove exec_prefix from the linker search path Richard Purdie
2017-01-31  0:14 ` [PATCH 5/5] xmlto: Don't hardcode the path to tail Richard Purdie
2017-01-31  0:23 ` ✗ patchtest: failure for "utils: Avoid need to relocate ..." and 4 more Patchwork
2017-01-31  2:37 ` [PATCH 1/5] utils: Avoid need to relocate wrapper scripts Christopher Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.