VCS package guidelines

From ArchWiki
Revision as of 10:51, 24 July 2005 by Dibblethewrecker (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Packaging CVS and SVN files using makepkg

This is actually very easy and doesn't require any special knowledge. However, the more you know about cvs and svn the easier it is. Many people introduce custom variables into the PKGBUILD that can over complicated things. These are not really necessary but do help to clarify the syntax of the cvs/svn commands, which can appear quite complex.

Here are a few tips

  • When using/defining the cvsroot use anonymous:@ rather than anonymous@ to avoid having to press enter to give blank password OR anonymous:password@ - if a password is required.
  • cvs and svn PKGBUILDs may not require a source or md5sum array but 'must still be included in the PKGBUILD but maybe left blank:
source=()
md5sums=()
  • don't forget to include cvs or svn in makedepends= as necessary
  • to preserve the integrity of the checked out code it is usually possible to build in a separate build dir e.g. having checked out source code to src/$_cvsmod from $startdir you can use:
  mkdir src/$_cvsmod-build

  cd src/$_cvsmod-build
  ../$_cvsmod/configure

OR if that fails you can try:

  cp -r src/$_cvsmod src/$_cvsmod-build
  cd src/$_cvsmod-build
  • With the introduction of the AUR it is most important to avoid using backtick execution to create pkg variables
    • For cvs pkgs you should avoid pkgver=`date +%y%m%d` - this also inteferes with the functionality of the AUR. Instead it is still possible to use a date format for the $pkgver variable and to use teh cvs -D option to check out code from that date
    • For svn you can use the revision number


Here is a PKGBUILD for ffmpeg-cvs that utilizes some of the tips above. The PKGBUILD can be found in UNSUPPORTED

# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org

pkgname=ffmpeg-cvs
pkgver=20050708
pkgrel=1
pkgdesc="A complete solution to record, convert and stream audio and video. It includes libavcodec. This will checkout and package the latest CVS version."
url="http://ffmpeg.sourceforge.net/"
license=
depends=('lame' 'esd' 'libogg' 'imlib2' 'sdl' 'libvorbis' 'a52dec' 'faad2' 'faac' 'pth')
provides=('ffmpeg')
conflicts=('ffmpeg')
makedepends=('cvs')

_cvsroot=":pserver:anonymous:@mplayerhq.hu:/cvsroot/ffmpeg"
_cvsmod="ffmpeg"

build() {
  cd $startdir/src
  msg "Connecting to mplayerhq.hu CVS server...."
  cvs -z9 -q -d $_cvsroot co -D 2005-07-08 -f $_cvsmod

  msg "CVS checkout done or server timeout"
  msg "Starting make..."

  rm -r ./$_cvsmod-build
  cp -r ./$_cvsmod ./$_cvsmod-build
  cd ./$_cvsmod-build

  ./configure \
  --prefix=/usr \
  --enable-gpl \
  --enable-mp3lame \
  --enable-vorbis \
  --enable-pp \
  --enable-faac \
  --enable-faad \
  --enable-a52 \
  --enable-shared \
  --enable-libogg \
  --enable-pthreads
  make || return 1
  make prefix=$startdir/pkg bindir=$startdir/pkg/usr/bin mandir=$startdir/pkg/usr/man install || return 1

  cd $startdir/src/$_cvsmod-build/libavcodec/libpostproc
      # libpostproc.a:
  make || return 1
  make prefix=$startdir/pkg/usr \
          install || return 1
      # libpostproc.so:
  make SHARED_PP="yes" || return 1
  make prefix=$startdir/pkg/usr \
       SHARED_PP="yes" \
       install || return 1
}
# vim:syntax=sh