[arch-ports] PKGBUILD and package release thoughts

Jason Chu jason at archlinux.org
Sat Mar 11 17:40:05 EST 2006


On Sat, Mar 11, 2006 at 09:37:09PM +0100, Andreas Radke wrote:
> Jason Chu schrieb:
> > If there is that large of a discrepency (like j2re, from what I
> > understand), it will be a whole different package: j2re-amd64.
> >
> > If there are just patches and things like that it will look something like
> > this:
> > source=('sources' 'that' 'are' 'common')
> > [ "$CARCH" = "amd64" ] && source=(${source[@]} 'other' 'source')
> >
> > Jason
> >
> >   
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > arch-ports mailing list
> > arch-ports at archlinux.org
> > http://www.archlinux.org/mailman/listinfo/arch-ports
> >   
> Here is my latest pkgbuild for j2re. I don't know how to prevent makepkg
> downloading the large 32bit source. But only therefor a different package?
> 
> # $Id: PKGBUILD,v 1.15 2006/02/11 23:04:29 jgc Exp $
> # Contributed by: Jason Chu <jason at archlinux.org>
> # This PKGBUILD was built largely from code in Crux Linux, then modified
> a bunch to make it j2re
> # Maintainer: Jason Chu <jason at archlinux.org>
> # Contributions by Dusty
> 
> pkgname=j2re
> pkgver=1.5.0_06
> pkgrel=3
> pkgdesc="Sun's java runtime environment"
> url="http://java.sun.com"
> depends=('gcc' 'glibc')
> install="j2re.install"

Rather than these lines,

> #source=(http://public.planetmirror.com/pub/java-sun/J2SE/5.0_04/linux32/jre-1_5_0_04-linux-i586.bin
> j2re.profile jre.patch)
> #source=(http://mirror.dcc.fc.up.pt/Java/jre-1_5_0_06-linux-i586.bin
> j2re.profile jre.patch)
> [ "$CARCH" == "x86_64" ] &&
> source=(http://mirror.dcc.fc.up.pt/Java/jre-1_5_0_06-linux-amd64.bin
> j2re.profile jre.patch)
> md5sums=('e0a88dbec9bfe3195794bb652bfc6516'
> '87d90b2e075b77c41a7efec7411a4153'\
>          '3b589fa777fab553d4f7ce57bc90ce48')
> [ "$CARCH" == "x86_64" ] && md5sums=('6a771c3c9e93021ab34a30bcf609c74b'
> '87d90b2e075b77c41a7efec7411a4153'\
>          '91544f3d5d5aa054db7ce2144d17138b')

I would probably do it like this:

source=(j2re.profile jre.patch)
md5sums=('87d90b2e075b77c41a7efec7411a4153' '3b589fa777fab553d4f7ce57bc90ce48')
[ "$CARCH" = "i686" ] && source=(http://public.planetmirror.com/pub/java-sun/J2SE/5.0_04/linux32/jre-1_5_0_04-linux-i586.bin ${source[@]})
[ "$CARCH" = "i686" ] && md5sums=('e0a88dbec9bfe3195794bb652bfc6516' ${md5sums[@]})
[ "$CARCH" = "x86_64" ] && source=(http://mirror.dcc.fc.up.pt/Java/jre-1_5_0_06-linux-amd64.bin ${source[@]})
[ "$CARCH" = "x86_64" ] && md5sums=('6a771c3c9e93021ab34a30bcf609c74b' ${md5sums[@]})

And considering below, how you continually repeat
jre-1_5_0_06-linux-i586.bin and jre-1_5_0_06-linux-amd64.bin, I would
suggest a variable at the top called _binname, set like this:

[ "$CARCH" = "i686" ] && _binname='jre-1_5_0_04-linux-i586.bin'
[ "$CARCH" = "x86_64" ] && _binname='jre-1_5_0_06-linux-amd64.bin'

And then every time you have a [ "$CARCH" = "i686" ] && line where the only
difference is the filename, replace it like this:

> build() {
>     cd $startdir/src
>     [ "$CARCH" == "i686" ] && patch -p0 jre-1_5_0_06-linux-i586.bin
> <jre.patch
>     [ "$CARCH" == "x86_64" ] && patch -p0 jre-1_5_0_06-linux-amd64.bin
> <jre.patch

patch -p0 $_binname <jre.patch

>   mkdir -p $startdir/pkg/opt/java
>   cd $startdir/pkg/opt/java
>   [ "$CARCH" == "i686" ] && echo -e "q\nyes" | sh
> $startdir/src/jre-1_5_0_06-linux-i586.bin
>   [ "$CARCH" == "x86_64" ] && echo -e "q\nyes" | sh
> $startdir/src/jre-1_5_0_06-linux-amd64.bin

echo -e "q\nyes" | sh $startdir/src/$_binname

>   mv jre${pkgver} jre
>   rm -r jre/man/ja*
>   for i in jre/*; do
>     if [ -f $i ]; then rm -f $i; fi
>   done
>   install -D -m755 $startdir/src/${pkgname}.profile
> $startdir/pkg/etc/profile.d/${pkgname}.sh
> 
>   # no plugin for x86_64
>   if [ "$CARCH" == "i686" ]; then
>     mkdir -p $startdir/pkg/opt/mozilla/lib/plugins
>     ln -s /opt/java/jre/plugin/i386/ns7/libjavaplugin_oji.so
> $startdir/pkg/opt/mozilla/lib/plugins
>     else echo "no plugin for x86_64"

What is this else doing here?  The only person who will see that is the
builder and I don't know that they would care...

>   fi
> }
> 
> 
> Something to improve?
> 
> AndyRTR

You can also replace the filenames in the new source lines I gave with
$_binname, if you wanted to.

How's that for improvement?

Jason

-- 
If you understand, things are just as they are.  If you do not understand,
things are just as they are.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/arch-ports/attachments/20060311/5eaec4c8/attachment.pgp>


More information about the arch-ports mailing list