summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9a24e4aedec0396aa3afeb572bc56aad3cffd184 (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
# Maintainer: Figue <ffigue@gmail.com>
# Contributor: Pirea Radu <pirea.radu@gmail.com>

pkgname=cubieboard-livesuit
pkgver=306
pkgrel=4
pkgdesc="LiveSuit is a tool to flash Images to the NAND of Allwinner devices, such as Cubieboard1, Cubieboard2, and Cubietruck. This package use the ZIP that comes from official Cubieboard download page."
arch=('i686' 'x86_64')
url="http://cubieboard.org"
license=('GPL')
depends=('libpng12' 'qt4' 'linux-headers')
makedepends=('git' 'dkms')
conflicts=()
install=${pkgname}.install
source_x86_64=("${pkgname}"::'git+https://github.com/linux-sunxi/sunxi-livesuite.git'
	    "http://dl.cubieboard.org/software/tools/livesuit/LiveSuitV${pkgver}_For_Linux64.zip"
        "50-awusb.rules" "awusb-fix.patch")

source_i686=("${pkgname}"::'git+https://github.com/linux-sunxi/sunxi-livesuite.git'
            "http://dl.cubieboard.org/software/tools/livesuit/LiveSuitV${pkgver}_For_Linux32.zip"
        "50-awusb.rules" "awusb-fix.patch")

sha256sums_i686=('SKIP'
                 '91553f7dc0a8dc467a6f584b8faea73ddbd6fa6ba39fb3701d208d519a7173be'
                 '21e03a459c30fbf92bef5b086f8c93c6ac7071d97e7855dce7627e624969081f'
                 '033a91cd366b1ecd13ea44e49ee454830623b4db42c76d74e084360a8f33f966')
sha256sums_x86_64=('SKIP'
                   '12c042080e6b49e3edff7052cbb9ff0a89badce12be04d1443b1c9d5163d9bf3'
                   '21e03a459c30fbf92bef5b086f8c93c6ac7071d97e7855dce7627e624969081f'
                   '033a91cd366b1ecd13ea44e49ee454830623b4db42c76d74e084360a8f33f966')

build() {
    # LiveSuit
    if [ "$CARCH" = "x86_64" ]; then
        cd ${srcdir}/LiveSuit_For_Linux64
    elif [ "$CARCH" = "i686" ]; then
        cd ${srcdir}/LiveSuit_For_Linux32
    fi
    tail -n +60 LiveSuit.run > LiveSuit.tar.bz2
    tar xjvf LiveSuit.tar.bz2

    # Kernel module awusb
    cd ${srcdir}/${pkgname}/awusb
    patch -Np1 -i ${srcdir}/awusb-fix.patch

    # Kernels greater than 5.4 fails to build
    function ver { printf "%03d%03d%03d" $(echo "$1" | tr '.' ' '); }
    kernel_ver=$(uname -r | cut -d'-' -f1)
    if [ "$(ver $kernel_ver)" -gt "$(ver 5.4)" ]; then sed -E -e 's:SUBDIRS=([^ ]+) :M=\1 &:g' -i Makefile ; fi

    make
}

package() {
    # LiveSuit
    if [ "$CARCH" = "x86_64" ]; then
        cd ${srcdir}/LiveSuit_For_Linux64
    elif [ "$CARCH" = "i686" ]; then
        cd ${srcdir}/LiveSuit_For_Linux32
    fi
    mkdir -p "${pkgdir}/opt/${pkgname}"
    cp -r LiveSuit/* ${pkgdir}/opt/${pkgname}/

    # Kernel module awusb
    mkdir -p ${pkgdir}/usr/lib/modules/`uname -r`/kernel/ ${pkgdir}/etc/udev/rules.d
    cp ${srcdir}/${pkgname}/awusb/awusb.ko ${pkgdir}/usr/lib/modules/`uname -r`/kernel/
    cp ${srcdir}/50-awusb.rules ${pkgdir}/etc/udev/rules.d/
}