summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 302c6429dee566f1c0cdd7444493d45ab79b2966 (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
pkgname=xenia-git
pkgver=r4173.09d16f4b
pkgrel=1
pkgdesc="Xenia is an experimental emulator for the Xbox 360."
arch=('x86_64')
url="http://xenia.jp"
license=('BSD')
depends=('gtk3' 'lz4' 'glew' 'libx11' 'libc++' 'yaml-cpp')
# TODO use installed premake5 instead of building it
# premake: powerpc patch added
makedepends=('python' 'clang' 'vulkan-headers' 'git' 'clang' 'libpthread-stubs' 'catch2')
provides=('xenia')
conflicts=('xenia')
# TODO: Use system installed deps for non-forked libs
source=("git+https://github.com/benvanik/xenia.git"
        "git+https://github.com/benvanik/binutils-ppc-cygwin"
        "git+https://github.com/xenia-project/capstone.git"
        "git+https://github.com/benvanik/gflags.git"
        "git+https://github.com/ocornut/imgui.git"
        "git+https://github.com/xenia-project/libav.git"
        "git+https://github.com/xenia-project/premake-core.git"
        "git+https://github.com/xenia-project/premake-export-compile-commands.git"
        "git+https://github.com/xenia-project/snappy.git"
        "git+https://github.com/xenia-project/SPIRV-Tools.git"
        "git+https://github.com/xenia-project/xbyak.git")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd "${srcdir}/${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${srcdir}/${pkgname%-git}"
  git submodule init
  git config submodule.third_party/binutils-ppc-cygwin.url $srcdir/binutils-ppc-cygwin
  git config submodule.third_party/capstone.url $srcdir/capstone
  git config submodule.third_party/catch.url $srcdir/Catch2
  git config submodule.third_party/gflags.url $srcdir/gflags
  git config submodule.third_party/imgui.url $srcdir/imgui
  git config submodule.third_party/libav.url $srcdir/libav
  git config submodule.third_party/premake-core.url $srcdir/premake-core
  git config submodule.third_party/premake-export-compile-commands.url $srcdir/premake-export-compile-commands
  git config submodule.third_party/snappy.url $srcdir/snappy
  git config submodule.third_party/spirv-headers.url $srcdir/SPIRV-Headers
  git config submodule.third_party/spirv-tools.url $srcdir/SPIRV-Tools
  git config submodule.third_party/xbyak.url $srcdir/xbyak
  git config submodule.third_party/yaml-cpp.url $srcdir/yaml-cpp
  git submodule update

  # FIXME: Currently the default /etc/makepkg.conf treat unused
  # results as warnings which causes build to fail
  sed -i 's,"FatalWarnings",--"FatalWarnings",g' premake5.lua

  # Manual submodule assign should make this line unnecessary
  # If package fails, it might be due to new submodule added
  # In that case, this line should be able to fetch it
  # python xenia-build setup
}

# FIXME: Currently xenia does not compile on linux with the
# default /etc/makepkg.conf LDFLAGS, particularily --as-needed
LDFLAGS="-Wl,-O1,--sort-common,-z,relro,-z,now"

build() {
  cd "${srcdir}/${pkgname%-git}"
  CC=clang CXX=clang++ python xenia-build premake
  CC=clang CXX=clang++ python xenia-build build --no_premake
}

package() {
  cd "${srcdir}/${pkgname%-git}"

  install -m755 -d ${pkgdir}/usr/bin
  install -m755 build/bin/Linux/Debug/* ${pkgdir}/usr/bin
  rm ${pkgdir}/usr/bin/*.a

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

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