You are not logged in.

#1 2008-05-12 18:17:27

Doc Angelo
Member
From: Germany
Registered: 2007-11-28
Posts: 52

My first PKGBUILD - Mumble

Hello,

i made my first PKGBUILD for the voice chat application Mumble, for which i am the new maintainer. There is a new version out for which i wrote this PKGBUILD and i changed a lot of the old PKGBUILD. I am not very sure if i did things the right way, as i am new to building and packaging applications. It would be nice, if somebody can look over this and warn me, if my PKGBUILD would break loose hell on other peoples machines.

##### PKGBUILD
# Contributor: Doc Angelo
pkgname=mumble
pkgver=1.1.4
pkgrel=1
pkgdesc="A voice chat application similar to TeamSpeak"
arch=('i686')
url="http://mumble.sourceforge.net/"
license=('GPL')
#groups=()
depends=('alsa-lib' 'qt>=4.3.0' 'libxevie' 'boost' 'sqlite3')
makedepends=('pkgconfig')
#provides=()
conflicts=('murmur')
#replaces=()
#backup=()
options=('!libtool')
install=mumble.install
source=("http://mesh.dl.sourceforge.net/sourceforge/mumble/$pkgname-$pkgver.tar.gz" \
    murmurd)
#noextract=()
md5sums=('06fdd23043fd987b2eb6b56913fac181' \
     '6d77b3da85af41da36b3de9c333137e1')

# build mumble and murmur
  /usr/bin/qmake main.pro CONFIG+=no-speechd || exit 1
  make || exit 1

# create directories and copy files
  install -m755 -D $startdir/murmurd $startdir/pkg/etc/rc.d/murmurd
  install -m755 -D ./release/mumble $startdir/pkg/usr/bin/mumble
  install -m755 -D ./scripts/mumble-overlay $startdir/pkg/usr/bin/mumble-overlay
  install -m755 -D ./release/murmurd $startdir/pkg/usr/sbin/murmurd
  install -m755 -d $startdir/pkg/usr/lib/mumble/plugins
  install -m755 -D ./release/libmumble* $startdir/pkg/usr/lib/mumble/
  install -m755 -D ./release/plugins/liblink.so $startdir/pkg/usr/lib/mumble/plugins/
  install -m755 -d $startdir/pkg/usr/share/applications
  install -m644 -D ./scripts/mumble.desktop $startdir/pkg/usr/share/applications/
  install -m755 -d $startdir/pkg/usr/share/man/man1
  install -m644 -D ./man/mu* $startdir/pkg/usr/share/man/man1/
  install -m644 -D ./icons/mumble.16x16.png $startdir/pkg/usr/share/icons/hicolor/16x16/apps/mumble.png
  install -m644 -D ./icons/mumble.32x32.png $startdir/pkg/usr/share/icons/hicolor/32x32/apps/mumble.png
  install -m644 -D ./icons/mumble.48x48.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps/mumble.png
  install -m644 -D ./icons/mumble.64x64.png $startdir/pkg/usr/share/icons/hicolor/64x64/apps/mumble.png
  install -m755 -d $startdir/pkg/var/lib/murmurd

  # copy and modify murmur.ini
  sed 's|database=|database=/var/lib/murmurd/murmurd.sqlite|g;s|#logfile=murmur.log|logfile=/var/log/murmurd/murmurd.log|g' ./scripts/murmur.ini > ./scripts/murmurd.ini
  install -m644 -D ./scripts/murmurd.ini $startdir/pkg/etc/
  rm ./scripts/murmurd.ini
}

Mumble includes "Murmur", the server for Mumble clients. It is possible to build only Murmur (which could be an other AUR package in the future.) For that case Mumble (+Murmur included) conflicts with "murmur". Murmur depends on "sqlite3" out of the box, but it can be used with another database. Should "sqlite3" then be considered as a optional dependency?

For this time, i build mumble without speechd (TextToSpeech), because i think this needs speechd to compile, but speechd has no arch package. Then the files are installed into the package directory. In the old PKGBUILD the files were all installed in "/opt/mumble"" and in "/opt/murmur/". I changed the locations for the files, as i consider it more correct.

Then i modify the included "murmur.ini" with sed, to reflect the new file locations and install it to "murmurd.ini", because its the config file for "murmurd". The database file and the log file, which "murmurd" will create on its first start, will be also "murmurd.(sqlite/log)", the default file names hardcoded in Murmur would be with out the "d".

If somebody has comments on my usage of "install", the locations and renaming of the files, please go on.

##### mumble.install
# arg 1:  the new package version
pre_install() {
  /bin/true
}

post_install() {
  echo ''
  echo 'to enable push-to-talk you need to add to your xorg.conf:'
  echo 'Section "Extensions"'
  echo '  Option "XEVIE" "Enable"'
  echo 'EndSection'
  echo ''
  echo 'To set the default SuperUser password:'
  echo 'murmurd -supw <password>'
  echo ''

}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
  # Backup murmur.ini and murmur.sqlite
  cp /opt/murmur/bin/murmur.ini ~/murmur.ini.temp
  if [ -f /opt/murmur/bin/murmur.sqlite ]; then
    mv /opt/murmur/bin/murmur.sqlite ~/murmur.sqlite.temp
  fi
}

