summaryrefslogtreecommitdiff
path: root/pkg/archlinux/mingw-w64-waffle/PKGBUILD
blob: c563948536169a06da2c077f3158dd48876acc1d (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
# Maintainer: Chad Versace <chad.versace@linux.intel.com>

pkgname='mingw-w64-waffle'
pkgver='1.3.0'
pkgrel=1
pkgdesc='a library for choosing window system and OpenGL API at runtime (mingw-w64)'
arch=('any')
url='http://waffle-gl.github.io'
license=('BSD')

depends=(
  'mingw-w64-crt>=3.1.0-3'
  )
makedepends=(
  'mingw-w64-cmake'

  # For building the docs.
# XXX: Add as soon as we enable docs/manpages
#  'libxslt'
#  'docbook-xsl'

  )

options=('!strip' '!buildflags' 'staticlibs')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

if [[ ! -v _srcroot ]]; then
  msg "Environment variable _srcroot is unset"
  msg "Fall back to using git worktree for _srcroot ..."
  _srcroot="$(git rev-parse --show-toplevel)" || exit
  msg "Using _srcroot=$_srcroot"
fi

build() {
  unset LDFLAGS
  cd "${_srcroot}"
  msg "Building mingw-w64-waffle for cross-building"
  for _arch in ${_architectures}; do
    mkdir -p build-${_arch} && pushd build-${_arch}
    ${_arch}-cmake .. \
      -DCMAKE_INSTALL_PREFIX=/usr/${_arch} \
      -DCMAKE_INSTALL_LIBDIR=/usr/${_arch}/lib \
      -DCMAKE_BUILD_TYPE=Release \
      \
      -Dwaffle_build_tests=0 \
      -Dwaffle_build_manpages=0 \
      -Dwaffle_build_htmldocs=0 \
      -Dwaffle_build_examples=1
    make
    popd
  done

  # There should be a better way to do this
  msg "Building mingw-w64-waffle for native builds"
  for _arch in ${_architectures}; do
    mkdir -p "build-${_arch}-win" && pushd "build-${_arch}-win"
    ${_arch}-cmake .. \
      -DCMAKE_INSTALL_PREFIX="" \
      -DCMAKE_INSTALL_LIBDIR="lib" \
      -DCMAKE_BUILD_TYPE=Release \
      \
      -Dwaffle_build_tests=0 \
      -Dwaffle_build_manpages=0 \
      -Dwaffle_build_htmldocs=0 \
      -Dwaffle_build_examples=1
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
    cd "${_srcroot}/build-${_arch}"
    make DESTDIR="${pkgdir}" install
#    ${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
#    ${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
  done

  for _arch in ${_architectures}; do
    cd "${_srcroot}/build-${_arch}-win"
    # Create Windows zip archives
    make package
  done
}

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