You are not logged in.

#1 2004-11-10 19:10:42

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

help with my first PKBUILD

ok..my first packagebuild.
can you guys look over the PKGBUILD and make sure it doesn't suck?
ie. all the things are put in the correct places afterwards?

pkgname=webalizer
pkgver=2.01
pkgrel=1
pkgdesc="A fast, free web server log file analysis program"
url="http://www.mrunix.net/webalizer/"
license="GNU GPL"
depends=('gd' 'libpng' 'zlib')
makedepends=()
conflicts=()
replaces=()
backup=(etc/webalizer.conf)
install=
source=(ftp://ftp.mrunix.net/pub/webalizer/$pkgname-$pkgver-10-src.tgz)
md5sums=('9217595005aec46a505e1fb349052a8e')
                                                                                
build() {
  cd $startdir/src/$pkgname-${pkgver}-10
  ./configure --prefix=/usr --sysconfdir=/etc
  make || return 1
  mkdir -p $startdir/pkg/etc
  mkdir -p $startdir/pkg/usr/bin
  mkdir -p $startdir/pkg/usr/man/man1
  make ETCDIR=$startdir/pkg/etc prefix=$startdir/pkg/usr install
}

It compiles ok.  smile and the package looks good.
The only thing I wonder about really now is the need to do the mkdir -p stuff.
The directories were not being created. I suppose that is makefile specific...
is that true?

also, it uses a config file called webalizer.conf.sample. The user is supposed to rename this file to exclude the .sample suffix. Does that go into a post install to rename it for the user? or should I leave it as is?

also, when you remove the package, the webalizer.conf file is left behind. (it might be looking for webalizer.conf.sample ?)


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#2 2004-11-10 21:21:00

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: help with my first PKBUILD

yeah, looks good - you can remove the unused fields at the top too - and grab namcap from pacman and run it on the PKGBUILD file - namcap is a utility to scan PKGBUILDs and make usre they're up-to-snuff

Offline

#3 2004-11-10 21:46:27

skeeterbug
Member
From: Oklahoma, USA
Registered: 2004-10-24
Posts: 92
Website

Re: help with my first PKBUILD

Just a quick opinion on the webalizer.conf.sample.  I think you should just leave the sample as is and at most make a reference to it - like an echo about it or something in the post install script.  I'm just kind of going off of samba which has a sample file and isn't renamed or modified by default.  I don't know the generally accepted way to remove the .conf but I would assume you put something in the script, maybe save it to .pacsave if you want.

Offline

#4 2004-11-10 21:58:59

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: help with my first PKBUILD

cactus wrote:

ok..my first packagebuild.
can you guys look over the PKGBUILD and make sure it doesn't suck?
ie. all the things are put in the correct places afterwards?

pkgname=webalizer
pkgver=2.01
pkgrel=1
pkgdesc="A fast, free web server log file analysis program"
url="http://www.mrunix.net/webalizer/"
license="GNU GPL"
depends=('gd' 'libpng' 'zlib')
makedepends=()
conflicts=()
replaces=()
backup=(etc/webalizer.conf)
install=
source=(ftp://ftp.mrunix.net/pub/webalizer/$pkgname-$pkgver-10-src.tgz)
md5sums=('9217595005aec46a505e1fb349052a8e')
                                                                                
build() {
  cd $startdir/src/$pkgname-${pkgver}-10
  ./configure --prefix=/usr --sysconfdir=/etc
  make || return 1
  mkdir -p $startdir/pkg/etc
  mkdir -p $startdir/pkg/usr/bin
  mkdir -p $startdir/pkg/usr/man/man1
  make ETCDIR=$startdir/pkg/etc prefix=$startdir/pkg/usr install
}

remove the unused lines you don't need them.

It compiles ok.  smile and the package looks good.
The only thing I wonder about really now is the need to do the mkdir -p stuff.
The directories were not being created. I suppose that is makefile specific...
is that true?

no it is not true there are a few reasons the directories may not be created.

you could replace the "prefix" in the make install line and replace it with DESTDIR you may also be able to ditch the ETCDIR portion too. if you try this comment out the mkdir lines.

buld all this using fakeroot. (install fakeroot then build as user not as root)

likely this is an issue with the makefiles or source more than it is makepkg.

also, it uses a config file called webalizer.conf.sample. The user is supposed to rename this file to exclude the .sample suffix. Does that go into a post install to rename it for the user? or should I leave it as is?

also, when you remove the package, the webalizer.conf file is left behind. (it might be looking for webalizer.conf.sample ?)

leave this file as .sample and let the user edit it and rename it as needed. as for removing webalizer.conf, you could probably have a post_install for it but i don't know if this is wise. the file is not being removed because it  is user created and not part of the package.


AKA uknowme

I am not your friend

Offline

#5 2004-11-10 22:11:04

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: help with my first PKBUILD

thanks for the feedback. big_smile
I did indeed run namcap on the pkbuild. It told me to add zlib (originally I didn't have it in there).
I did run build as a user, and had fakeroot installed (it uses this automatically? cool!)

As for removing ETCDIR then it wouldn't work. There was a little goofiness in the makefile that webalizer uses. It wasn't taking the prefix var and using it for the etcdir..this was the only workaround that seemed to work (overriding the makefile var seemed the logical move).

I will take your advices and not mess with the webalizer.conf file. I think I will put in some type of echo statement about the need to rename the file and edit it. Maybe an echo statement on package removal too..something about deleting the file if you don't need it anymore..

My main conern was making this somewhat automatic. But, if that isn't an issue, I won't worry about it.

Should that go into a post_install?

Note: W00t! my first package build! It was very exciting.  wink
thanks for all the input.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#6 2004-11-11 10:25:43

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: help with my first PKBUILD

Congratulations :-)

I agree with what others already said and let me add a few things too:

1. Remove unused fields.

2. Remove or comment out license filed - it's not currently used. Syntax for this field can soon change (more info in the forums).

3. Place webalizer.conf.sample in /usr/share/webalizer (I didn't compile webalizer so I don't know where it's currently beeing installed) and add a message in the postinstall script for the user to manually copy it to /etc and edit if needed. I'm not sure if you then need backup for /etc/webalizer.conf because it shouldn't be touched by default when the package will be uninstalled (if you move it to /usr/share and/or leave sample in its name).

4. Use install -d $startdir/pkg/usr/bin etc. in place of mkdir -p. Or if possible use for example install -D -m644 $startdir/src/somefile $startdir/pkg/somedir/somefile - if this is only one file. It will create the dirs, ensure permissions and copy the file. Check man install for more info and/or forums and/or other pkgbuilds from /var/abs and/or TU pkgbuilds.

5. If etcdir after make is absolutelly necessary just leave it there. I've met with similar situations several times (check meld for example). It's better to use parameters than patching the makefile IMO (unless you have enough knowledge to patch it correctly and submit results to package developers).

6. I usually use namcap -i to doublecheck that dependencies/symlinks are ok. It will show much more info. Never rely only on namcap. There are times when for example package doesn't link against something but it really needs something to work. The first source for dependency requirements is always original documentation for the program (usually this means its webpage). A lot of info can also be found in specifications for other package managers like rpm/apt-get etc (they are often included in the source package). You can always use ebuilds from gentoo-portage.com for comparisions too. For example http://www.gentoo-portage.com/ebuild?e= … -r6.ebuild shows that webalizer can work with geoip (not that I recommend adding it to depends but maybe to the postinstall message?).

7. The installation docs for webalizer mentions the possibility for --enable-dns in the configure script. It shouldn't be the default in this case IMO (since it can create a lot of additional network traffic etc.) but it would be nice to have it as a comment in the pkgbuild - it will make it easier for other package builders.

Offline

#7 2004-11-11 21:20:51

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: help with my first PKBUILD

thanks for the further input lanrat.
here is what i have now.

the PKGBUILD

pkgname=webalizer
pkgver=2.01
pkgrel=2
pkgdesc="A fast, free web server log file analysis program"
url="http://www.mrunix.net/webalizer/"
#license="GNU GPL"
depends=('gd' 'libpng' 'zlib')
makedepends=()
install=$pkgname.install
backup=(etc/webalizer.conf)
source=(ftp://ftp.mrunix.net/pub/webalizer/$pkgname-$pkgver-10-src.tgz)
md5sums=('9217595005aec46a505e1fb349052a8e')
 
build() {
  cd $startdir/src/$pkgname-${pkgver}-10
  ./configure --prefix=/usr --sysconfdir=/etc
  make || return 1
  make INSTALL="/bin/install -D" ETCDIR=$startdir/pkg/usr/share/$pkgname prefix=$startdir/pkg/usr install
  cd $startdir/pkg/usr/bin
  rm -f webazolver
  ln -s webalizer webazolver
}

the webalizer.install

post_install() {
  /bin/cat <<THEEND
  
NOTE
----
To configure webalizer:
$ cp /usr/share/webalizer/webalizer.conf.sample /etc/webalizer.conf
  
Make sure to edit the resulting /etc/webalizer.conf file.
Check the manpage for webalizer for more details.
THEEND
}
 
# arg 1:  the old package version
post_remove() {
  /bin/cat <<THEEND
  
NOTE
----
/etc/webalizer.conf has been left untouched. If you no longer need this file, you may remove it manually.
THEEND
}

I realize that neotuli already has webalizer in his repo
see here
...this is more an exercise for me to learn how to make a PKGBUILD, and do it correctly.
thanks for all your input everyone. big_smile


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

Board footer

Powered by FluxBB