summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0ea8fc77e0bbb4741f52175ced204450150923ba (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
# Maintainer: Maxime Vincent <maxime.vince@gmail.com>

pkgname=sigfox-radio-signal-analyzer
pkgver=2.0.1
pkgrel=2
pkgdesc='Sigfox Radio Signal Analyser for use with Sigfox SDR stick'
arch=(i686 x86_64)
license=(GPL)
depends=('fftw' 'qt5-svg' 'alsa-lib')
makedepends=('squashfs-tools' 'cdrtools')
source=()
sha256sums=()

prepare() {
    mkdir -p  iso
    cd iso
    wget -c https://support.sigfox.com/files/5e6202f04f6f67c0396574bb -O sigfox_rsa.iso
    isoinfo -i sigfox_rsa.iso --find -name "FILESYSTEM.SQUASHFS*" -print 2>/dev/null | xargs isoinfo -i sigfox_rsa.iso -x > filesystem.squashfs
}

build() {
    echo Build
}

package() {
    if [ -d "$srcdir"/unsq ]; then
        echo "Already unsquashed. Skipping unsquashfs"
    else
        unsquashfs -d "$srcdir"/unsq iso/filesystem.squashfs
    fi
    mkdir -p "$pkgdir"/usr/
    mkdir -p "$pkgdir"/usr/bin
    mkdir -p "$pkgdir"/usr/local
    mkdir -p "$pkgdir"/usr/local/bin
    mkdir -p "$pkgdir"/usr/local/bin/sigfox_verified/

    # Many /usr/local/bin paths are hardcoded in the binary, so we should copy them as well
    cp -r "$srcdir"/unsq/usr/local/bin/sigfox_verified "$pkgdir"/usr/local/bin/

    # Copy from /usr/local/lib to /usr/lib (The Arch Way)
    cp -r "$srcdir"/unsq/usr/local/lib "$pkgdir"/usr/
    cp "$srcdir"/unsq/usr/lib/librsvisa.so "$pkgdir"/usr/lib/

    # Re-create symlink
    rm -rf  "$pkgdir"/usr/bin/radio_signal_analyzer_pb
    ln -s /usr/local/bin/sigfox_verified/radio_signal_analyzer_pb "$pkgdir"/usr/bin/radio_signal_analyzer_pb

    # Remove unused directories that got copied
    rm -rf "$pkgdir"/usr/lib/python2.7/site-packages
    rm -rf "$pkgdir"/usr/lib/python3.5/dist-packages
    rm -rf "$pkgdir"/usr/lib/python2.7/dist-packages
    rm -rf "$pkgdir"/usr/lib/python3.5
    rm -rf "$pkgdir"/usr/lib/python2.7

    #install -Dm644 bin/radio_signal_analyzer "$pkgdir"/usr/bin/radio_signal_analyzer
    #install -Dm644 bin/sigfox_verified "$pkgdir"/usr/bin/
    libtool --finish /usr/lib
}