summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0922467de6e84b4eb63d662c53afd72662d3e932 (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
108
109
110
111
112
113
114
115
116
117
118
# Maintainer: Eric Engestrom <aur@engestrom.ch>

pkgname=fex-emu-git
pkgver=2406+295.g58e949e148
pkgrel=1
pkgdesc='Fast usermode x86 and x86-64 emulator for Arm64'
url=https://fex-emu.com
arch=(aarch64)
license=(MIT)
makedepends=(git cmake ninja clang llvm python-setuptools)
depends=(qt5-declarative qt5-quickcontrols squashfs-tools squashfuse erofs-utils)
source=("git+https://github.com/FEX-Emu/FEX"
        "git+https://github.com/catchorg/Catch2"
        "git+https://github.com/KhronosGroup/Vulkan-Headers"
        "git+https://github.com/Sonicadvance1/cpp-optparse"
        "git+https://github.com/FEX-Emu/drm-headers"
        "git+https://github.com/FEX-Emu/fex-gcc-target-tests-bins"
        "git+https://github.com/FEX-Emu/fex-gvisor-tests-bins"
        "git+https://github.com/FEX-Emu/fex-posixtest-bins"
        "git+https://github.com/fmtlib/fmt"
        "git+https://github.com/Sonicadvance1/imgui"
        "git+https://github.com/FEX-Emu/jemalloc"
        "git+https://github.com/Sonicadvance1/json-maker"
        "git+https://github.com/FEX-Emu/robin-map"
        "git+https://github.com/Sonicadvance1/tiny-json"
        "git+https://github.com/FEX-Emu/vixl"
        "git+https://github.com/herumi/xbyak"
        "git+https://github.com/Cyan4973/xxhash"
        )
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')
conflicts=("${pkgname%-git}")
provides=("${pkgname%-git}=${pkgver%+*}")

prepare() {
  cd FEX
  git submodule init
  for f in \
    Catch2 \
    Vulkan-Headers \
    drm-headers \
    fex-gcc-target-tests-bins \
    fex-gvisor-tests-bins \
    fex-posixtest-bins \
    fmt \
    imgui \
    jemalloc \
    json-maker \
    robin-map \
    tiny-json \
    vixl \
    xbyak \
    xxhash \
    ;
  do
    git config submodule."External/$f".url "$srcdir/$f"
  done

  git config submodule."External/jemalloc_glibc".url "$srcdir/jemalloc"

  for f in \
    cpp-optparse \
    ;
  do
    git config submodule."Source/Common/$f".url "$srcdir/$f"
  done

  git -c protocol.file.allow=always submodule update
}

pkgver() {
  git -C FEX describe --tags --abbrev=10 | sed 's/^FEX-//; s/-/+/; s/-/./'
}

build() {
  FEX_OPTIONS=()
  FEX_OPTIONS+=(-D ENABLE_LTO=True)
  FEX_OPTIONS+=(-D BUILD_TESTS=False)

  if command -V ld.mold &>/dev/null
  then
    FEX_OPTIONS+=(-D ENABLE_MOLD=True)
  elif command -V ld.lld &>/dev/null
  then
    FEX_OPTIONS+=(-D ENABLE_LLD=True)
  fi

  CC=clang \
  CXX=clang++ \
  cmake \
    -S FEX -B build -G Ninja \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D CMAKE_BUILD_TYPE=Release \
    -D FMT_INSTALL=False \
    "${FEX_OPTIONS[@]}"
  ninja -C build
}

package() {
  DESTDIR="$pkgdir" ninja -C build install

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