summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d1f439e959b7983fe4afb85cbf434d7220baface (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
# Maintainer: Grey Christoforo <first name at last name dot net>
pkgname=thorspec
pkgver=2.8.0
pkgrel=2
pkgdesc="Driver for Thorlabs spectrometers"
arch=('any')
url="https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=3482&pn=CCS175/M"
license=('custom')
depends=('gnuplot')
makedepends=('innoextract' 'python2')
_dlver=${pkgver//./}
_dlver=V${_dlver::1}_${_dlver: -2}
_cver=0.1
source=(setupblob_${pkgver}.exe::"https://www.thorlabs.com/software/THO/OSA/${_dlver}/ThorlabsOSASW_Full_setup.exe" "cyusb-fw-extract-py2.py" "80-spectrometer.rules" "https://github.com/greyltc/thorspec/archive/${_cver}.tar.gz")
noextract=("setupblob_${pkgver}")
md5sums=('1301c516d4bd64aa348a9936ea8ee4ab'
         '793c35c7b9b08baa950a63564dfb782f'
         '7083e7b40cbd3095640d227190cdd08d'
         '33ced3a70111e0fcffea26b780df2a48')


_firmware_loc="app/CCS/inf/Loader"

prepare() {
  # extract the installer 
  innoextract setupblob_${pkgver}.exe
}

build() {
  # convert the firmwares
  _firmwares="$srcdir/${_firmware_loc}/*.spt"
  for firmware in $_firmwares
  do
    python2 cyusb-fw-extract-py2.py -o${firmware//.spt/} $firmware || true
  done

  cd thorspec-${_cver}/build
  make
}


package() {
  _firmwares="$srcdir/${_firmware_loc}/*_2.ihx"
  for firmware in $_firmwares
  do
    install -D -m644 "${firmware}" "$pkgdir/usr/lib/firmware/$(basename ${firmware})"
  done
  install -D -m644 80-spectrometer.rules "$pkgdir/etc/udev/rules.d/80-spectrometer.rules"

  install -D -m755 thorspec-${_cver}/build/thorspec "$pkgdir/usr/bin/thorspec"
}