You are not logged in.

#1 2010-01-19 10:13:59

csslayer
Member
Registered: 2009-03-05
Posts: 84

[Suggestion] About git,svn package

I recently want to use git pacakge to get 3d enable on my machine, but I found that it is hard to change git package to the normal one even if normal one updates.

So I hope PKGBUILD can make package version like this way: [offical version].git[git verseion]
like mesa-git:
mesa-7.7.git20100118

so when mesa is updated to 7.8, we can also change it to the offical version with a simple yaourt -Syu.

This can be done like following:

pkgbase="mesa-git"
pkgname=('mesa' 'libgl' 'ati-dri')
pkgver=20100119
_realver=7.7
pkgrel=1
arch=(i686 x86_64)
depends=('libx11>=1.2' 'libxt' 'gcc-libs>=4.3.3' 'libdrm>=2.4.12')
makedepends=('glproto' 'pkgconfig' 'libdrm>=2.4.12' 'libxxf86vm' 'libxdamage' 'expat>=2.0.1' 'libx11>=1.2.2' 'libxt' 'gcc-libs' 'dri2proto')
url="http://mesa3d.sourceforge.net"
license=('custom')
options=(!makeflags)
source=(ftp://ftp.archlinux.org/other/mesa/gl-manpages-1.0.1.tar.bz2
    mesa-7.1-link-shared.patch
        LICENSE)

export gitver=$pkgver
_gitroot="http://anongit.freedesktop.org/git/mesa/mesa.git"
_gitname="mesa"

build() {

 msg "Connecting to git.freedesktop.org GIT server...."

  if [ -d ${srcdir}/$_gitname ] ; then
  cd $_gitname && git pull origin
  msg "The local files are updated."
  else
  git clone $_gitroot
  fi

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

    if [[ -d ${srcdir}/${_gitname}-build ]]; then
       msg "Cleaning the previous build directory..." 
       rm -rf ${srcdir}/${_gitname}-build
    fi

    cp -pR ${srcdir}/${_gitname} ${srcdir}/${_gitname}-build
    
    cd ${srcdir}/${_gitname}-build
    msg "Starting configure..."

    msg "Applying patches..."
#      patch -Np1 -i "${startdir}/mesa-7.1-link-shared.patch" || return 1

  ./autogen.sh --prefix=/usr \
    --with-dri-driverdir=/usr/lib/xorg/modules/dri \
    --with-dri-drivers=swrast,radeon,r200,r300,r600 \
    --enable-gallium \
    --enable-gallium-radeon \
    --disable-gallium-intel \
    --with-state-trackers=dri,egl \
    --enable-glx-tls \
    --with-driver=dri \
    --enable-xcb \
    --disable-glut || return 1

  make || return 1

  cd "${srcdir}/gl-manpages-1.0.1"
  ./configure --prefix=/usr || return 1
  make || return 1
}

package_mesa() {
  pkgver="${_realver}.git$gitver"
  depends=('libgl' 'libx11>=1.2.2' 'libxt' 'gcc-libs>=4.4.1' 'dri2proto=2.2' 'libdrm>=2.4.15')
  pkgdesc="Mesa 3-D graphics libraries and include files"

  cd "${srcdir}/${_gitname}-build" || return 1
  make DESTDIR="${pkgdir}" install || return 1
  install -m755 -d "${pkgdir}/usr/bin"
  install -m755 progs/xdemos/glx{gears,info} "${pkgdir}/usr/bin/" || return 1

  rm -f "${pkgdir}/usr/lib/libGL.so"*
  rm -rf "${pkgdir}/usr/lib/xorg"
  rm -f "${pkgdir}/usr/include/GL/glew.h"
  rm -f "${pkgdir}/usr/include/GL/glxew.h"
  rm -f "${pkgdir}/usr/include/GL/wglew.h"
  rm -f "${pkgdir}/usr/include/GL/glut.h"

  cd "${srcdir}/gl-manpages-1.0.1" || return 1
  make DESTDIR="${pkgdir}" install || return 1

  install -m755 -d "${pkgdir}/usr/share/licenses/mesa"
  install -m755 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa/" || return 1
}

