You are not logged in.

#1 2006-11-22 02:40:10

robb_force
Member
Registered: 2006-11-10
Posts: 29

Daphne (laserdisc emulator) PKGBUILD

Please take a look at my PKGBUILD and tell me if it works for you or if it was done correctly. I'm still new to building packages and could use some tips. smile Thanks.

PKGBUILD:

#contributor: robb_force <robb_force>

pkgname=daphne
pkgver=0.99.7
pkgrel=1
pkgdesc="A command line multiple arcade laserdisc emulator."
url="http://www.daphne-emu.com/"
license="GPL"
depends=('sdl>=1.2' 'sdl_mixer' 'libogg' 'libvorbis' 'zlib')
makedepends=('gcc')
source=(http://www.daphne-emu.com/download/${pkgname}-${pkgver}c-src.tar.gz 
        daphne.sh)
md5sums=('a5deaf0a8ceb4c22bdb7afd64db118d6' 'cb71f132faf3e1575fda953a4ebf4430')

build()
{
  # Build the vldp2 library
  cd ${startdir}/src/${pkgname}/src/vldp2
  ./configure --prefix=/usr
  make -f Makefile.linux || return 1

  # Build daphne after fixing a couple of variables
  cd ${startdir}/src/${pkgname}/src
  sed -e 's|bool pioneer::getstring|bool getstring|' 
    -i ldp-out/pioneer.h
  sed -e 's|void lgp::draw_8x8|void draw_8x8|' 
    -i game/lgp.h
  cp Makefile.vars.linux_x86 Makefile.vars
  make || return 1

  # Install the library in /usr/lib and the application in opt
  cd ${startdir}/src/${pkgname}
  install -Dm644 libvldp2.so ${startdir}/pkg/usr/lib/${pkgname}/libvldp2.so
  install -Dm755 ${startdir}/src/daphne.sh ${startdir}/pkg/usr/bin/daphne
  install -Dm755 ${pkgname} ${startdir}/pkg/opt/${pkgname}/${pkgname}
  install -d ${startdir}/pkg/opt/${pkgname}/{pics,sound}
  install -m644 pics/* ${startdir}/pkg/opt/${pkgname}/pics/
  install -m644 sound/* ${startdir}/pkg/opt/${pkgname}/sound/
}

daphne.sh

#!/bin/sh

if [ ! -e $HOME/.daphne ]; then
  echo "Running Daphne for the first time..."
  echo "Copy your framefiles/roms/mpegs to the corresponding folders"
  echo "within $HOME/.daphne"
  mkdir $HOME/.daphne
  mkdir $HOME/.daphne/framefile
  mkdir $HOME/.daphne/roms
  mkdir $HOME/.daphne/mpegs
  cd /opt/daphne
  ./daphne "$@"
else
  cd /opt/daphne
  ./daphne "$@"
fi

Offline

#2 2006-11-22 18:03:30

robb_force
Member
Registered: 2006-11-10
Posts: 29

Re: Daphne (laserdisc emulator) PKGBUILD

I rewrote parts of the PKGBUILD:

#contributor: robb_force <robb_force>

pkgname=daphne
pkgver=0.99.7
pkgrel=1
pkgdesc="A command-line multiple arcade laserdisc emulator."
url="http://www.daphne-emu.com/"
license="GPL"
depends=('sdl>=1.2' 'sdl_mixer' 'libogg' 'libvorbis' 'zlib')
makedepends=('gcc')
source=(http://www.daphne-emu.com/download/${pkgname}-${pkgver}c-src.tar.gz 
        daphne.sh)
md5sums=('a5deaf0a8ceb4c22bdb7afd64db118d6' '69f9673e58bde4514683722bc165e9ca')

build()
{
  # Build the vldp2 library
  cd ${startdir}/src/${pkgname}/src/vldp2
  ./configure --prefix=/usr
  make -f Makefile.linux || return 1

  # Build daphne after fixing a couple of variables
  cd ${startdir}/src/${pkgname}/src
  sed -e 's|bool pioneer::getstring|bool getstring|' 
    -i ldp-out/pioneer.h
  sed -e 's|void lgp::draw_8x8|void draw_8x8|' 
    -i game/lgp.h
  cp Makefile.vars.linux_x86 Makefile.vars
  make || return 1

  # Install the library and the application in opt
  cd ${startdir}/src/${pkgname}
  install -Dm755 ${startdir}/src/daphne.sh ${startdir}/pkg/usr/bin/daphne
  install -Dm755 ${pkgname} ${startdir}/pkg/opt/${pkgname}/${pkgname}
  install -m644 libvldp2.so ${startdir}/pkg/opt/${pkgname}/libvldp2.so
  install -d ${startdir}/pkg/opt/${pkgname}/{pics,roms/cputest,sound}
  install -m644 pics/* ${startdir}/pkg/opt/${pkgname}/pics/
  install -m644 roms/cputest/* ${startdir}/pkg/opt/${pkgname}/roms/cputest/
  install -m644 sound/* ${startdir}/pkg/opt/${pkgname}/sound/
}

and the daphne.sh script:

!/bin/sh

if [ ! -e $HOME/.daphne ]; then
  echo "Running Daphne for the first time..."
  echo "Copy your framefiles/roms/mpegs to the corresponding folders"
  echo "within $HOME/.daphne and reference them from the command-line."
  echo "Ex: daphne lair vldp -framefile '~/.daphne/framefile/lair.txt'"
  mkdir $HOME/.daphne
  mkdir $HOME/.daphne/{roms,mpegs}
  cp -R /opt/daphne/roms/* $HOME/.daphne/roms
  cd /opt/daphne
  ./daphne "$@"
else
  cd /opt/daphne
  ./daphne "$@"
fi

This package compiles and installs fine, but I would like some feedback on my approach.

Additionally, I think there may be too many optimizations in the makefiles for the library or the emulator itself. Everything does compile, but I get strange errors when trying to run a game. I'm thinking about removing the hard coded optimizations. Any suggestions?

Offline

#3 2006-11-22 20:50:01

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Daphne (laserdisc emulator) PKGBUILD

2 questions  :
- why /opt  instead of /usr/share to install this  ?
- you're installing the vldp lib in /opt/$pkgname , but setting the prefix to /usr .  This seems weird.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2006-11-22 21:27:42

robb_force
Member
Registered: 2006-11-10
Posts: 29

Re: Daphne (laserdisc emulator) PKGBUILD

1) I reviewed the "cube" package and noticed it was installed to opt with a script that runs the executable, but the directory is also writable for the games group. Since my script is copying/creating directories in the $HOME folder should I store the files and executable in /usr/share?

2) I screwed this up. Originally I wanted to install the library in /usr/lib, but daphne wasn't able to find the library. It only seems to find it if it's in the same folder as the daphne executable. I'm sure I'm missing a step to make it see the library. I'm still new to linux. If it's in opt or share ... the prefix should be prefix=/opt or?

Thanks for your comments, I still need to learn a lot more about linux and arch packages.

Offline

#5 2006-11-22 22:19:30

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Daphne (laserdisc emulator) PKGBUILD

See Arch_Packaging_Standards#Directories for basic guidelines on where to put what.

I'm inclined towards putting this program in /usr/share/$pkgname .

I'm not sure but if moving libvldp2.so file to the daphne directory works, it doesn't seem to matter much what prefix is set at.
I'd place the install command for the library in the same part of the PKGBUILD, but that's a personal preference.

I've looked at the makefiles and think the problems during running might come from the DLAGS they use.
Almost all Arch packages use "-march=i686 -O2 -pipe" as compile flags.

From the look of things the authors of the code need to learn a bit about using configure/make/install or the modern successor scons .
It's not uncommon that the tough part in creating a PKGBUILD is fixing hard-coded parts of the source code.

1 last comment : gcc is so common for an arch installation that it's rarely put in makedepends.

All in all , i'd say this is a good PKGBUILD.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#6 2006-11-23 09:01:53

robb_force
Member
Registered: 2006-11-10
Posts: 29

Re: Daphne (laserdisc emulator) PKGBUILD

Thank you for your help. I had to give up on compiling this. It would compile fine,  but I could never get it to actually load the mpegs correctly. I tried removing all optimizations with no change. I went with using the linux binary instead. It should be compiled for i686 anyway.

I modified the PKGBUILD to install in usr/share/ like you suggested and submitted it to the AUR. Thanks again!

Offline

#7 2006-11-23 13:28:20

djscholl
Member
From: Michigan, USA
Registered: 2006-05-24
Posts: 56

Re: Daphne (laserdisc emulator) PKGBUILD

This is a relatively minor point, but your depends array is not in compliance with the standards. You apparently filled it in based on the compilation information in the source tarball, which is a good starting place. However, this often leads to redundant items, since you shouldn't list items that are required by other items present in the list. For example, libvorbis requires libogg, so libogg can be removed from the depends list of daphne. I find the easiest way to sort these dependencies out is to start with the complete list, as you have done, and then run "namcap" against your Arch package, i.e.,

$ namcap daphne-0.99.7-1.pkg.tar.gz 
daphne     E: Dependency detected and not included (gcc) from files ['usr/share/daphne/daphne']
daphne     W: Dependency included but already satisfied (sdl)
daphne     W: Dependency included but already satisfied (libogg)
daphne     W: Dependency included but already satisfied (libvorbis)

This tells us that you can remove sdl, libogg, and libvorbis. Checking with "pacman -Qi sdl_mixer", we can confirm that these are already required by sdl_mixer. The namcap script is not foolproof, but one of the things it does well is chew through the dependencies of your installed packages and find any redundant depends items. It doesn't seem to account for how likely Arch users are to already have a particular package, as Lone Wolf has done, so it mentions the absence of gcc.

Offline

#8 2006-11-30 20:42:31

robb_force
Member
Registered: 2006-11-10
Posts: 29

Re: Daphne (laserdisc emulator) PKGBUILD

Thanks for the tip! I updated the PKGBUILD by removing the redundant dependencies. I got Dragon's Lair and Space Ace set up and they play very well in Daphne on Arch.

Daphne package

Offline

Board footer

Powered by FluxBB