summaryrefslogtreecommitdiff
path: root/libre/linux-libre-firmware/PKGBUILD
blob: 1c995074bbcf53dfaaa561795e862a5c90c9f4e8 (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
# Maintainer: David P. <megver83@parabola.nu>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: Luke Shumaker <lukeshu@sbcglobal.net>

pkgname=linux-libre-firmware
pkgver=1.4
pkgrel=1
epoch=1
pkgdesc='Firmware files for Linux-libre'
arch=(any)
url='https://jxself.org/firmware'
license=(GPL3)
makedepends=(arm-linux-gnueabi-gcc           # av7110
             arm-none-eabi-gcc               # aica
             avr-gcc avr-libc dfu-util       # atusb
             sh-elf-gcc sh-elf-newlib cmake  # carl9170fw
             xtensa-elf-gcc                  # ath9k_htc
)
optdepends=('dfu-util: to flash the atusb firmware')
provides=(linux-firmware)
conflicts=(linux-firmware
           linux-firmware-git
           kernel26-firmware
           ar9170-fw
           iwlwifi-1000-ucode
           iwlwifi-3945-ucode
           iwlwifi-4965-ucode
           iwlwifi-5000-ucode
           iwlwifi-5150-ucode
           iwlwifi-6000-ucode
           rt2870usb-fw
           rt2x00-rt61-fw
           rt2x00-rt71w-fw
           openfwwf
           ath9k-htc-firmware)
replaces=(${conflicts[@]})
options=(!buildflags !makeflags)
source=("$url/$pkgname-$pkgver.tar.lz"{,.asc})
sha512sums=('3b4c8afb63c55f05df0b2686459c6bb2c0cb56db8384d5527506ff4a14b8de80e1a3037a9b57cccccd6953d869c6a71a6500c4c7b735253ea0b57c79854d9457'
            'SKIP')
validpgpkeys=('F611A908FFA165C699584ED49D0DB31B545A3198') # Jason Self

prepare(){
  cd "$pkgname-$pkgver/src"

  local src
  for src in "${source[@]}"; do
    src="${src%%::*}"
    src="${src##*/}"
    [[ $src = *.patch ]] || continue
    echo "Applying patch $src..."
    patch -Np1 < "$srcdir/$src"
  done

  # Use our cross compilers
  sed -e 's|$PWD/../toolchain/inst/bin/||g' \
      -i ath9k_htc/target_firmware/configure
  sed -e 's|${CMAKE_SOURCE_DIR}/toolchain/inst/bin/||g' \
      -e '/CMAKE_FIND_ROOT_PATH/d' \
      -i carl9170fw/extra/sh-elf-linux.cmake

  # Remove toolchains and build carl9170fw with the default config
  sed -e 's/: ath9k_htc_toolchain$/:/' \
      -e 's/: carl9170fw-toolchain$/:/' \
      -e '/cd carl9170fw && .\/autogen.sh$/ s/$/ --alldefconfig/' \
      -i Makefile
}

build(){
  make -C "$pkgname-$pkgver/src"
}

package(){
  cd "$pkgname-$pkgver/src"

  make prefix="$pkgdir/usr/lib/firmware install"
  install -Dm644 WHENCE "$pkgdir/usr/share/licenses/$pkgname/WHENCE"
}