summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 83de1121f9dad127cf08e3a39004b11d5f0ef4e7 (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
97
98
99
100
101
102
103
104
105
106
107
pkgname=xenia-git
pkgver=r4814.1407e834.linux_fixes
pkgrel=1
pkgdesc="Xenia is an experimental emulator for the Xbox 360."
arch=('x86_64')
url="http://xenia.jp"
license=('BSD')
options=('debug' '!strip')
depends=('gtk3' 'lz4' 'glew' 'libx11' 'libc++')
# TODO use installed premake5 instead of building it
# premake: powerpc patch added
makedepends=('python' 'clang' 'vulkan-headers' 'git' 'clang' 'libpthread-stubs')
provides=('xenia')
conflicts=('xenia')
# TODO: Use system installed deps for non-forked libs
source=("git+https://github.com/benvanik/xenia.git"
        "xenia-linux-fixes::git+https://github.com/bwrsandman/xenia.git#branch=linux"
        "git+https://github.com/benvanik/binutils-ppc-cygwin"
        "git+https://github.com/xenia-project/capstone.git"
        "git+https://github.com/catchorg/Catch2"  # catch-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/KhronosGroup/SPIRV-Headers"  # spirv-headers or glslang
        "git+https://github.com/xenia-project/SPIRV-Tools.git"
        "git+https://github.com/xenia-project/xbyak.git"
        "git+https://github.com/jbeder/yaml-cpp.git")  # yaml-cpp
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

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

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

  msg2 "Merging Linux Fixes"
  git pull "../${pkgname%-git}-linux-fixes"

  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 debug and linking particularily
# --fvar-tracking-assignments and --as-needed
DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="-g"
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: