You are not logged in.

#1 2005-07-10 23:15:03

scrawler
Member
Registered: 2005-06-07
Posts: 318

nooobie newbie package attempt (gnuserv)

howdy guys,

This is my firstish attempt at building a package.  Here's the
PKGBUILD, nothing fancy.  I ran makepkg as root, and it made a
package, which I installed with pacman.

pkgname=gnuserv
pkgver=3.12.7
pkgrel=1
pkgdesc="gnuserv with gnu emacs compatability layer"
url="http://meltin.net/hacks/emacs/"
license="GPL"
depends=()
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=(http://meltin.net/hacks/emacs/src/gnuserv-3.12.7.tar.gz)
md5sums=()

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

The trouble is, makepkg installed everything without pacman.  Pacman
-A "installs" it, pacman -R does not remove it.  What did I do wrong?
I could have just compiled by hand with the same results...

Offline

#2 2005-07-10 23:32:13

juergen
Developer
From: Frankfurt/Germany
Registered: 2005-04-11
Posts: 48
Website

Re: nooobie newbie package attempt (gnuserv)

scrawler wrote:
...
  make DESTDIR=$startdir/pkg install
...

It seems like the Makefile doesn't use DESTDIR, so everything get's installed in /usr...
I prefer to test new PKGBUILD's in an fakeroot environment. This would yield the following error:

 
/bin/install -c gnuserv /usr/bin/gnuserv
/bin/install: cannot create regular file `/usr/bin/gnuserv': Permission denied

Offline

#3 2005-07-10 23:45:20

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: nooobie newbie package attempt (gnuserv)

also, try using

 [url]http://dl.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz[/url]

for source whenever possible.

You can generate md5sums by doing makepkg -g>>PKGBUILD
that will put the sums at the bottom of the PKGBUILD.

There are no dependancies?

It shouldn't be hard to find the equivalent of DESTDIR. Just have a look in the makefile, you'll spot it out.[/code]

Offline

#4 2005-07-11 09:33:07

scrawler
Member
Registered: 2005-06-07
Posts: 318

Re: nooobie newbie package attempt (gnuserv)

Dependencies?  Emacs, I guess, since gnuclient works "under" emacs.

I guess I need further enlightenment about the build section of PKGBUILD.

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

Ok, bear with me, please:

the build section is just as if I did a

#configure
#make
#make install

except that the resulting binarys and whatever are packed into the
package tarball.  Pacman -A puts them wherever they really go in the
filesystem.  Is that right?

Offline

#5 2005-07-11 11:06:50

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: nooobie newbie package attempt (gnuserv)

You need to include the dependancies in depends() array.

Normally if you do make install it will try installing on the filesystem. Thats why you need to find the deleclaration that defines where to install to. In you case its not DESTDIR but more than likely something else. If I had more time, I would try to help you out on that part.

I believe if you use -c to makepkg and do
pacman --upgrade /complete/path/to/file
it will either upgrade or install through pacman, which ever is needed.

Offline

#6 2005-07-11 21:46:48

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: nooobie newbie package attempt (gnuserv)

I'm fairly new to Arch packaging myself, but I have found that if DESTDIR= doesn't work with make install, prefix= is worth trying - the Makefile will tell you for sure, though.

Offline

#7 2005-07-11 21:52:14

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

Re: nooobie newbie package attempt (gnuserv)

namcap is your friend... (pacman -S namcap)
when a package is built, run namcap on the pkg.tar.gz file

namcap gnuserv-3.12.7-1.pkg.tar.gz

that will list all the things you can do to improve the PKGBUILD

Offline

#8 2005-07-12 12:02:33

scrawler
Member
Registered: 2005-06-07
Posts: 318

Re: nooobie newbie package attempt (gnuserv)

Amazingly, makepkg's manpage helped me (read?  who, me?)

here's the relevant part:

the manpage wrote:

After  a  package  is built, the build function must install the
       package files into a special package root, which can  be  refer-
       enced  by  $startdir/pkg in the build function.  The typical way
       to do this is one of the following:

              make DESTDIR=$startdir/pkg install

              or

              make prefix=$startdir/pkg/usr install

       Notice that the "/usr" portion should be present with  "prefix",
       but  not  "DESTDIR".   "DESTDIR" is the favorable option to use,
       but not all Makefiles support it.  Use "prefix" only when "DEST-
       DIR" is unavailable.

So, using the second one worked.

If you don't mind, I have some other questions.  What about "extra
stuff?"  I had to manually copy some elisp files into my site-lisp
directory, and edit my .emacs config file.  Where would I put, say, a
script that automates this?

Also, I need to make this package more generic, regarding the stuff I
did manually.  I tried to add the files to
/usr/share/emacs/site-lisp/, but this did not work for some reason.
the edit to .emacs, and adding the files to my local emacs directory
did.

If anyone else wants to use my package, wouldn't it be better for it
to be completely hands-off?

thanks,

Offline

#9 2005-07-12 17:11:39

juergen
Developer
From: Frankfurt/Germany
Registered: 2005-04-11
Posts: 48
Website

Re: nooobie newbie package attempt (gnuserv)

the manpage wrote:

              make prefix=$startdir/pkg/usr install

This is rather dangerous. Many programs use prefix to find extensions on runtime. One example is scheme48, i fixed 2 weeks ago.

Jürgen

Offline

#10 2005-07-12 18:22:59

mezoko
Member
Registered: 2005-03-26
Posts: 310
Website

Re: nooobie newbie package attempt (gnuserv)

juergen wrote:
scrawler wrote:
...
  make DESTDIR=$startdir/pkg install
...

It seems like the Makefile doesn't use DESTDIR, so everything get's installed in /usr...
I prefer to test new PKGBUILD's in an fakeroot environment. This would yield the following error:

 
/bin/install -c gnuserv /usr/bin/gnuserv
/bin/install: cannot create regular file `/usr/bin/gnuserv': Permission denied

how you go about doing that?


"The only thing we have to fear is fear itself." - Franklin D. Roosevelt

Offline

#11 2005-07-12 18:43:27

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: nooobie newbie package attempt (gnuserv)

install fakeroot if it isn't installed (pacman -S fakeroot)
and run makepkg  as an ordinary user.

Offline

#12 2005-07-12 18:45:39

mezoko
Member
Registered: 2005-03-26
Posts: 310
Website

Re: nooobie newbie package attempt (gnuserv)

Snowman wrote:

install fakeroot if it isn't installed (pacman -S fakeroot)
and run makepkg  as an ordinary user.

ahh thanks


"The only thing we have to fear is fear itself." - Franklin D. Roosevelt

Offline

Board footer

Powered by FluxBB