You are not logged in.

#1 2009-03-13 20:35:08

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

my first stab at writing a PKGBUILD - needs help :)

This is my first attempt at writing a PKGBUILD so be gentle.  Also, I'm some what of a LINUX newbie as well.

Anyway, my 'makepkg PKGBUILD' dies after the make step.  Basically, I just need root to do a 'make install' command.  Here are the last few lines of the 'makepkg PKGBUILD'

LE -I/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/../include/ -I/lib/modules/2.6.28-LinHES/build/include/asm/mach-default/ -I/lib/modules/2.6.28-LinHES/build/include2/asm/mach-default/ -fno-stack-protector -mregparm=3 -I/lib/modules/2.6.28-LinHES/build/include/ -O6 -fno-strength-reduce -fno-strict-aliasing  " KVER=2.6 MODNAME=bc_$i TARGET=bc_$i.ko PWD=/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/$i ; \
    done
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/gost'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/gost'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/blowfish'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/blowfish'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/twofish'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/twofish'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/des'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/des'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/bf128'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/bf128'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/bf448'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/bf448'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/cast'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/cast'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/idea'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/idea'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/3des'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/3des'
make[2]: Entering directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/rijn'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod/rijn'
make[1]: Leaving directory `/home/squeeze/bcrypt/src/bcrypt-1.6-25/mod'
install -o root -m 4755 -s bin/bctool   //usr/bin/
install: cannot create regular file `//usr/bin/bctool': Permission denied
make: *** [install] Error 1
==> ERROR: Build Failed.
    Aborting...

