summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ccc5836ff7215ac1f6d461f4118b12b71de1f498 (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
# Maintainer: Ferdinand Bachmann <theferdi265@gmail.com>
# Community Package Maintainer: Maxime Gauduin <alucryd@gmail.com>
# Community Package Contributor: Gordin <gordin@koeln.ccc.de>

pkgname=wit-git
pkgver=3.03a
pkgrel=1
pkgdesc='Wiimms ISO Tools (git version)'
arch=(x86_64)
url=https://wit.wiimm.de
license=(GPL2)
depends=(
  bzip2
  fuse2
  glibc
  libncursesw.so
  zlib
)
makedepends=(
  clang
  git
)
optdepends=(
  'bash: Update titles lists'
  'wget: Update titles lists'
)
conflicts=(wit)
provides=(wit)
install=wit.install
source=(
  git+https://github.com/Wiimm/wiimms-iso-tools.git
  wit-makefile.patch
  wit-no-exec-stack.patch
  wit-titles.patch
)
b2sums=('SKIP'
        '2440f01dc499477b9c237d2bc6d9a6a712ac22887df022b6a84c6ec6ac9b095aa5944db6c5af9773a2e2446df6cc7774783c8cfd59ed815d9cb413ae8e1c0efb'
        'a9e615aac8ebafcf98079160f3e2140e1389e42baf7896a2fd845133e47ebcea9199eef847b84732d4dc4fec6107f45e96fb4ab3d4acf5421c88e02f3564eb62'
        '4e241a0c37fd2a082d4285d3685833e3805e35db829961183df02bb426d5679b62f8985f59604512b2615002faa28a9d8947ca9c6fc86a025bee5ab7bbf1bcf7')

prepare() {
  cd wiimms-iso-tools

  patch -Np1 -i ../wit-makefile.patch
  patch -Np1 -i ../wit-no-exec-stack.patch
  patch -Np1 -i ../wit-titles.patch
}

_not() {
  if "$@"; then
    return 1
  else
    return 0
  fi
}

_array_contains() {
  local haystack="$1[@]"
  local needle="$2"

  for value in "${!haystack}"; do
    if [[ "$value" == "$needle" ]]; then
      return 0
    fi
  done

  return 1
}

_incompatible_flags=( "-fvar-tracking-assignments" )
_clang_remove_incompatible_flags() {
  local newflags=
  for flag in $CFLAGS; do
    if _not _array_contains _incompatible_flags "$flag"; then
      newflags="$newflags $flag"
    fi
  done

  export CFLAGS="$newflags"
}

build() {
  _clang_remove_incompatible_flags
  make INSTALL_PATH="${pkgdir}/usr" CC=clang -C wiimms-iso-tools/project tools
  make INSTALL_PATH="${pkgdir}/usr" CC=clang -C wiimms-iso-tools/project doc
}

package() {
  _clang_remove_incompatible_flags
  make INSTALL_PATH="${pkgdir}/usr" CC=clang -C wiimms-iso-tools/project install
  install -Dm 644 wiimms-iso-tools/project/doc/*.txt -t "${pkgdir}"/usr/share/doc/wit/
}

# vim: ts=2 sw=2 et: