summaryrefslogtreecommitdiff
path: root/community/sfml/PKGBUILD
blob: ce1b6c0ff4bf6c10c4021f8a7570c17d74428ff5 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# $Id: PKGBUILD 23743 2010-08-16 10:49:18Z svenstaro $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: scj <scj archlinux us>

pkgname=sfml
pkgver=1.6
pkgrel=3
pkgdesc="A simple, fast, cross-platform and object-oriented multimedia API."
arch=('i686' 'x86_64' 'mips64el')
url="http://www.sfml-dev.org"
license=('custom:zlib')
depends=('libxrandr' 'libsndfile' 'openal' 'glew' 'libjpeg' 'libpng' 'soil' 'zlib' 'freetype2')
optdepends=('qt: build qt-sample' 'wxgtk: build wxwidgets-sample')
install=sfml.install
source=(http://downloads.sourceforge.net/${pkgname}/SFML-${pkgver}-sdk-linux-64.tar.gz
        use-system-libs.patch)
md5sums=('7a9b3a1ef6d14cd25090e440ccdbb3a8'
         '505ea908fb6e4b9359061d8d55373963')

build() {
  cd "${srcdir}/SFML-${pkgver}"

  # apply patch to use system libs in favor of included ones (fixes many problems)
  patch -Np1 < ../use-system-libs.patch

  # compile sfml
  make

  # prepare samples
  sed -e '/export LDFLAGS/d' -i samples/Makefile

  #check optional dependencies
  if [ ! -e "/usr/bin/wx-config" ]; then
    sed -e 's/wxwidgets-sample //' -i samples/Makefile
  fi 
  if [ ! -e "/usr/include/QtGui" ]; then
    sed -e 's/qt-sample //' -i samples/Makefile
  fi

  # fix some samples
  sed -e 's|qt4/||g' -i samples/qt/Makefile
  sed -e '/#include <iostream>/a\#include <stdlib.h>' -i \
    samples/sockets/Sockets.cpp \
    samples/voip/VoIP.cpp

  # fix the library softlinks for samples
  cd lib
  for lib in *; do
      ln -sf $lib ${lib/.${pkgver}/}
  done
  cd ..

  # compile samples
  LDFLAGS="-L${srcdir}/SFML-${pkgver}/lib" make sfml-samples
}

package() {
  cd "${srcdir}/SFML-${pkgver}"

  # prepare some dirs
  mkdir -p ${pkgdir}/usr/lib \
           ${pkgdir}/usr/include \
           ${pkgdir}/usr/share/sfml \
           ${pkgdir}/usr/share/doc \
           ${pkgdir}/opt/SFML

  # install it
  sed '/export DESTDIR/d' -i src/SFML/Makefile
  make DESTDIR="${pkgdir}/usr" install

  # fix the library softlinks - again
  cd ${pkgdir}/usr/lib
  rm *.so
  for lib in *; do
      ln -s $lib ${lib/.${pkgver}/}
  done
  cd "${srcdir}/SFML-${pkgver}"

  # install samples
  cp -r samples ${pkgdir}/opt/SFML/samples

  # install docs
  cp -r doc ${pkgdir}/usr/share/doc/sfml

  # handy symlinks
  cd ${pkgdir}/usr/share/sfml
  ln -s ../../../opt/SFML/samples samples
  ln -s ../doc/sfml docs

  # install license
  install -Dm 644 ${srcdir}/SFML-${pkgver}/license.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  
  # clean up
  find "${pkgdir}/opt/SFML/samples" -name "*.o" -delete
}
# vim:set ts=2 sw=2 et: