[pacman-dev] [PATCH 1/1] To use in cross-compile environments we need a special strip-binary.
From: Silvio fricke <silvio@port1024.net> In most cross-compile environment there is a environment-variable $CROSS_COMPILE which reflects the toolchain. Signed-off-by: Silvio fricke <silvio@port1024.net> --- scripts/makepkg.sh.in | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2777102..9292b1b 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -736,11 +736,11 @@ tidy_install() { find ${bindirs} -type f 2>/dev/null | while read binary ; do case "$(file -biz "$binary")" in *application/x-sharedlib*) # Libraries (.so) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-archive*) # Libraries (.a) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-executable*) # Binaries - /usr/bin/strip "$binary";; + ${CROSS_COMPILE}strip "$binary";; esac done fi -- 1.5.6.4
2008/7/22 <silvio@port1024.net--thread>:
From: Silvio fricke <silvio@port1024.net>
In most cross-compile environment there is a environment-variable $CROSS_COMPILE which reflects the toolchain.
Signed-off-by: Silvio fricke <silvio@port1024.net> --- scripts/makepkg.sh.in | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2777102..9292b1b 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -736,11 +736,11 @@ tidy_install() { find ${bindirs} -type f 2>/dev/null | while read binary ; do case "$(file -biz "$binary")" in *application/x-sharedlib*) # Libraries (.so) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-archive*) # Libraries (.a) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-executable*) # Binaries - /usr/bin/strip "$binary";; + ${CROSS_COMPILE}strip "$binary";; esac done fi
As far as I understand this - when CROSS_COMPILE is not set (most not-cross-compile environments) - strip will require correct $PATH, which is bad (that's why full paths are always used). -- Roman Kyrylych (Роман Кирилич)
Roman Kyrylych wrote:
2008/7/22 <silvio@port1024.net--thread>:
From: Silvio fricke <silvio@port1024.net>
In most cross-compile environment there is a environment-variable $CROSS_COMPILE which reflects the toolchain.
Signed-off-by: Silvio fricke <silvio@port1024.net> --- scripts/makepkg.sh.in | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2777102..9292b1b 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -736,11 +736,11 @@ tidy_install() { find ${bindirs} -type f 2>/dev/null | while read binary ; do case "$(file -biz "$binary")" in *application/x-sharedlib*) # Libraries (.so) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-archive*) # Libraries (.a) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-executable*) # Binaries - /usr/bin/strip "$binary";; + ${CROSS_COMPILE}strip "$binary";; esac done fi
As far as I understand this - when CROSS_COMPILE is not set (most not-cross-compile environments) - strip will require correct $PATH, which is bad (that's why full paths are always used).
What is the deal with this CROSS_COMPILE env var anyway? I never heard about it before. And it really only needs to be used in that place?
On Tue, Jul 22, 2008 at 07:36:13PM +0200, Xavier <shiningxc@gmail.com> wrote:
And it really only needs to be used in that place?
Given that cc/ld is called only inside build(), that's not a task of makepkg. ;-)
Miklos Vajna wrote:
On Tue, Jul 22, 2008 at 07:36:13PM +0200, Xavier <shiningxc@gmail.com> wrote:
And it really only needs to be used in that place?
Given that cc/ld is called only inside build(), that's not a task of makepkg. ;-)
Yeah indeed, so how is that handled?
On Tue, Jul 22, 2008 at 08:10:11PM +0200, Xavier <shiningxc@gmail.com> wrote:
Yeah indeed, so how is that handled?
Most build systems supporting cross-compile works like: ./configure --target=powerpc-distro-linux --build=i686-distro-linux or so. And then powerpc-distro-linux-gcc (etc.) will be used for compiling code, while i686-distro-linux-gcc will be used for for some rare code like: gcc -o foo foo.c; ./foo > generated.h or similar. Replace -distro-linux with your favourite CHOST. :-)
Hello,
In most cross-compile environment there is a environment-variable $CROSS_COMPILE which reflects the toolchain.
Signed-off-by: Silvio fricke <silvio@port1024.net> --- scripts/makepkg.sh.in | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2777102..9292b1b 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -736,11 +736,11 @@ tidy_install() { find ${bindirs} -type f 2>/dev/null | while read binary ; do case "$(file -biz "$binary")" in *application/x-sharedlib*) # Libraries (.so) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-archive*) # Libraries (.a) - /usr/bin/strip --strip-debug "$binary";; + ${CROSS_COMPILE}strip --strip-debug "$binary";; *application/x-executable*) # Binaries - /usr/bin/strip "$binary";; + ${CROSS_COMPILE}strip "$binary";; esac done fi
As far as I understand this - when CROSS_COMPILE is not set (most not-cross-compile environments) - strip will require correct $PATH, which is bad (that's why full paths are always used).
You are right! The description of CROSS_COMPILE was not very good. This variable holds the host-infos of the runtime-platform. The CROSS_COMPILE is set (as example for a powerpc based crosscompiler) to "powerpc-linux-". A cross-compiler and a for-cross-compiler binutils-package, whose binaries starts with "powerpc-linux-" as prefix, exist in the (crosscompile-)system. /cc/powerpc/usr/bin/powerpc-linux-strip /cc/powerpc/usr/bin/powerpc-linux-ld /cc/powerpc/usr/bin/powerpc-linux-gcc /cc/powerpc/usr/bin/powerpc-linux-g++ .... . . The Makefiles of the Kernelsources are good examples. cd <KERNELSOURCES> grep -R CROSS_COMPILE * But I think, my patch is not good! We need a more configurable way, like a STRIP="/usr/bin/strip" in the makepkg.conf. For now, its all clear? Have a nice Day, eS.eF. -- -- S. Fricke ---------------------------------------- silvio@port1024.net -- Diplom-Informatiker (FH) Linux-Entwicklung JABBER: silvio@conversation.port1024.net ----------------------------------------------------------------------------
participants (5)
-
Miklos Vajna
-
Roman Kyrylych
-
Silvio F.
-
silvio@port1024.net--thread
-
Xavier