summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 858a2d1972dffdbc87da240d1eaf01df378df132 (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
# Maintainer:
# Contributor: Frederic Bezies < fredbezies at gmail dot com >
# Contributor: aimileus < me at aimileus dot nl >

## links
# http://0ldsk00l.ca/nestopia/
# https://github.com/0ldsk00l/nestopia

## options
: ${_build_clang:=true}

_pkgname="nestopia"
pkgname="$_pkgname-git"
pkgver=1.53.1.r0.g80f335a
pkgrel=2
pkgdesc="High-accuracy NES/Famicom emulator"
url="https://github.com/0ldsk00l/nestopia"
license=('GPL-2.0-only')
arch=('x86_64')

depends=(
  fltk
  libarchive
  libepoxy
  libsamplerate
  sdl2
  zlib
)
makedepends=(
  autoconf-archive
  git
)

[[ "${_build_clang::1}" == "t" ]] && makedepends+=('clang' 'lld')

provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
    | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}

prepare() {
  # glu is not technically needed
  # create dummy archive for ld to find
  echo '!<arch>' > libGLU.a
}

build() {
  export CXXFLAGS LDFLAGS
  CXXFLAGS=${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}

  local _ldflags=(${LDFLAGS})
  LDFLAGS="${_ldflags[@]//*fuse-ld*/} -L${srcdir@Q}"

  if [[ "${_build_clang::1}" == "t" ]]; then
    export CXX LDFLAGS
    CXX=clang++
    LDFLAGS+=" -fuse-ld=lld"
  fi

  cd "$_pkgsrc"
  autoreconf -fi
  ./configure --prefix=/usr
  make
}

package() {
  make -C "$_pkgsrc" install DESTDIR="$pkgdir"
}