summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 58ca7bd652d8904a399cc49797cd3970d0a2f65c (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
# Maintainer: edward-p <edward At edward-p Dot xyz>

pkgname=proxmark3-iceman-git
pkgver=7679.3d366d50
pkgrel=1
pkgdesc='RRG / Iceman repo - Proxmark3 RDV4.0 and other Proxmark3 platforms.'
arch=('x86_64')
url='https://github.com/RfidResearchGroup/proxmark3'
license=('GPL2')
depends=('perl' 'python')
makedepends=('git' 'arm-none-eabi-gcc' 'arm-none-eabi-newlib')
options=(!buildflags)
provides=('proxmark3' 'proxmark3-iceman')
conflicts=('proxmark3' 'proxmark3-iceman')
replaces=($pkgname'-generic' $pkgname'-rdv4')
source=("$pkgname::git+https://github.com/RfidResearchGroup/proxmark3.git")
sha512sums=('SKIP')
install=proxmark3-iceman-git.install

pkgver() {
  cd $pkgname
  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  export DESTDIR="build"
  export PREFIX="/usr"
  export UDEV_PREFIX="/usr/lib/udev/rules.d"
}

build() {
  cd "${srcdir}/${pkgname}"

  mkdir "$DESTDIR"
  
  STANDALONE_MODES=(
          'LF_SAMYRUN'
          #'LF_ICERUN'
          'LF_PROXBRUTE'
          'LF_HIDBRUTE'
          'HF_YOUNG'
          'HF_MATTYRUN')
  RDV4_STANDALONE_MODES=('HF_COLIN' 'HF_BOG')
 
  # Build recovery (without PLATFORM_EXTRAS and STANDALONE)
  make \
    PLATFORM="PM3RDV4" STANDALONE= FWTAG="rdv4-nostandalone" recovery/install
  make \
    PLATFORM="PM3OTHER" STANDALONE= FWTAG="other-nostandalone" recovery/install

  # These firmware is not needed.
  # rm build/usr/share/proxmark3/firmware/{fullimage-rdv4-nostandalone.elf,fullimage-other-nostandalone.elf}

  # Build various firmwares
  for standalone in ${STANDALONE_MODES[@]}; do

      make \
        PLATFORM="PM3RDV4" PLATFORM_EXTRAS="BTADDON" STANDALONE="${standalone}" \
        FWTAG="rdv4-"$(echo ${standalone} | tr '[:upper:]' '[:lower:]') armsrc/install

      make \
        PLATFORM="PM3OTHER" STANDALONE="${standalone}" \
        FWTAG="other-"$(echo ${standalone} | tr '[:upper:]' '[:lower:]') armsrc/install

  done

  for standalone in ${RDV4_STANDALONE_MODES[@]}; do

      make \
        PLATFORM="PM3RDV4" PLATFORM_EXTRAS="BTADDON" STANDALONE="${standalone}" \
        FWTAG="rdv4-"$(echo ${standalone} | tr '[:upper:]' '[:lower:]') armsrc/install

  done

  # Build & install other targets
  make {bootrom,client,mfkey,nonce2key,common}/install
}

package() {
  cd "${srcdir}/${pkgname}"
  mv "$DESTDIR"/* "${pkgdir}/"
}