summaryrefslogtreecommitdiff
path: root/pcr/kervalasquish-hg/PKGBUILD
blob: c9ca2e7cdcb7cf38e0b8d7d808a67072fa2aee9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Maintainer: Jorge Araya <jorgean@lavabit.com>

pkgname=kervalasquish-hg
pkgver=220
pkgrel=1
pkgdesc="Free Software DXT compression library, kervala's version"
arch=('i686' 'x86_64')
url="http://code.google.com/p/libsquish/"
license=('MIT')
makedepends=('mercurial' 'gcc-libs')
provides=('libsquish')
conflicts=('libsquish' 'kervala_libsquish-hg')

_hgroot="http://hg.kervala.net"
_hgrepo="packaging"
cmakerepo="cmake"

build() {
  cd "$srcdir"
  msg "Connecting to Kervala's Mercurial server for libsquish..."

  if [[ -d "$_hgrepo" ]]; then
    cd "$_hgrepo"
    hg pull -u
    msg "The local files are updated."
  else
    hg clone "${_hgroot}/${_hgrepo}"
  fi

  msg "Connecting to Kervala's Mercurial server for cmake modules..."

  if [[ -d $srcdir/$cmakerepo ]]; then
     cd $srcdir/$cmakerepo
     hg pull -u
     msg "The local files are updated."
  else
     cd $srcdir
     hg clone ${_hgroot}/${cmakerepo}
  fi

  msg "Mercurial checkout done or server timeout"
  msg "Starting build..."

  if [[ -d $_hgrepo-build ]]; then
     rm -rf "$srcdir/$_hgrepo-build"
  fi

  cp -r "$srcdir/$_hgrepo/squish" "$srcdir/$_hgrepo-build"

  if [[ ! -d $_hgrepo-build/CMakeModules ]]; then
     mkdir "$srcdir/$_hgrepo-build/CMakeModules"
     cp $srcdir/cmake/modules/common.cmake $srcdir/$_hgrepo-build/CMakeModules/
  fi

  if [[ -d $srcdir/$_hgrepo-build/build ]]; then
     rm -rf $srcdir/$_hgrepo-build/build
  fi

  mkdir "$srcdir/$_hgrepo-build/build"
  cd "$srcdir/$_hgrepo-build/build"
  cmake -DCMAKE_INSTALL_PREFIX=/usr ..
  make
}

package() {
  cd "$srcdir/$_hgrepo-build/build"
  make DESTDIR="${pkgdir}" install
}

# vim:set ts=2 sw=2 et: