### this file is sourced not run
# vim: ft=sh:

# This recipe can only work for version-tagged github releases.
# Interim commits (master.zip) are excluded.
# Tag label format: x.y.z; append -<hash> or -RCn for temporary tags.
# Files image/* are excluded except for *".pub."* and *"-${fnrversion}-"*.

fnrversion=2.0.0-abcdef0 # unofficial release
fnrversion=4.0.2 # official release
PKGVER=$fnrversion
PKGBUILD=1
PKGARCH=noarch

LOCALNAME=findnrun REPONAME=find-n-run
TARBALL=${LOCALNAME}-${fnrversion}.tar.gz
MD5SUM=45d9f6673d4c5139d9cd60446f63d306
SRC_URL=https://github.com/step-/find-n-run/archive/${fnrversion}.tar.gz

SLACKDESC='findnrun_nls: findnrun '${fnrversion}' (language pack)
findnrun_nls: 
findnrun_nls: Findnrun is a gtkdialog-based desktop application starter.
findnrun_nls: With plugins it can search and use other data types.
findnrun_nls: 
findnrun_nls: This is the language pack for the GUI and the help system.
findnrun_nls: 
findnrun_nls: 
findnrun_nls: 
findnrun_nls: 
findnrun_nls: https://github.com/step-/find-n-run/ 
'
# http://software.jaos.org/git/slapt-get/plain/FAQ.html#slgFAQ19
SLACKREQ='findnrun = 4.0.2-noarch-1
mdview'
# http://software.jaos.org/git/slapt-get/plain/FAQ.html#slgFAQ44
SLACKSUG=
# http://software.jaos.org/git/slapt-get/plain/FAQ.html#slgFAQ31
SLACKCON=

### default pkg_prepare

### build
pkg_build() {
  cd /tmp &&
  mv ${REPONAME}-${fnrversion} ${LOCALNAME}-${fnrversion} &&
  cd ${LOCALNAME}-${fnrversion} &&

  # Keep folders 'locale' (.mo and .po), 'nls' (.pot...) and
  # applications (.desktop) only.
  rm -rd .github/ README.md LICENSE usr/bin \
    usr/share/doc/findnrun usr/share/icons usr/share/findnrun

  # Clean install chroot tree from development links/files.
  # Note: this may leave whiteout files behind, which would prevent
  # removing empty dirs. Later on pkg_package() takes care of that.
  rm -rf /usr/share/locale /usr/share/doc/nls &&
  find /usr \! -type d -name '*findnrun*' -delete &&
  find /usr -depth -type d -name '*findnrun*' -exec rm -rd '{}' \; &&

  # Install.
  cp -rp --parents usr / &&

  # Add meta info.
  pkg_build_slackdesc
}

# package, see Note above.
pkg_package() {
  #touch "$BUILD_DIR/keep"
  pkg_remove_whiteout usr &&
    pkg_remove_empty_dirs usr &&
    pkg_build_pet_file ${PKG} \
      "Category='Filesystem;find'" \
      "Dependencies='+mdview'" \
      "Description='Translations.'"

}


