You are not logged in.

#1 2007-05-26 16:43:19

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

SpeedCrunch PKGBUILD questions

I've been wanting to learn more about making PKGBUILD files, and I found a small, non-trivial opportunity with SpeedCrunch. The current package for 64 bit in extra does not work (http://bugs.archlinux.org/task/7279), and rebuilding needed a lot of changes including switching up QT verions. I was able to do it, but I did at least one thing that I read was not recommended. Also, there was something I didn't figure out.

Original:

# $Id: PKGBUILD,v 1.8 2006/07/15 15:24:31 andyrtr Exp $
# Maintainer: damir <damir@archlinux.org>

 pkgname=speedcrunch
 pkgver=0.5.4
 pkgrel=2
 pkgdesc="a simple but powerful calculator using QT"
 arch=(i686 x86_64)
 depends=('qt>=3.2.0')

 source=(http://download.berlios.de/speedcrunch/$pkgname-$pkgver.tar.gz)
 url="http://speedcrunch.berlios.de/"

 md5sums=('03585bf96afd6b6b129e19b0ceee33c4')

 build() {
   cd $startdir/src/$pkgname-$pkgver
   export QMAKESPEC=/opt/qt/mkspecs/linux-g++
   ./configure --prefix=/opt/qt
   make || return 1
   make INSTALL_ROOT=$startdir/pkg install
 }

Edited:

 pkgname=speedcrunch
 pkgver=0.7
 pkgrel=1
 pkgdesc="a simple but powerful calculator using QT"
 arch=(i686 x86_64)
 depends=('qt4>=4.2.0')
 licence=('GPL')
 source=(http://speedcrunch.googlecode.com/files/$pkgname-$pkgver.tar.gz)
 url="http://speedcrunch.org/"
 md5sums=()

 build() {
   mkdir -p $startdir/pkg/usr/bin
   cd $startdir/src/$pkgname-$pkgver
   export QMAKESPEC=/opt/qt4/mkspecs/linux-g++
   ./configure --prefix=$startdir/pkg/opt/qt4
   make || return 1
   make INSTALL_DIR=$startdir/pkg install
   cp $pkgname $startdir/pkg/usr/bin   
 }

One thing I did here that isn't recommended is the configure line:

./configure --prefix=$startdir/pkg/opt/qt4

I don't really understand what the problem is here, so if someone felt like explaining it to me, and letting me know how I could have gone about this more cleanly, that would be great.

The other things I need to know are:

How would I go about making this code create a menu entry?

Is the way I handled the executable file sane?

   mkdir -p $startdir/pkg/usr/bin....
   cp $pkgname $startdir/pkg/usr/bin

Offline

#2 2007-05-26 17:17:43

tardo
Member
Registered: 2006-07-15
Posts: 526

Re: SpeedCrunch PKGBUILD questions

This worked for me. I highly suggest reading the README file included for build instructions.

pkgname=speedcrunch
pkgver=0.7
pkgrel=1
pkgdesc="a simple but powerful calculator using QT"
arch=(i686 x86_64)
depends=('qt4')
licence=('GPL')
source=(http://speedcrunch.googlecode.com/files/$pkgname-$pkgver.tar.gz)
url="http://speedcrunch.org/"
md5sums=('f646db54bf0500183d3883b43847bc13')

build() {
  cd $startdir/src/$pkgname-$pkgver
  source /etc/profile.d/qt4.sh
  cmake . -DCMAKE_INSTALL_PREFIX=/usr
  make || return 1
  make DESTDIR=$startdir/pkg install
}

Let me show you where you went astray.

depends=('qt4>=4.2.0')

README file requires qt4 greater than 4.0

md5sums=()

Generate this with makepkg -g

mkdir -p $startdir/pkg/usr/bin
cp $pkgname $startdir/pkg/usr/bin

Not required as make install handles this

export QMAKESPEC=/opt/qt/mkspecs/linux-g++

while not a bad idea, its better to switch to the qt4 profile instead, look at my source line

./configure --prefix=$startdir/pkg/opt/qt4

The README file doesn't use configure, it uses cmake. The reason we don't put $startdir/pkg there is because configure is going to assume that's the actual install path and configure the program/libraries accordingly. We don't want that.

To create a desktop entry you have two easy choices: the first being create a speedcrunch.desktop file and include it in the source (in which case you add the md5sum as well) or you can use simple bash commands to create it within the build() function but that tends to get ugly. Look at other PKGBUILDs which implement this or use any .desktop file on your system as a template.

The simple trick to creating PKGBUILDs is to build the pkg first manually. If you succeed, then the build() function will use (almost) the exact same commands you used.

Offline

#3 2007-05-26 17:25:09

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: SpeedCrunch PKGBUILD questions

Wow! I couldn't have asked for a better response. Thanks a lot for taking the time to do this.

Offline

#4 2007-06-01 13:18:20

elahav
Member
From: Ottawa, ON
Registered: 2005-04-18
Posts: 90

Re: SpeedCrunch PKGBUILD questions

I tried the PKGBUILD suggested by tardo. The build process failed during the cmake stage, complaining about the lack of 'qmake' (both qmake3 and qmake4 are installed on my system). I turns out that /etc/profile.d/qt4 appends /opt/qt4/bin to the path. However, this still leaves /opt/qt/bin in the path, preceding the new entry and causing cmake to find qmake3 first.
I corrected the problem by changing the profile script to prepend /opt/qt4/bin to the path rather than appending it.

Offline

Board footer

Powered by FluxBB