FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 07-01-2008, 05:47 PM
Thomas Bächler
 
Default Introduce destarch keyword into makepkg

If destarch is added to a PKGBUILD, makepkg sets the architecture of the
resulting package to $destarch instead of $CARCH. This is useful if you
want to cross-create packages for one architecture on the other.

Using

arch=('i686')
destarch='x86_64'

makes it possible to build multilib packages and to build grub without
the export CARCH="x86_64" hack.
---
scripts/makepkg.sh.in | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index bce2e6c..c45d7e8 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -152,7 +152,7 @@ clean_up() {
rm -rf pkg src
if [ "$pkgname" != "" ]; then
# Can't do this unless the BUILDSCRIPT has been sourced.
- rm -f "${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log*"
+ rm -f "${pkgname}-${pkgver}-${pkgrel}-${destarch}.log*"
fi
fi

@@ -662,7 +662,7 @@ run_build() {

local ret=0
if [ "$LOGGING" = "1" ]; then
- BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
+ BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${destarch}.log"
if [ -f "$BUILDLOG" ]; then
local i=1
while true; do
@@ -792,8 +792,8 @@ create_package() {
echo "builddate = $builddate" >>.PKGINFO
echo "packager = $packager" >>.PKGINFO
echo "size = $size" >>.PKGINFO
- if [ "$CARCH" != "" ]; then
- echo "arch = $CARCH" >>.PKGINFO
+ if [ "$destarch" != "" ]; then
+ echo "arch = $destarch" >>.PKGINFO
fi
if [ "$(check_option force)" = "y" ]; then
echo "force = true" >> .PKGINFO
@@ -851,7 +851,7 @@ create_package() {
# tar it up
msg2 "$(gettext "Compressing package...")"

- local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+ local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${destarch}${PKGEXT}"

if ! bsdtar -czf "$pkg_file" $comp_files *; then
error "$(gettext "Failed to create package file.")"
@@ -872,11 +872,11 @@ create_xdelta() {
local pkginfo="$(mktemp "$startdir"/xdelta-pkginfo.XXXXXXXXX)"

local old_file old_version
- for old_file in $(ls {"$cache_dir","$PKGDEST"}/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
+ for old_file in $(ls {"$cache_dir","$PKGDEST"}/${pkgname}-*-*{,-$destarch}$PKGEXT 2>/dev/null); do
bsdtar -xOf "$old_file" .PKGINFO > "$pkginfo" || continue
if [ "$(cat "$pkginfo" | grep '^pkgname = ')" != "pkgname = $pkgname" ]; then
continue # Package name does not match.
- elif [ "$(cat "$pkginfo" | grep '^arch = ')" != "arch = $CARCH" ] ; then
+ elif [ "$(cat "$pkginfo" | grep '^arch = ')" != "arch = $destarch" ] ; then
continue # Not same arch.
fi

@@ -894,7 +894,7 @@ create_xdelta() {

if [ "$base_file" != "" ]; then
msg "$(gettext "Making delta from version %s...")" "$latest_version"
- local delta_file="$PKGDEST/$pkgname-${latest_version}_to_$pkgver-$pkgrel-$CARCH.delta"
+ local delta_file="$PKGDEST/$pkgname-${latest_version}_to_$pkgver-$pkgrel-$destarch.delta"
local ret=0

# xdelta will decompress base_file & pkg_file into TMP_DIR (or /tmp if
@@ -984,9 +984,9 @@ install_package() {
[ "$INSTALL" = "0" ] && return
msg "$(gettext "Installing package ${pkgname} with pacman -U...")"
if [ "$ASROOT" = "0" ]; then
- sudo pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} || exit $?
+ sudo pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${destarch}${PKGEXT} || exit $?
else
- pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} || exit $?
+ pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${destarch}${PKGEXT} || exit $?
fi
}

@@ -1330,6 +1330,10 @@ if [ "$arch" = 'any' ]; then
CARCH='any'
fi

+if [ -z "$destarch" ]; then
+ destarch="$CARCH"
+fi
+
if ! in_array $CARCH ${arch[@]}; then
if [ "$IGNOREARCH" = "0" ]; then
error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgname" "$CARCH"
@@ -1374,7 +1378,7 @@ unset valid_options opt known kopt
devel_check
devel_update

-if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${destarch}${PKGEXT}"
-a "$FORCE" = "0" -a "$SOURCEONLY" = "0" -a "$NOBUILD" = "0" ]; then
if [ "$INSTALL" = "1" ]; then
warning "$(gettext "A package has already been built, installing existing package...")"
@@ -1402,7 +1406,7 @@ if [ "$INFAKEROOT" = "1" ]; then
exit 0 # $E_OK
fi

-msg "$(gettext "Making package: %s")" "$pkgname $pkgver-$pkgrel $CARCH ($(date))"
+msg "$(gettext "Making package: %s")" "$pkgname $pkgver-$pkgrel $destarch ($(date))"

if [ $EUID -eq 0 ]; then
warning "$(gettext "Running makepkg as root...")"
@@ -1504,10 +1508,10 @@ else
fi
fi

- create_xdelta "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+ create_xdelta "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${destarch}${PKGEXT}"
fi

-msg "$(gettext "Finished making: %s")" "$pkgname $pkgver-$pkgrel $CARCH ($(date))"
+msg "$(gettext "Finished making: %s")" "$pkgname $pkgver-$pkgrel $destarch ($(date))"

install_package

--
1.5.6


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-02-2008, 01:58 AM
Allan McRae
 
Default Introduce destarch keyword into makepkg

Thomas Bächler wrote:
> If destarch is added to a PKGBUILD,

I read that as de-starch and was confused for a while...

> makepkg sets the architecture of the
> resulting package to $destarch instead of $CARCH. This is useful if you
> want to cross-create packages for one architecture on the other.
>
> Using
>
> arch=('i686')
> destarch='x86_64'
>
> makes it possible to build multilib packages and to build grub without
> the export CARCH="x86_64" hack.
>

So when you are building the i686 packages, you have to comment out the
destarch value? I think it would be better to use a flag like -D/--dest
x86_64.

Allan




_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-02-2008, 02:10 AM
"Dan McGee"
 
Default Introduce destarch keyword into makepkg

On Tue, Jul 1, 2008 at 8:58 PM, Allan McRae <allan@archlinux.org> wrote:
> Thomas Bächler wrote:
>> If destarch is added to a PKGBUILD,
>
> I read that as de-starch and was confused for a while...
>
>> makepkg sets the architecture of the
>> resulting package to $destarch instead of $CARCH. This is useful if you
>> want to cross-create packages for one architecture on the other.
>>
>> Using
>>
>> arch=('i686')
>> destarch='x86_64'
>>
>> makes it possible to build multilib packages and to build grub without
>> the export CARCH="x86_64" hack.
>>
>
> So when you are building the i686 packages, you have to comment out the
> destarch value? I think it would be better to use a flag like -D/--dest
> x86_64.

I wanted to make this same point too but I was afraid I interpreted
the patch wrong. It doesn't seem intuitive to have to comment things
in and out of the PKGBUILD.

Of course, it is now just as easy to do:
CARCH=blah makepkg

which seems to make this patch not worth it?

-Dan
_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-02-2008, 04:11 AM
Allan McRae
 
Default Introduce destarch keyword into makepkg

Dan McGee wrote:
> On Tue, Jul 1, 2008 at 8:58 PM, Allan McRae <allan@archlinux.org> wrote:
>
>> Thomas Bächler wrote:
>>
>>> If destarch is added to a PKGBUILD,
>>>
>> I read that as de-starch and was confused for a while...
>>
>>
>>> makepkg sets the architecture of the
>>> resulting package to $destarch instead of $CARCH. This is useful if you
>>> want to cross-create packages for one architecture on the other.
>>>
>>> Using
>>>
>>> arch=('i686')
>>> destarch='x86_64'
>>>
>>> makes it possible to build multilib packages and to build grub without
>>> the export CARCH="x86_64" hack.
>>>
>>>
>> So when you are building the i686 packages, you have to comment out the
>> destarch value? I think it would be better to use a flag like -D/--dest
>> x86_64.
>>
>
> I wanted to make this same point too but I was afraid I interpreted
> the patch wrong. It doesn't seem intuitive to have to comment things
> in and out of the PKGBUILD.
>
> Of course, it is now just as easy to do:
> CARCH=blah makepkg
>
> which seems to make this patch not worth it?

But CARCH=blah requires that blah is in the arch array which indicates
that is can be built on that arch - not the case for grub.

Would this make more sense?
arch=('i686' 'x86_64)
buildarch=('i686')

To build for i686 just type "makepkg" on an i686 machine. To build for
x86_64, type "makepkg -D x86_64" on an i686 machine. Typing "makepkg"
on a x86_64 machine fails. I think this would be clearer.

Allan





_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-02-2008, 04:26 AM
"Dan McGee"
 
Default Introduce destarch keyword into makepkg

On Tue, Jul 1, 2008 at 11:11 PM, Allan McRae <allan@archlinux.org> wrote:
> Dan McGee wrote:
>> On Tue, Jul 1, 2008 at 8:58 PM, Allan McRae <allan@archlinux.org> wrote:
>>
>>> Thomas Bächler wrote:
>>>
>>>> If destarch is added to a PKGBUILD,
>>>>
>>> I read that as de-starch and was confused for a while...
>>>
>>>
>>>> makepkg sets the architecture of the
>>>> resulting package to $destarch instead of $CARCH. This is useful if you
>>>> want to cross-create packages for one architecture on the other.
>>>>
>>>> Using
>>>>
>>>> arch=('i686')
>>>> destarch='x86_64'
>>>>
>>>> makes it possible to build multilib packages and to build grub without
>>>> the export CARCH="x86_64" hack.
>>>>
>>>>
>>> So when you are building the i686 packages, you have to comment out the
>>> destarch value? I think it would be better to use a flag like -D/--dest
>>> x86_64.
>>>
>>
>> I wanted to make this same point too but I was afraid I interpreted
>> the patch wrong. It doesn't seem intuitive to have to comment things
>> in and out of the PKGBUILD.
>>
>> Of course, it is now just as easy to do:
>> CARCH=blah makepkg
>>
>> which seems to make this patch not worth it?
>
> But CARCH=blah requires that blah is in the arch array which indicates
> that is can be built on that arch - not the case for grub.

Oooohh, I guess I still didn't understand this then. So what is the
deal here? We are just faking the arch extension at the end along with
putting a different value in PKGINFO? I guess someone explaining the
entire situation for stupid me would be best- I'm not very familiar on
the grub build procedure, especially when it comes to building for
"other" architectures.

> Would this make more sense?
> arch=('i686' 'x86_64)
> buildarch=('i686')
>
> To build for i686 just type "makepkg" on an i686 machine. To build for
> x86_64, type "makepkg -D x86_64" on an i686 machine. Typing "makepkg"
> on a x86_64 machine fails. I think this would be clearer.

I would rather not introduce a new variable for such a specific use
case like this. It seems overkill to me, especially since i686/x86_64
is one of the few cases where the architectures share a lot in common.
You wouldn't really do something along the lines of i686/ppc for
instance.

-Dan
_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-02-2008, 07:14 AM
Thomas Bächler
 
Default Introduce destarch keyword into makepkg

Allan McRae schrieb:
But CARCH=blah requires that blah is in the arch array which indicates
that is can be built on that arch - not the case for grub.


Indeed.


Would this make more sense?
arch=('i686' 'x86_64)
buildarch=('i686')

To build for i686 just type "makepkg" on an i686 machine. To build for
x86_64, type "makepkg -D x86_64" on an i686 machine. Typing "makepkg"
on a x86_64 machine fails. I think this would be clearer.


Yeah, I just saw that this makes much more sense for grub, as you need
the package for both architectures (right now, we actually change a
comment everytime we build it). However, my motivation was that right
now I am building some multilib stuff and have packages that always have
to be built on i686 and installed on x86_64. So at the end of the
build() procedure I need to do 'export CARCH="x86_64"', which is a hack
that doesn't work with -L for example.


Using a -D option would mean that I have to build 20 or 30 packages with
'-D x86_64' all the time. My goal was to make the build procedure for
these packages intuitive enough, so you can't build them "wrong".


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-02-2008, 12:27 PM
Allan McRae
 
Default Introduce destarch keyword into makepkg

Thomas Bächler wrote:
>> Would this make more sense?
>> arch=('i686' 'x86_64)
>> buildarch=('i686')
>>
>> To build for i686 just type "makepkg" on an i686 machine. To build
>> for x86_64, type "makepkg -D x86_64" on an i686 machine. Typing
>> "makepkg" on a x86_64 machine fails. I think this would be clearer.
>
> Yeah, I just saw that this makes much more sense for grub, as you need
> the package for both architectures (right now, we actually change a
> comment everytime we build it). However, my motivation was that right
> now I am building some multilib stuff and have packages that always
> have to be built on i686 and installed on x86_64. So at the end of the
> build() procedure I need to do 'export CARCH="x86_64"', which is a
> hack that doesn't work with -L for example.
>
> Using a -D option would mean that I have to build 20 or 30 packages
> with '-D x86_64' all the time. My goal was to make the build procedure
> for these packages intuitive enough, so you can't build them "wrong".
>

Just getting an indication of how common this is. The multilib stuff in
[community] all takes the i686 package as the source and just moves the
files to the new locations. Is there some reason that you cannot use
that approach. Wouldn't all packages you are wanting to make a multilib
package for have an i686 package floating about. Also, with that
approach you can actually make the package on the target architecture.

Allan



_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-02-2008, 04:20 PM
Thomas Bächler
 
Default Introduce destarch keyword into makepkg

Allan McRae schrieb:
Just getting an indication of how common this is. The multilib stuff in
[community] all takes the i686 package as the source and just moves the
files to the new locations. Is there some reason that you cannot use
that approach. Wouldn't all packages you are wanting to make a multilib
package for have an i686 package floating about. Also, with that
approach you can actually make the package on the target architecture.


The approach taken in community doesn't work very well, as putting a
library package into a different path poses problems. Just one example:
glibc has the path /usr/lib/gconv hardcoded, now we load the 32 bit
glibc on a 64 bit system and it tries to load the modules from
/usr/lib/gconv, all of which are 64 bit binaries, thus incompatible.
Similar problems exist for alsa-lib, pango, gtk and maybe others. In the
community/AUR packages, these are worked around by environment variables
where possible, but in most cases they are just being ignored.


Thus I started to look into rebuilding all packages required on a 32 bit
system, adjusting the paths correctly and stripping all unnecessary
files. This is supposed to be a _clean_ and slim 32 bit runtime without
a build environment. Right now I got enough libraries to make
nspluginwrapper (built from source!) and flashplugin work.


My goal for now is to get nspluginwrapper+flash and wine to work on a 64
bit archlinux system. Maybe later I want to add all libraries necessary
to install and run Google Earth.


This task motivated the destarch=, STRIP_DIRS and rundepends suggestions
I posted: In my PKGBUILDs, I would then use


arch=('i686')
destarch='x86_64'
makedepends=('glibc' 'foo')
rundepends=('glibc-32bit' 'foo-32bit')

to "cross-compile" the packages on my full arch32 system. I hope this
clarifies my wishes.


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-03-2008, 11:42 AM
"Roman Kyrylych"
 
Default Introduce destarch keyword into makepkg

2008/7/2 Thomas Bächler <thomas@archlinux.org>:
> Allan McRae schrieb:
>>
>> Just getting an indication of how common this is. The multilib stuff in
>> [community] all takes the i686 package as the source and just moves the
>> files to the new locations. Is there some reason that you cannot use that
>> approach. Wouldn't all packages you are wanting to make a multilib package
>> for have an i686 package floating about. Also, with that approach you can
>> actually make the package on the target architecture.
>
> The approach taken in community doesn't work very well, as putting a library
> package into a different path poses problems. Just one example: glibc has
> the path /usr/lib/gconv hardcoded, now we load the 32 bit glibc on a 64 bit
> system and it tries to load the modules from /usr/lib/gconv, all of which
> are 64 bit binaries, thus incompatible. Similar problems exist for alsa-lib,
> pango, gtk and maybe others. In the community/AUR packages, these are worked
> around by environment variables where possible, but in most cases they are
> just being ignored.
>
> Thus I started to look into rebuilding all packages required on a 32 bit
> system, adjusting the paths correctly and stripping all unnecessary files.
> This is supposed to be a _clean_ and slim 32 bit runtime without a build
> environment. Right now I got enough libraries to make nspluginwrapper (built
> from source!) and flashplugin work.
>
> My goal for now is to get nspluginwrapper+flash and wine to work on a 64 bit
> archlinux system. Maybe later I want to add all libraries necessary to
> install and run Google Earth.
>
> This task motivated the destarch=, STRIP_DIRS and rundepends suggestions I
> posted: In my PKGBUILDs, I would then use
>
> arch=('i686')
> destarch='x86_64'
> makedepends=('glibc' 'foo')
> rundepends=('glibc-32bit' 'foo-32bit')
>
> to "cross-compile" the packages on my full arch32 system. I hope this
> clarifies my wishes.

Ah, now this {make,run}depends thing makes sense to me.
<just-thinking>
Though, for more clarity, IMHO it could be nicier for makepkg -s to
install _only_ makedepends,
and if pkgA is both run-time and build-time dependcy, then write it as:
makedepends=('pkgA')
depends=('pkgA')
but obviously that's not backwards compatible, and huge amount of
packages would have to be changed,
and many packages would have dependencies duplicated in 2 variables,
so Thomas' proposal of introducing rundepends makes perfect sense and
is the best way here
</just-thinking>

--
Roman Kyrylych (Ð*оман Кирилич)
_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 07-03-2008, 12:08 PM
Xavier
 
Default Introduce destarch keyword into makepkg

On Thu, Jul 3, 2008 at 1:42 PM, Roman Kyrylych <roman.kyrylych@gmail.com> wrote:
>
> Ah, now this {make,run}depends thing makes sense to me.
> <just-thinking>
> Though, for more clarity, IMHO it could be nicier for makepkg -s to
> install _only_ makedepends,
> and if pkgA is both run-time and build-time dependcy, then write it as:
> makedepends=('pkgA')
> depends=('pkgA')
> but obviously that's not backwards compatible, and huge amount of
> packages would have to be changed,
> and many packages would have dependencies duplicated in 2 variables,
> so Thomas' proposal of introducing rundepends makes perfect sense and
> is the best way here
> </just-thinking>
>

Yeah, I also think that this would be a cleaner design but is not
practical at all :P

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 01:15 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org