package_libgl() {
  pkgver="${_realver}.git$gitver"
  depends=('libdrm>=2.4.15' 'libxxf86vm' 'libxdamage' 'expat>=2.0.1')
  pkgdesc="Mesa 3-D graphics library and DRI software rasterizer"

  cd "${srcdir}/${_gitname}-build" || return 1
  install -m755 -d "${pkgdir}/usr/lib" || return 1
  install -m755 -d "${pkgdir}/usr/lib/xorg/modules/extensions"

  bin/minstall lib/libGL.so* "${pkgdir}/usr/lib/" || return 1

  cd src/mesa/drivers/dri
  make -C swrast DESTDIR="${pkgdir}" install || return 1
#  install -m755 libdricore.so "${pkgdir}/usr/lib/xorg/modules/dri/" || return 1
  ln -s libglx.xorg "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so" || return 1

  install -m755 -d "${pkgdir}/usr/share/licenses/libgl"
  install -m755 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libgl/" || return 1
}

package_ati-dri() {
  pkgver="${_realver}.git$gitver"
  depends=("libgl=${pkgver}")
  pkgdesc="Mesa DRI drivers for AMD/ATI Radeon"
  conflicts=('xf86-video-ati<6.9.0-6')

  cd "${srcdir}/${_gitname}-build/src/mesa/drivers/dri" || return 1
  make -C radeon DESTDIR="${pkgdir}" install || return 1
  make -C r200 DESTDIR="${pkgdir}" install || return 1
  make -C r300 DESTDIR="${pkgdir}" install || return 1
  make -C r600 DESTDIR="${pkgdir}" install || return 1
  
  cd "${srcdir}/${_gitname}-build/src/gallium/winsys/drm/radeon/egl"
  make DESTDIR="${pkgdir}" install || return 1
}
md5sums=('6ae05158e678f4594343f32c2ca50515'
         'd892b4fbc37fadc0e07debcd4bdfa109'
         '7ba429de367a2b3d273d2230cc705771')

As you can see, gitver is set to be pkgver and for each package, its pkgver is set to "${_realver}.git$gitver", so we can also get the feature from makepkg ver update, and make packages of simple git version .
we will get libgl-7.7.git20100119-1-i686.pkg.tar.gz mesa-7.7.git20100119-1-i686.pkg.tar.gz ati-dir-7.7.git20100119-1-i686.pkg.tar.gz from the pkgbuild before.

And for a package don't need split, a dumb pacakage must be added in pkgname, like following one:

pkgbase=libdrm-git
pkgname=("libdrm" "dumb")
pkgver=20100119
_realver=2.4.17
pkgrel=1
pkgdesc="Userspace interface to kernel DRM services"
arch=('i686' 'x86_64')
depends=('glibc')
options=('!libtool')
url="http://dri.freedesktop.org/"
license=('custom')
replaces=('libdrm>=2.4.12')
groups=('xorg')
source=(no-pthread-stubs.patch)
md5sums=()

export gitver=$pkgver
_gitroot="http://anongit.freedesktop.org/git/mesa/drm.git"
_gitname="drm"

build() {

 msg "Connecting to git.freedesktop.org GIT server...."

  if [ -d $srcdir/$_gitname ] ; then
  cd $_gitname && git pull origin
  msg "The local files are updated."
  else
  git clone $_gitroot
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."
    if [[ -d ${srcdir}/${_gitname}-build ]]; then
       msg "Cleaning the previous build directory..." 
       rm -rf ${srcdir}/${_gitname}-build
    fi

    
  git clone ${srcdir}/${_gitname} ${srcdir}/${_gitname}-build
    
  cd ${srcdir}/${_gitname}-build
        

cd $srcdir/$_gitname-build

  patch -Np1 -i "${srcdir}/no-pthread-stubs.patch" || return 1
  sh autogen.sh --prefix=/usr \
  --enable-nouveau-experimental-api \
  --enable-radeon-experimental-api \
  --enable-udev || return 1 
  make || return 1
}

package_libdrm()
{
  pkgver=${_realver}.git${gitver}
  cd ${srcdir}/${_gitname}-build
  make DESTDIR=${pkgdir} install || return 1
}

package_dumb()
{
    echo a
}

md5sums=('9b5ec3bbebe86921e2057694c42f65b8')

Offline

Board footer

Powered by FluxBB