post_upgrade() {
  echo ''
  # Remove old directorys, if empty (is this really necessary?)
#  rm /opt/murmur/bin
#  rm /opt/murmur
  # move old murmur.ini and change it according to the new file positions
  sed 's|database=.*$|database=/var/lib/murmurd/murmurd.sqlite|g;s|^.*logfile=.*$|logfile=/var/log/murmurd.log|g' ~/murmur.ini.temp > /etc/murmurd.ini
  rm ~/murmur.ini.temp
  # Move old database to the new position
  if [ -f ~/murmur.sqlite.temp ]; then
    mv ~/murmur.sqlite.temp /var/lib/murmurd/murmurd.sqlite
    echo 'The database file is now in /var/lib/murmurd'
  fi
  echo 'The configuration file is now in /etc'
  echo 'The log file is now in /var/log'
  echo ''
}

# arg 1:  the old package version
pre_remove() {
  /bin/true
}

# arg 1:  the old package version
post_remove() {
  /bin/true
}

op=$1
shift
$op $*

On upgrade i backup the config and database files. Then i modify and rename the existent murmur.ini. Then the same with the default "murmur.sqlite". This will only work, if the user didnt use an other "murmur.sqlite" in an other location. I could scan the old "murmur.ini" for the location of the database file, but is it maybe better, to let the user make this modifications and tell that in post_upgrade()? Example:

The configuration file is now in /etc/murmurd.ini.
Please copy any custom settings to this file.
The database file is now in /var/lib/murmurd/murmurd.sqlite.
Please copy any custom database file to this directory.

EDIT:
/etc/murmurd.ini should have attributes 644 instead of 755, corrected above
EDIT²:
Added qmake and make in the PKGBUILD

Last edited by Doc Angelo (2008-05-13 08:30:48)

Offline

#2 2008-05-12 22:57:16

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: My first PKGBUILD - Mumble

Few points:

I think the make part should be in the PKGBUILD? Also I cannot find murmurd file?

Suggestion: You could just add /opt/murmur/bin/murmur.ini and /opt/murmur/bin/murmur.sqlite to backup array of the PKGBUILD. Add also the new locations of these files and after some time you can remove those old paths.

Suggestion: Put information to the install file of the new file paths. People know howto clean up /opt/mumble after copying the ini and sqlite files from there. They know howto edit ini files to correct the paths too.

No need to "rm ./scripts/murmurd.ini"

btw: I cannot build mumble 1.1.4. It crashes on missing file, "TextToSpeech_unix.cpp:34:24: error: libspeechd.h: No such file or directory"

Offline

#3 2008-05-13 08:29:20

Doc Angelo
Member
From: Germany
Registered: 2007-11-28
Posts: 52

Re: My first PKGBUILD - Mumble

Oops, the make part somehow didnt survided copy&paste. In this part you see, that i am not using TextToSpeech ("CONFIG+=no-speechd"), which would lead to the error you get.

/usr/bin/qmake main.pro CONFIG+=no-speechd || exit 1
make || exit 1

So you say, that the murmurd.ini shouldnt be touched after upgrade? The people who changed the default file positions really would know, how to do this. But what with the people, which only started murmur without changing anything else? Hmm... wait, i remember something. The murmurd.ini must be modified after upgrade, or else it would create new (default).sqlite and (default).log in the default position, which is the directory of the executabel itself - not good.

Besides: What is happening, when i include those files in the "backup" array?

Last edited by Doc Angelo (2008-05-13 08:29:38)

Offline

#4 2008-05-13 11:42:34

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: My first PKGBUILD - Mumble

Yes you are right that murmur.ini should be modified.

You can find more information about the backup array from 'man pacman' or 'man PKGBUILD'.

I did some modifications to PKGBUILD and added two scripts. Here is my package Download mumble package files here. Feel free to use it or parts of it.

Offline

#5 2009-05-01 15:38:27

IsSuE
Member
Registered: 2006-04-29
Posts: 309

Re: My first PKGBUILD - Mumble

I cant build mumble. I always get this error:

make[2]: *** [qt_ja_jp.qm] Fehler 1                                                                                                                               
make[2]: Leaving directory `/tmp/yaourt-tmp-issue/aur-mumble/mumble/src/mumble-1.1.8/src/mumble'                                                                  
make[1]: *** [release] Fehler 2                                                                                                                                   
make[1]: Leaving directory `/tmp/yaourt-tmp-issue/aur-mumble/mumble/src/mumble-1.1.8/src/mumble'                                                                  
make: *** [sub-src-mumble-make_default-ordered] Fehler 2                                                                                                          
Error: Makepkg was unable to build mumble package.

read about that in AUR comments, but i found no help
any ideas?

Offline

#6 2009-05-01 20:11:45

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: My first PKGBUILD - Mumble

Your error message is too short, and please do not reopen a nearly one year old thread.

Offline

#7 2009-05-18 19:51:33

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: My first PKGBUILD - Mumble

....

Last edited by Purch (2009-05-19 15:09:07)

Offline

Board footer

Powered by FluxBB