You are not logged in.

#1 2008-02-21 12:56:38

kamahl
Member
Registered: 2007-09-16
Posts: 60

dynamic source url in PKGBUILD

I made a PKGBUILD for a kde4 utility, it's here: http://aur.archlinux.org/packages.php?ID=15072
But the file name in source archive url is different from file name by which wget saves it to disc. I solved it by creating a symlink to the file with name that makepkg expects and removing it after package building.

But it's an ugly solution :-) , is there any way to do it "cleaner"?

Offline

#2 2008-02-21 15:41:09

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: dynamic source url in PKGBUILD

I don't think your solution is that ugly, the file name is.

# Contributor: Jachym Barvinek <jachymb@gmail.com>
pkgname='gtk-kde4'
pkgver='0.4.2'
pkgrel='1'
pkgdesc='Allows you to change GTK style in KDE 4'
arch=(i686 x86_64)
url='http://www.kde-apps.org/content/show.php/gtk-kde4?content=74689'
depends=('qt')
makedepends=('qt' 'coreutils' 'gcc')
license='GPL'
source=(http://www.kde-apps.org/CONTENT/content-files/74689-$pkgname.tar.gz)
md5sums='7c25f022c5ad1e0ea2b830dc4a19e496'

build() {
        cd $startdir/src/gtk-kde4
        qmake -unix || return 1
        make || return 1
        mkdir -p $startdir/pkg/usr/bin
        install $startdir/src/gtk-kde4/bin/gtk-kde4 $startdir/pkg/usr/bin || return 1
}

I changed url= too, now it points to the info page.

I don't know if the content number is the always the same between versions, so you might need to check pkgname and source too when the program is updated.

I don't know why in the PKGBUILD manpage something=(`stuff`) is preferred to your something='stuff'
even when bash completition is not needed.

Offline

#3 2008-02-21 15:52:25

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: dynamic source url in PKGBUILD

carlocci wrote:

something=(`stuff`)

You mean something=("stuff") (note the quotes), and the brackets are used because it's an array which can have 0 or more entries.

A single quote can be used instead of a double quote, but then variables can't be used, e.g.:

provides=("libxft=$pkgver")

Last edited by brebs (2008-02-21 15:56:54)

Offline

#4 2008-02-21 16:29:59

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: dynamic source url in PKGBUILD

Thank you, I was wondering what the brackets were for too smile

I based most of my "analysis" on the example at the end of the PKGBUILD man page

EXAMPLE
       The following is an example PKGBUILD for the patch package. For more
       examples, look through the build files of your distribution´s packages.
       For those using Arch Linux, consult the ABS tree.

           # Maintainer: judd <jvinet@zeroflux.org>

           pkgname=patch
           pkgver=2.5.4
           pkgrel=3
           pkgdesc="A utility to apply patch files to original sources"
           arch=(i686 x86_64)
           url="http://www.gnu.org/software/patch/patch.html"
           license=(´GPL´)
           groups=(´base-devel´)
           depends=(´glibc´ ´ed´)
           source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz)
           md5sums=(´ee5ae84d115f051d87fcaaef3b4ae782´)

           build() {
             cd $startdir/src/$pkgname-$pkgver
             ./configure --prefix=/usr
             make || return 1
             make prefix=$startdir/pkg/usr install
           }

I was a little bit confused by lines like license=(`GPL`), as I thought of some special MAKEPKG syntax.
Maybe that should be corrected to license=('GPL') or license=("GPL").

edit: I checked and the actual patch PKGBUILD uses license=('GPL').

Offline

#5 2008-02-21 17:03:07

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: dynamic source url in PKGBUILD

Offline

#6 2008-02-21 18:48:24

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: dynamic source url in PKGBUILD

brebs wrote:

Thanks for reporting it. I just found a fix, I hope it's alright wink


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#7 2008-02-21 20:04:38

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: dynamic source url in PKGBUILD

Thank you.
I thought the manpage was wrong: I noticed PKGBUILD.5.gz uses \', whereas other manpage files I checked use '
So I came up with
zcat PKGBUILD.5.gz | sed "s/\\\'/\'/g" | gzip - > PKGBUILD.5.gz
which seems to fix it.

Offline

Board footer

Powered by FluxBB