summaryrefslogtreecommitdiff
path: root/pcr/rtl8812au/PKGBUILD
blob: a13e505f2bd65d3d9513b35a65ca82cdebb562df (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
# Maintainer: Parabola Hackers <dev@lists.parabola.nu>


_pkgbase=rtl8812au
pkgname=rtl8812au-dkms
pkgver=5.6.4.2.20220606 # per upstream dkms.conf (see note in prepare())
_cid=cab4e4ec56884f65e0c279c1b5ceaf70dbe79be0
pkgrel=2
pkgdesc="RTL8812AU/21AU and RTL8814AU driver with monitor mode and frame injection"
url=https://github.com/aircrack-ng/rtl8812au
license=(GPL2)
arch=(armv7h i686 x86_64)

makedepends=()
depends=(dkms)

source=(${_pkgbase}-${pkgver}.tar.gz::https://github.com/aircrack-ng/rtl8812au/archive/${_cid}.tar.gz
        dkms.conf)

sha256sums=(20b498bc597e5343ee6c240eabd45c36894db86c76f6bfc100448c8b9c420733
            9164f68d837976d0992a50875281f22fb7a2a82981346bde33706701f15bbcc8)

case "${CARCH}" in
armv7h ) export KARCH=arm   ;;
aarch64) export KARCH=arm64 ;; # TODO: not yet supported
esac


prepare()
{
  cd "${srcdir}"/${_pkgbase}-${_cid}

  # version sanity check
  # NOTE: The upstream does not publich versioned releases, nor use git tags.
  #       However they are kind enough to version the dkms.conf.
  #         eg: PACKAGE_VERSION="5.6.4.2~20220715"
  #       This PKGBUILD attempts to version the package properly, based on
  #       that version ID (aka: pkgver) and the VCS commit (aka: _cid) which defined it.
  local upstream_ver=$(grep PACKAGE_VERSION= dkms.conf | sed 's|PACKAGE_VERSION="\(.*\)"|\1|')
  [[ "${upstream_ver/\~/.}" == ${pkgver} ]] || ! echo "version mismatch in dkms.conf" || return 1

  # we will use our dkms.conf though
  cp "${srcdir}"/dkms.conf .

  case "${CARCH}" in
  armv7h)
    sed -i 's|^CONFIG_PLATFORM_I386_PC = y|CONFIG_PLATFORM_I386_PC = n|'     Makefile
    sed -i 's|^CONFIG_PLATFORM_ARM_SUN7I = n|CONFIG_PLATFORM_ARM_SUN7I = y|' Makefile
    sed -i "s|^MAKE\[0\]=\"|MAKE[0]=\"ARCH=${KARCH} |"                       dkms.conf
  ;;
  aarch64)
    sed -i "s|^MAKE\[0\]=\"|MAKE[0]=\"ARCH=${KARCH} |"                       dkms.conf
  ;;
  esac
  sed -i -e "s/@_PKGBASE@/${_pkgbase}/" -e "s/@PKGVER@/${pkgver}/"           dkms.conf

  # cleanup some sources that we won't need
  # the licensing of files under the tools/ directory is varied and unclear
  # TODO: this could/should go into a mksource() function
  rm -rf android/ tools/
}

package()
{
  cd "${srcdir}"/${_pkgbase}-${_cid}

  local dkms_srcdir="${pkgdir}"/usr/src/${_pkgbase}-${pkgver}

  # Install
  # Makefile does not respect DESTDIR
  # make DESTDIR="${pkgdir}" install

  # Copy dkms.conf
  install -Dm644 dkms.conf "${dkms_srcdir}"/dkms.conf

  # Set name and version
  # already did that

  # Copy sources (including Makefile)
  cp -r ./* "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/

  # install docs
  install -Dm644 README.md "${pkgdir}"/usr/share/doc/${_pkgbase}/README.md
  install -m644  docs/*    "${pkgdir}"/usr/share/doc/${_pkgbase}/
}