You are not logged in.

#1 2008-07-25 09:06:15

hsa2
Member
From: Turkey
Registered: 2008-05-26
Posts: 46
Website

$startdir/pkg/ or $pkgdir

Hello,
I was using $pkgdir instead of $startdir/pkg. But I realised that, somebody chooses just the opposite. Which one is correct? I know, both of them work. However, I am wondering if there is a standart about it.

Offline

#2 2008-07-25 09:08:29

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,398
Website

Re: $startdir/pkg/ or $pkgdir

Short: use $pkgdir

Long: It does not really matter at the moment but $pkgdir is better as it guards against future changes to makepkg.

Offline

#3 2008-07-25 09:11:23

hsa2
Member
From: Turkey
Registered: 2008-05-26
Posts: 46
Website

Re: $startdir/pkg/ or $pkgdir

Thanks for your quick reply smile

Offline

#4 2008-07-25 09:11:54

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,398
Website

Re: $startdir/pkg/ or $pkgdir

Same goes with $startdir/src and $srcdir

Offline

#5 2008-07-26 03:41:36

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: $startdir/pkg/ or $pkgdir

Also it's easier to read. Clean code is good code yikes

Offline

#6 2008-07-26 16:54:22

rcoyner
Member
From: Washington D.C.
Registered: 2008-05-16
Posts: 30
Website

Re: $startdir/pkg/ or $pkgdir

Are there any other shortcut variables other than $startdir and $srcdir?  To be completely honest I don't think I have seen those variables in the wiki either - I noticed them by looking at other people's PKGBUILDs.

Offline

#7 2008-07-28 04:18:27

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: $startdir/pkg/ or $pkgdir

$pkgdir = $startdir/pkg

Not sure of any others off the top of my head. RTFC is easy though, it's only bash.

Offline

#8 2008-07-28 06:03:39

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

Re: $startdir/pkg/ or $pkgdir

rcoyner wrote:

Are there any other shortcut variables other than $startdir and $srcdir?  To be completely honest I don't think I have seen those variables in the wiki either - I noticed them by looking at other people's PKGBUILDs.

The PKGBUILD man page in pacman 3.2 will have the following section :

BUILD() FUNCTION
       In addition to the above directives, the build() bash function
       comprises the remainder of the PKGBUILD. This is directly sourced and
       executed by makepkg, so anything that bash or the system has available
       is available for use here. Be sure any exotic commands used are covered
       by makedepends.

       All of the above variables such as pkgname and pkgver are available for
       use in the build function. In addition, makepkg defines three variables
       for your use during the build and install process. These three
       variables are as follows:

       startdir
           This contains the absolute path to the directory where the PKGBUILD
           was located, which is usually the output of $(pwd) when makepkg is
           started. startdir was most often used in combination with /src or
           /pkg postfixes, but use of the srcdir and pkgdir variables is
           preferred.

       srcdir
           This points to the directory where makepkg extracts or copies all
           source files. Although it currently is an alias for $startdir/src,
           this assumption should not be assumed true for all future revisions
           of makepkg.

       pkgdir
           This points to the directory where makepkg bundles the installed
           package (this directory will become the root directory of your
           built package). Although it currently is an alias for
           $startdir/pkg, this assumption should not be assumed true for all
           future revisions of makepkg.
       If you create any variables of your own in the build function, it is
       recommended to use the bash local keyword to scope the variable to
       inside the build function.

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

Offline

Board footer

Powered by FluxBB