And here is my PKGBUILD file (note that I read the wiki article about using hyphens, but I can't seem to the "${pkgver//_/-}" syntax right which is why I'm not using the $pkgname and $pkgver variables.

pkgname=bcrypt
pkgver=1.6.25
pkgrel=1
pkgdesc="Bestcrypt encryption package"
arch=('i686' 'x86_64')
url="http://www.jetico.com/linux/"
license=('GPL2')
depends=('zlib')
conflicts=('bcrypt')
provides=('bcrypt')
source=(http://www.jetico.com/linux/BestCrypt-1.6-25.tar.gz)
md5sums=('3b37bd06035344c36f89bc2e35be8076')
sha1sums=('812829af54e16736ee1a852565afb0f98968ad5a')
options=('!emptydirs')

build() {
mkdir -p /etc/rc.d/rc0.d
mkdir -p /etc/rc.d/rc1.d
mkdir -p /etc/rc.d/rc2.d
mkdir -p /etc/rc.d/rc3.d
mkdir -p /etc/rc.d/rc4.d
mkdir -p /etc/rc.d/rc5.d
mkdir -p /etc/rc.d/rc6.d

cd $startdir/src/$pkgname-1.6-25
make || return 1
make DESTDIR=${pkgdir} install || return 1

rm -rf /etc/rc.d/rc0.d
rm -rf /etc/rc.d/rc1.d
rm -rf /etc/rc.d/rc2.d
rm -rf /etc/rc.d/rc3.d
rm -rf /etc/rc.d/rc4.d
rm -rf /etc/rc.d/rc5.d
rm -rf /etc/rc.d/rc6.d
}

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2009-03-13 21:12:52

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: my first stab at writing a PKGBUILD - needs help :)

install -o root -m 4755 -s bin/bctool   //usr/bin/
install: cannot create regular file `//usr/bin/bctool': Permission denied
make: *** [install] Error 1
==> ERROR: Build Failed.
    Aborting...

Something seems wrong here. It has //usr instead of /usr. I haven't tried it out yet, coz I am at work on a XP machine. But I will try it out later tonight and get back,

Last edited by Inxsible (2009-03-13 21:14:01)


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2009-03-13 21:22:51

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: my first stab at writing a PKGBUILD - needs help :)

Thank you for the reply, Inxsible.  You might not want to bother/if you didn't reply, I would delete the thread:

1) bcrypt is designed for debian I think since it has many references to /etc/rcx.d as you can see in my PKGBUILD.  I have no idea how to handle these in Arch.
2) I just found truecrypt in the Arch repo and installation was trivial smile

Last edited by graysky (2009-03-13 21:23:34)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2009-03-13 22:22:37

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: my first stab at writing a PKGBUILD - needs help :)

...scratch that.  If you're willing to have a look, I would like to know what I'm doing wrong to learn.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2009-03-14 02:14:04

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: my first stab at writing a PKGBUILD - needs help :)

The problem is that it's trying to copy files to locations outside of $pkgdir. If you look at the main Makefile, it defines a $root variable and sets it to "/". Further down, this variable is used to compile the installation paths (i.e.: $(root)/usr/bin/). You could use sed to modify $root to point to $pkgdir:

sed -i "s|^root=/|root=\"$pkgdir\"|" Makefile

However, I find the way this Makefile is written quite messy, tbh. It's probably easier to do the installation manually from the PKGBUILD, instead of calling `make install' with the provided Makefile. Something like this:

pkgname=bcrypt
pkgver=1.6.25
pkgrel=1
pkgdesc="Bestcrypt encryption package"
arch=('i686' 'x86_64')
url="http://www.jetico.com/linux/"
license=('GPL2')
depends=('zlib')
conflicts=('bcrypt')
provides=('bcrypt')
source=(http://www.jetico.com/linux/BestCrypt-1.6-25.tar.gz)
md5sums=('3b37bd06035344c36f89bc2e35be8076')
sha1sums=('812829af54e16736ee1a852565afb0f98968ad5a')
options=('!emptydirs')

build() {
  cd "$srcdir/$pkgname-1.6-25"

  make || return 1

  install -Dm4755 bin/bctool "$pkgdir/usr/bin/bctool"
  install -Dm755 lib/libkgsha.so "$pkgdir/usr/lib/libkgsha.so"
  install -Dm755 lib/libkgsha256.so "$pkgdir/usr/lib/libkgsha256.so"
  for bin in bcmount bcumount bcformat bcfsck bcnew bcpasswd bcinfo bclink bcunlink bcmake_hidden bcreencrypt; do
    ln -sf bctool "$pkgdir/usr/bin/$bin"
  done
  install -Dm644 etc/bc.conf "$pkgdir/etc/bc.conf"
  install -Dm755 etc/bcrypt "$pkgdir/etc/rc.d/bcrypt"
  install -Dm644 man/bctool.8 "$pkgdir/usr/share/man/man8/bctool.8"
  install -dm755 "$pkgdir"/lib/modules/$(uname -r)/kernel/drivers/block
  install -m644 bin/{bc,bc_3des,bc_bf128,bc_bf448,bc_blowfish,bc_cast,bc_des,bc_gost,bc_idea,bc_rijn,bc_twofish}.ko \
                "$pkgdir"/lib/modules/$(uname -r)/kernel/drivers/block
}

Mind you, I didn't test the generated package; I'm not sure how. :<

One last comment, in regard to your PKGBUILD, is that you have included conflicts/provides on bcrypt, which also happens to be the name of the package you're making. smile

If something seems confusing, don't hesitate to ask for further clarification.

Offline

#6 2009-03-14 12:20:51

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

Re: my first stab at writing a PKGBUILD - needs help :)

Also remove the provides= and conflicts=, it doesn't make sense to have them in there.

+1 on manually installing instead of using the Makefile

Offline

#7 2009-03-14 12:39:37

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: my first stab at writing a PKGBUILD - needs help :)

graysky wrote:

Thank you for the reply, Inxsible.  You might not want to bother/if you didn't reply, I would delete the thread:

1) bcrypt is designed for debian I think since it has many references to /etc/rcx.d as you can see in my PKGBUILD.  I have no idea how to handle these in Arch.
2) I just found truecrypt in the Arch repo and installation was trivial smile

Even if this software is written for Debian, you don't try to turn Arch into Debian. So no /etc/rc.d/rc* subdirs, please wink. Then you might as well save you the trouble and run Debian alltogether. Also: do NOT install to the real root. The ${pkg} variable is meant exactly for that - any manual installations you make in the PKGBUILD should be prefixed with that.

Try to find out the debian-specific references in the source files (often it's installation just installation paths) and adapt them to Arch. To keep it clean, after you changed the code, diff it to a clean source tree so you can reapply your changes automatically and integrate it into your PKGBUILD.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#8 2009-03-14 13:33:19

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: my first stab at writing a PKGBUILD - needs help :)

@B - I just did that so the installer would complete.  I also removed them but I think editing the make file or doing as foutrelis suggested it best smile


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#9 2009-03-21 12:25:41

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: my first stab at writing a PKGBUILD - needs help :)

@foutrelis - your PKGBUILD works great.  Thank you!


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB