[aur-general] Updated PKGBUILD for redeclipse-svn

Arand Nash ienorand at gmail.com
Fri May 6 22:24:18 EDT 2011


Hello, I've written an updated version of the PKGBUILD for redeclipse-svn.
I've tested it only briefly on a headless system, more poking is welcome.
First time writing for AUR, input welcome.
Diff quoted, plain file attached.

I've sent it to the maintainer as well, but I thought it might fare well 
from more sets of eyes.

- arand


   PKGBUILD |  107 
++++++++++++++++++++++++++++++++++++++-------------------------
   1 file changed, 65 insertions(+), 42 deletions(-)

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,60 +1,83 @@
   # Contributor: J.W. Birdsong <jwbirdsongATgmailDOTcom>
+# Updated by Arand Nash <ienorand at gmail.com>
+# Based on the AUR package for version 1.0 by Massimiliano Torromeo 
<massimiliano.torromeo at gmail.com>
   pkgname=redeclipse-svn
-pkgver=2168
+# svn automagic seems to override the $pkgver anyways..
+pkgver=1.01SVN
   pkgrel=1
   pkgdesc="A single-player and multi-player first-person ego-shooter, 
built as a total conversion of Cube Engine 2, "
   arch=('i686' 'x86_64')
   url="http://redeclipse.net"
   license=('custom' 'ZLIB')
   depends=('sdl_image'  'libgl' 'sdl_mixer')
-makedepends=('subversion' 'mesa')
+makedepends=('subversion'  'mesa')
   provides=(redeclipse)
   conflicts=(redeclipse)
-source=(redeclipse.desktop 'redeclipse.patch')

   _svntrunk=https://redeclipse.svn.sourceforge.net/svnroot/redeclipse
   _svnmod=redeclipse
-md5sums=('d905ff937b097fd946e9e5b3113aee3c'
-         '09d8edaab64a382d3a818c210e423894')
-
+
   build() {
-  cd "$srcdir"
+	cd "$srcdir"

-  if [ -d $_svnmod/.svn ]; then
-    (cd $_svnmod && svn up -r $pkgver)
-  else
-    svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod
-  fi
-
-  msg "SVN checkout done or server timeout"
-  msg "Starting make..."
-
-  rm -rf "$srcdir/$_svnmod-build"
-  cp -r "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
-  cd "$srcdir/$_svnmod-build"
-
-  #
-  # BUILD
-  #
- cd "$srcdir"/${_svnmod}-build/src
-  make
-  make DESTDIR="$srcdir/" clean install
-
-cd ..
-install -d "$pkgdir"/usr/{share/$_svnmod/,}bin/
-  sed -i "s|RE_DATA=.|RE_DATA=/usr/share/$_svnmod|" $_svnmod.sh
-  patch -p2 < ../redeclipse.patch
-  install -m755 $_svnmod.sh "$pkgdir/usr/bin/$_svnmod"
-  install -m755 bin/re{server*,client*} "$pkgdir/usr/share/$_svnmod/bin/"
-  cp -rf  data/ "$pkgdir/usr/share/$_svnmod"
-
-  #  license and icons
-  install -Dm644 "$srcdir/$_svnmod.desktop" 
$pkgdir/usr/share/applications/$pkgname.desktop
-  install -Dm644 src/redeclipse.ico 
"$pkgdir/usr/share/pixmaps/$_svnmod.png"
-  install -Dm644 "$srcdir/$_svnmod-build/license.txt" 
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
-  rm -rf ${pkgdir}/usr/share/${_svnmod}/bin/re{server,client}_freebsd*
-  rm -rf ${pkgdir}/usr/share/${_svnmod}/bin/re{server,client}.exe
+	# update/checkout svn
+	if [ -d "$_svnmod"/.svn ]; then
+		msg "Updating existing SVN checkout"
+		(cd "$_svnmod" && svn up -r "$pkgver")
+	else
+		msg "New checkout from SVN"
+		svn co "$_svntrunk" --config-dir ./ -r "$pkgver" "$_svnmod"
+	fi
+
+	msg "SVN checkout done (or server timeout)"
+	msg "SVN export to clean build directory"
+
+	# export to get rid of .svn metadata
+	rm -rf "$srcdir/$pkgname"
+	svn export "$srcdir/$_svnmod" "$srcdir/$pkgname"
+
+	msg "Starting make..."
+
+	# build in exported directory
+	cd "$srcdir/$pkgname/src"
+	make
   }

-# vim:set ts=2 sw=2 et:
+package() {
+	cd "$srcdir/$pkgname"

+	# create directories
+	install -d "$pkgdir"/usr/{share/"$pkgname",}/bin
+	# this isn't really necessary since we use a custom script anyways
+	sed -i "s|RE_DATA=.|RE_DATA=/usr/share/$pkgname|" "redeclipse.sh"
+
+	# install binaries
+	install -m755 src/re{server,client} "$pkgdir/usr/share/$pkgname/bin/"
+	# install data
+	cp -rf  data/ "$pkgdir/usr/share/$pkgname"
+
+	# create wrapper scripts for client and server
+	cat <<EOF > "$pkgdir/usr/bin/$pkgname"
+#!/bin/sh
+RE_OPTIONS="-r"
+cd "/usr/share/$pkgname"
+exec bin/reclient ${RE_OPTIONS} ${1+"$@"}
+# ${1+"$@"} is a portability hack, keyword "wrapper script"
+EOF
+
+	cat <<EOF > "$pkgdir/usr/bin/$pkgname-server"
+#!/bin/sh
+RE_OPTIONS=""
+cd "/usr/share/$pkgname"
+exec bin/reserver ${RE_OPTIONS} ${1+"$@"}
+# ${1+"$@"} is a portability hack, keyword "wrapper script"
+EOF
+
+	chmod 755 "$pkgdir/usr/bin/$pkgname"
+	chmod 755 "$pkgdir/usr/bin/$pkgname-server"
+
+	# install desktop file, icon, license
+	install -Dm644 src/install/nix/redeclipse.desktop 
"$pkgdir/usr/share/applications/$pkgname.desktop"
+	install -Dm644 src/redeclipse.ico "$pkgdir/usr/share/pixmaps/$pkgname.png"
+	install -Dm644 license.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: PKGBUILD
URL: <http://mailman.archlinux.org/pipermail/aur-general/attachments/20110507/5d9b9434/attachment.ksh>


More information about the aur-general mailing list