Username: Password: Remember me
# Maintainer: Kepsz <kepszlok at gmail dot com>
# Contributor: fishfish <chiizufish of the gmail variety>
pkgdesc="core runtime necessary to communicate with Digilent system boards"
depends=('libusb>=1.0' 'libftd2xx')
# hack to make sure a valid URL shows up
# on the AUR page - taken from the Dropbox PKGBUILD
#[[ $CARCH == x86_64 ]] && _arch=x86_64
#[[ $CARCH == x86_64 ]] && md5sums[0]='fe89c7fc9a4e09ebf2e58661e63f0cbd'
package() {
  cd "$srcdir/digilent.adept.runtime_$pkgver-$CARCH"
  # shared libraries
  mkdir -p "$pkgdir/usr/lib/digilent/adept"
  cp -d lib64/* "$pkgdir/usr/lib/digilent/adept"
  chmod -R 755 "$pkgdir/usr/lib/digilent/adept"
  # firmware images
  mkdir -p "$pkgdir/usr/share/digilent/data/firmware"
  install -m 644 data/firmware/*.HEX "$pkgdir/usr/share/digilent/data/firmware"
  # JTSC device list
  install -m 644 data/jtscdvclist.txt "$pkgdir/usr/share/digilent/data"
  # CoolRunner support files
  mkdir "$pkgdir/usr/share/digilent/data/xpla3"
  install -m 644 data/xpla3/*.map "$pkgdir/usr/share/digilent/data/xpla3"
  # CoolRunner 2 support files
  mkdir "$pkgdir/usr/share/digilent/data/xbr"
  install -m 644 data/xbr/*.map "$pkgdir/usr/share/digilent/data/xbr"
  # Adept runtime configuration file
  mkdir "$pkgdir/etc"
  sed -i 's_usr/local/share_usr/share_' digilent-adept.conf
  install -m 644 digilent-adept.conf "$pkgdir/etc"
  # module unloader binary
  # ("This application detaches any kernel drivers that are attached
  #   to the interfaces of the device, ensuring that the Runtime will
  #   be able to communicate with the device using libusb.")
  mkdir "$pkgdir/usr/sbin"
  install -m 755 bin64/dftdrvdtch "$pkgdir/usr/sbin"
  # udev rules
  mkdir -p "$pkgdir/etc/udev/rules.d"
  # the udev script uses the legacy SYSFS attribute; replace it with
  # the newer ATTR syntax
  sed -i 's_usr/local/sbin_usr/sbin_; s_SYSFS_ATTR_g' 52-digilent-usb.rules
  install -m 644 52-digilent-usb.rules "$pkgdir/etc/udev/rules.d"
  # library configuration file
  mkdir "$pkgdir/etc/"
  sed -i -e 's_local/lib_lib_' -e '/lib64/,$d' digilent-adept-libraries.conf
  sed -i 's_32-bit_64-bit_' digilent-adept-libraries.conf
  install -m 644 digilent-adept-libraries.conf "$pkgdir/etc/"
  # EULA
  mkdir -p "$pkgdir/usr/share/licenses/adept-runtime"
  install -m 644 EULA "$pkgdir/usr/share/licenses/adept-runtime"
# vim:set ts=2 sw=2 et: