* [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations
@ 2011-09-11 15:55 Stefan Weil
2011-09-11 17:31 ` Peter Maydell
2011-09-11 18:25 ` [Qemu-devel] [PATCH] " Paolo Bonzini
0 siblings, 2 replies; 7+ messages in thread
From: Stefan Weil @ 2011-09-11 15:55 UTC (permalink / raw)
To: qemu-devel
This script can be used for cross compilations.
I use it on Debian / Ubuntu to provide a cross pkg-config
for MinGW (32 and 64 bit), ARM, MIPS and PowerPC.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
scripts/cross-pkg-config | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
create mode 100755 scripts/cross-pkg-config
diff --git a/scripts/cross-pkg-config b/scripts/cross-pkg-config
new file mode 100755
index 0000000..a5f839b
--- /dev/null
+++ b/scripts/cross-pkg-config
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# This script provides a cross pkg-config for QEMU cross compilations.
+# It will use the standard pkg-config with special options for the
+# cross environment which is assumed to be in /usr/{cross-prefix}.
+
+# Installation (Debian and similar distributions):
+# Simply copy or link it to /usr/bin/{cross-prefix}-pkg-config.
+
+# Examples (Debian, Ubuntu):
+# /usr/bin/amd64-mingw32msvc-pkg-config
+# /usr/bin/i586-mingw32msvc-pkg-config
+# /usr/bin/arm-linux-gnueabi-pkg-config
+# /usr/bin/mipsel-linux-gnu-pkg-config
+
+basename=`basename $0`
+prefix=/usr/`echo $basename|sed s/-pkg-config//`
+PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig
+export PKG_CONFIG_LIBDIR
+exec pkg-config --define-variable=prefix=$prefix $@
+
+# end
--
1.7.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations
2011-09-11 15:55 [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations Stefan Weil
@ 2011-09-11 17:31 ` Peter Maydell
2011-09-11 18:25 ` [Qemu-devel] [PATCH v2] " Stefan Weil
2011-09-11 18:25 ` [Qemu-devel] [PATCH] " Paolo Bonzini
1 sibling, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2011-09-11 17:31 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel
On 11 September 2011 16:55, Stefan Weil <weil@mail.berlios.de> wrote:
> --- /dev/null
> +++ b/scripts/cross-pkg-config
> @@ -0,0 +1,22 @@
> +#!/bin/sh
Missing "-e"
> +
> +# This script provides a cross pkg-config for QEMU cross compilations.
> +# It will use the standard pkg-config with special options for the
> +# cross environment which is assumed to be in /usr/{cross-prefix}.
Missing copyright and license.
> +basename=`basename $0`
Insufficient quoting (gives wrong answer if the script is in a
path with a space in and is executed via $PATH or an absolute path).
> +prefix=/usr/`echo $basename|sed s/-pkg-config//`
You can do this with shell substring manipulation.
> +PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig
Missing quoting.
> +export PKG_CONFIG_LIBDIR
Posix allows export name=value so you can combine this with the above.
> +exec pkg-config --define-variable=prefix=$prefix $@
Missing quoting.
Try:
basename="$(basename "$0")"
prefix="/usr/${basename%-pkg-config}"
export PKG_CONFIG_LIBDIR="$prefix/lib/pkgconfig"
exec pkg-config --define-variable=prefix="$prefix" "$@"
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH v2] pkg-config: Add a pkg-config script for cross compilations
2011-09-11 17:31 ` Peter Maydell
@ 2011-09-11 18:25 ` Stefan Weil
2011-09-16 13:09 ` Anthony Liguori
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2011-09-11 18:25 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
This script can be used for cross compilations.
I use it on Debian / Ubuntu to provide a cross pkg-config
for MinGW (32 and 64 bit), ARM, MIPS and PowerPC.
v2: Improvements as suggested by Peter Maydell.
Thanks for the review.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
scripts/cross-pkg-config | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
create mode 100755 scripts/cross-pkg-config
diff --git a/scripts/cross-pkg-config b/scripts/cross-pkg-config
new file mode 100755
index 0000000..8d7fe17
--- /dev/null
+++ b/scripts/cross-pkg-config
@@ -0,0 +1,28 @@
+#!/bin/sh -e
+
+# pkg-config for cross compilations
+
+# Copyright (C) 2011 Stefan Weil
+
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the file COPYING in the top-level directory.
+
+# This script provides a cross pkg-config for QEMU cross compilations.
+# It will use the standard pkg-config with special options for the
+# cross environment which is assumed to be in /usr/{cross-prefix}.
+
+# Installation (Debian and similar distributions):
+# Simply copy or link it to /usr/bin/{cross-prefix}-pkg-config.
+
+# Examples (Debian, Ubuntu):
+# /usr/bin/amd64-mingw32msvc-pkg-config
+# /usr/bin/i586-mingw32msvc-pkg-config
+# /usr/bin/arm-linux-gnueabi-pkg-config
+# /usr/bin/mipsel-linux-gnu-pkg-config
+
+basename=`basename "$0"`
+prefix="/usr/${basename%-pkg-config}"
+export PKG_CONFIG_LIBDIR="$prefix/lib/pkgconfig"
+exec pkg-config --define-variable=prefix="$prefix" "$@"
+
+# end
--
1.7.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pkg-config: Add a pkg-config script for cross compilations
2011-09-11 18:25 ` [Qemu-devel] [PATCH v2] " Stefan Weil
@ 2011-09-16 13:09 ` Anthony Liguori
0 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2011-09-16 13:09 UTC (permalink / raw)
To: Stefan Weil; +Cc: peter.maydell, qemu-devel
On 09/11/2011 01:25 PM, Stefan Weil wrote:
> This script can be used for cross compilations.
> I use it on Debian / Ubuntu to provide a cross pkg-config
> for MinGW (32 and 64 bit), ARM, MIPS and PowerPC.
>
> v2: Improvements as suggested by Peter Maydell.
> Thanks for the review.
>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
Please post patches as top-level posts and not as replies.
Regards,
Anthony Liguori
> ---
> scripts/cross-pkg-config | 28 ++++++++++++++++++++++++++++
> 1 files changed, 28 insertions(+), 0 deletions(-)
> create mode 100755 scripts/cross-pkg-config
>
> diff --git a/scripts/cross-pkg-config b/scripts/cross-pkg-config
> new file mode 100755
> index 0000000..8d7fe17
> --- /dev/null
> +++ b/scripts/cross-pkg-config
> @@ -0,0 +1,28 @@
> +#!/bin/sh -e
> +
> +# pkg-config for cross compilations
> +
> +# Copyright (C) 2011 Stefan Weil
> +
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the file COPYING in the top-level directory.
> +
> +# This script provides a cross pkg-config for QEMU cross compilations.
> +# It will use the standard pkg-config with special options for the
> +# cross environment which is assumed to be in /usr/{cross-prefix}.
> +
> +# Installation (Debian and similar distributions):
> +# Simply copy or link it to /usr/bin/{cross-prefix}-pkg-config.
> +
> +# Examples (Debian, Ubuntu):
> +# /usr/bin/amd64-mingw32msvc-pkg-config
> +# /usr/bin/i586-mingw32msvc-pkg-config
> +# /usr/bin/arm-linux-gnueabi-pkg-config
> +# /usr/bin/mipsel-linux-gnu-pkg-config
> +
> +basename=`basename "$0"`
> +prefix="/usr/${basename%-pkg-config}"
> +export PKG_CONFIG_LIBDIR="$prefix/lib/pkgconfig"
> +exec pkg-config --define-variable=prefix="$prefix" "$@"
> +
> +# end
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations
2011-09-11 15:55 [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations Stefan Weil
2011-09-11 17:31 ` Peter Maydell
@ 2011-09-11 18:25 ` Paolo Bonzini
2011-09-11 18:47 ` Stefan Weil
1 sibling, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2011-09-11 18:25 UTC (permalink / raw)
To: qemu-devel
On 09/11/2011 05:55 PM, Stefan Weil wrote:
> This script can be used for cross compilations.
> I use it on Debian / Ubuntu to provide a cross pkg-config
> for MinGW (32 and 64 bit), ARM, MIPS and PowerPC.
I think the lack of such script is a bug in your distro. Fedora
provides /usr/bin/i686-pc-mingw32-pkg-config. You should report a bug
with Debian.
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations
2011-09-11 18:25 ` [Qemu-devel] [PATCH] " Paolo Bonzini
@ 2011-09-11 18:47 ` Stefan Weil
2011-09-12 6:25 ` Paolo Bonzini
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2011-09-11 18:47 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
Am 11.09.2011 20:25, schrieb Paolo Bonzini:
> On 09/11/2011 05:55 PM, Stefan Weil wrote:
>> This script can be used for cross compilations.
>> I use it on Debian / Ubuntu to provide a cross pkg-config
>> for MinGW (32 and 64 bit), ARM, MIPS and PowerPC.
>
> I think the lack of such script is a bug in your distro. Fedora
> provides /usr/bin/i686-pc-mingw32-pkg-config. You should report a bug
> with Debian.
>
> Paolo
Well, Redhat has a large interest in QEMU, so I assume that Fedora
is better prepared for cross compilations than most other distributions.
Does it also provide cross glib-2.0, sdl, zlib, ...?
How does it implement cross pkg-config? As a binary compiled from source,
or as a script using native pkg-config?
Debian has only very limited cross development support.
Most cross packages I use come from Emdebian. I doubt that
they have the manpower to do more than they already do.
As far as I know, they don't provide any cross package which
needs a cross pkg-config, so the missing cross pkg-config is
not really a bug...
How about other distributions? Are there others beside Fedora
with good cross dev support? Some large embedded projects still build
their own cross toolchain instead of using precompiled binaries.
For all those which don't have a cross pkg-config, the script
saves the time and memory needed for building it.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations
2011-09-11 18:47 ` Stefan Weil
@ 2011-09-12 6:25 ` Paolo Bonzini
0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2011-09-12 6:25 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel
On 09/11/2011 08:47 PM, Stefan Weil wrote:
> Well, Redhat has a large interest in QEMU, so I assume that Fedora
> is better prepared for cross compilations than most other distributions.
Why are the two related? :) Fedora's cross compilation machinery is
indeed used by Red Hat for some virt-related stuff, but not for QEMU
even though I used it successfully for it. In fact, Fedora-mingw32
started as a special interest group entirely outside Red Hat.
> Does it also provide cross glib-2.0, sdl, zlib, ...?
Yes.
> How does it implement cross pkg-config? As a binary compiled from source,
> or as a script using native pkg-config?
It's a script doing basically
PKG_CONFIG_LIBDIR="/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-pc-mingw32/sys-root/mingw/share/pkgconfig"
pkg-config "$@"
> How about other distributions? Are there others beside Fedora
> with good cross dev support? Some large embedded projects still build
> their own cross toolchain instead of using precompiled binaries.
> For all those which don't have a cross pkg-config, the script
> saves the time and memory needed for building it.
Yes, I agree. However, I still think it's better to prepare
documentation about how to cross compile (including fetching
dependencies etc.), and embed the script in the document.
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-09-16 13:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-11 15:55 [Qemu-devel] [PATCH] pkg-config: Add a pkg-config script for cross compilations Stefan Weil
2011-09-11 17:31 ` Peter Maydell
2011-09-11 18:25 ` [Qemu-devel] [PATCH v2] " Stefan Weil
2011-09-16 13:09 ` Anthony Liguori
2011-09-11 18:25 ` [Qemu-devel] [PATCH] " Paolo Bonzini
2011-09-11 18:47 ` Stefan Weil
2011-09-12 6:25 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).