summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 098987b0169fa7a77188bf027a9af58800ac3ccc (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
# Maintainer: Fabio 'Lolix' Loli <fabio.loli@disroot.org> -> https://github.com/FabioLolix
# Contributor: Martin Sandsmark <martin.sandsmark@kde.org>

pkgname=redasm-git
pkgver=3.0.0.beta5.r32.g6e8bbae
pkgrel=1
url="https://github.com/REDasmOrg/REDasm"
arch=(i686 x86_64)
pkgdesc="The OpenSource Disassembler"
license=(GPL3)
depends=(qt6-base)
makedepends=(git cmake patchelf qt6-tools)
conflicts=(redasm)
provides=(redasm)
source=("git+https://github.com/REDasmOrg/REDasm.git"
        "git+https://github.com/REDasmOrg/REDasm-Library.git"
        "git+https://github.com/REDasmOrg/REDasm-Plugins.git"
        "git+https://github.com/REDasmOrg/REDasm-Loaders.git"
        "git+https://github.com/REDasmOrg/REDasm-Assemblers.git"
        "git+https://github.com/REDasmOrg/REDasm-Database.git"
        "git+https://github.com/Dax89/QHexView.git"
        #"git+https://github.com/aquynh/capstone.git"
        "git+https://github.com/capstone-engine/capstone.git"
        "git+https://github.com/taocpp/json.git"
        "git+https://github.com/taocpp/PEGTL.git"
        "git+https://github.com/zyantific/zydis.git"
        "git+https://github.com/zyantific/zycore-c.git"
)
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd REDasm
  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd REDasm
  git submodule init
  git config submodule.LibREDasm.url "${srcdir}/REDasm-Library"
  git config submodule.submodules/plugins.url "${srcdir}/REDasm-Plugins"
  git config submodule.submodules/loaders.url "${srcdir}/REDasm-Loaders"
  git config submodule.submodules/assemblers.url "${srcdir}/REDasm-Assemblers"
  git config submodule.submodules/database.url "${srcdir}/REDasm-Database"
  git config submodule.libs/qhexview.url "${srcdir}/QHexView"
  git -c protocol.file.allow=always submodule update

  cd LibREDasm
  git submodule init
  git config submodule.rdcore/libs/taojson.url "${srcdir}/json"
  git -c protocol.file.allow=always submodule update

  cd rdcore/libs/taojson
  git submodule init
  git config submodule.external/PEGTL.url "${srcdir}/PEGTL"
  git -c protocol.file.allow=always submodule update

  cd "${srcdir}"/REDasm/submodules/assemblers
  git submodule init
  git config submodule.x86/zydis.url "${srcdir}/zydis"
  git config submodule.capstonebundle/capstone.url "${srcdir}/capstone"
  git -c protocol.file.allow=always submodule update

  cd x86/zydis
  git submodule init
  git config submodule.dependencies/zycore.url "${srcdir}/zycore-c"
  git -c protocol.file.allow=always submodule update
}

build() {
  cmake -B build -S "REDasm" -Wno-dev \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr

  cmake --build build
}

package() {
  cd build
  patchelf --set-rpath /usr/lib REDasm
  install -D -m755 REDasm ${pkgdir}/usr/bin/REDasm
  install -D -m755 LibREDasm/LibREDasm.so ${pkgdir}/usr/lib/LibREDasm.so
  install -d -m755 ${pkgdir}/usr/lib/redasm/

  install -m755 ./plugins/loaders/esp/esp.so ${pkgdir}/usr/lib/redasm/
  install -m755 ./plugins/loaders/chip8/chip8.so ${pkgdir}/usr/lib/redasm/
  install -m755 ./plugins/loaders/psx/psx.so ${pkgdir}/usr/lib/redasm/
  install -m755 ./plugins/loaders/elf/elf.so ${pkgdir}/usr/lib/redasm/
  install -m755 ./plugins/loaders/pe/pe.so ${pkgdir}/usr/lib/redasm/
  install -m755 ./plugins/assemblers/x86/x86.so ${pkgdir}/usr/lib/redasm/
  install -m755 ./plugins/assemblers/mips/mips.so ${pkgdir}/usr/lib/redasm/
  install -m755 ./plugins/plugins/compiler/compiler.so ${pkgdir}/usr/lib/redasm/

  install -D -m644 "${srcdir}"/REDasm/README.md ${pkgdir}/usr/share/doc/${pkgname}/README
  install -D -m644 "${srcdir}"/REDasm/LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}