You are not logged in.

#1 2008-05-05 03:05:27

jrick
Member
Registered: 2008-01-16
Posts: 27

PKGBUILD for leJOS

I am thinking of writing a PKGBUILD for leJOS (http://lejos.sourceforge.net/) and possibly submitting it to the AUR.  This will be my first PKGBUILD that I have written entirely from scratch, and I have a couple questions about how to do some things.

First of all, leJOS is built using ant.  After reading the Wiki for creating PKGBUILDs, I understand that everything that will be installed onto the system needs to be placed in $startdir/pkg/.  I am wondering if I need to make ant somehow place all the compiled binaries there, like a "make install", or just copy the files in $startdir/lejos_nxj/bin, etc. into /pkg/usr/bin, etc.

(I use leJOS for a robotics club at my school, and all the computers we use for this run Arch Linux.  I figured that writing a PKGBUILD would be easier than doing a manual install over and over and over again wink )


"Gentlemen! You can't fight in here! This is the war room!"
--President Merkin Muffley

Offline

#2 2008-05-05 06:11:28

kumico
Member
Registered: 2007-09-28
Posts: 224
Website

Re: PKGBUILD for leJOS

i read the readme file. and it talks about setting environment variables
i think the better option here would be to install it to /opt ($pkgdir/opt aka $startdir/pkg/opt)
and maybe create a profile script in /etc/profile.d to set the environment variables and whatever else it needs

Offline

#3 2008-05-06 01:43:28

jrick
Member
Registered: 2008-01-16
Posts: 27

Re: PKGBUILD for leJOS

How would I go about adding a profile script from my PKGBUILD?  Would I just copy it to $pkgdir/etc/profile.d/?

I looked on the PKGBUILD wiki page and couldn't find anything about profile scripts.  Should this be added?

I've started work on the PKGBUILD, or what I know so far.  I'll post it in a bit when I have some time, and upload it to the AUR for others to use when it's ready.


"Gentlemen! You can't fight in here! This is the war room!"
--President Merkin Muffley

Offline

#4 2008-05-06 04:36:52

kumico
Member
Registered: 2007-09-28
Posts: 224
Website

Re: PKGBUILD for leJOS

yeh, just copy it there and make sure it's executable and named [name].sh
it's just your average shell script,
you can look at any of the ones in there to clarify things

Offline

#5 2008-05-07 01:57:11

jrick
Member
Registered: 2008-01-16
Posts: 27

Re: PKGBUILD for leJOS

How do these look?

PKGBUILD

pkgname=lejos_nxj
pkgver=0.6.0
pkgrel=1
pkgdesc="Tools for programming the Lego NXT brick in Java"
arch=('i686')
license=('MPL' 'GPL' 'APACHE' 'LGPL')
url="http://lejos.sourceforge.net/"
depends=('jdk' 'bluez-libs' 'libusb')
makedepends=('gcc' 'apache-ant')
conflicts=()
source=(http://superb-east.dl.sourceforge.net/sourceforge/lejos/lejos_NXJ_0_6_0beta.tar.gz
    lejos_nxj.sh)
md5sums=('e98170688d4218a1ac0ec523d5b322d9'
         '9d6c054f270cec4aa2e1f870d2768e2f')

build() {
  cd $startdir/src/lejos_nxj/build
  ant
  mkdir -p $pkgdir/{opt/lejos_nxj/,etc/profile.d/}
  cp -r $startdir/src/lejos_nxj/ $pkgdir/opt/
  chmod +x $startdir/lejos_nxj.sh
  cp $startdir/lejos_nxj.sh $pkgdir/etc/profile.d/
}

lejos_nxj.sh

export JAVA_HOME=$JAVA_HOME:/opt/java
export NXJ_HOME=$NXJ_HOME:/opt/lejos_nxj
export PATH=$PATH:$NXJ_HOME/bin

I'm not sure I need to define JAVA_HOME, since it is already set (at least on my system, probably from the jre or jdk package).  I'm thinking about removing the $NXJ_HOME from the other one, since it really doesn't make sense to have two paths on your system (unless you're upgrading from a manually installed older version, in which case you would want the newer one).


EDIT: It looks like I shouldn't edit JAVA_HOME at all, since it is set by both /etc/profile.d/jre.sh and /etc/profile.d/jdk.sh.  But I did notice that the jdk.sh is pointing to /opt/java, and the jre.sh is overriding it to /opt/java/jre and removing the other variable.  Is this a bug in the jdk/jre PKGBUILDs?

Last edited by jrick (2008-05-07 03:42:44)


"Gentlemen! You can't fight in here! This is the war room!"
--President Merkin Muffley

Offline

#6 2008-05-07 05:40:24

kumico
Member
Registered: 2007-09-28
Posts: 224
Website

Re: PKGBUILD for leJOS

it looks ok,
i don't think the java home is much of a bug, though it'd make more sense for jdk and jre to have their own variables
i think in this case it's safe to depend on the default no you can remove the java home
as for nxj_home i'm not sure why its needed but i guess it doesn't hurt to set it anyway
there can be only one so just set it to one path i.e `export NXJ_HOME=/opt/lejos_nxj`
and the $path stays otherwise you wouldn't be able to just execute `nxj,...` and have it run as a command

Offline

#7 2008-05-07 20:55:32

jrick
Member
Registered: 2008-01-16
Posts: 27

Re: PKGBUILD for leJOS

Alright, everything is fixed and it's in the AUR now.


"Gentlemen! You can't fight in here! This is the war room!"
--President Merkin Muffley

Offline

Board footer

Powered by FluxBB