makedeb


wintrek-e 2.0-0


Unofficial Srar Trek simulation game based on Mainframe Star Trek, enhanced version (wine)

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for wintrek-e.

# Maintainer: exponential <echo ZXhwb25lbnRpYWxtYXRyaXhAcHJvdG9ubWFpbC5jb20K | base64 -d>

# You need to activate multiarch for wine32
# sudo dpkg --add-architecture i386

pkgname=wintrek-e
pkgver=2.0
pkgrel=0
pkgdesc="Unofficial Srar Trek simulation game based on Mainframe Star Trek, enhanced version (wine)"
arch=("all")
url="http://www.joejaworski.com/wintrek/"
license=('freeware')
depends=('wine')
optdepends=('wine32: will be replaced by wow64')
makedepends=('lynx' 'ffmpeg' '7zip')
extensions=()
source=("${pkgname}.zip::https://sourceforge.net/projects/wintrek/files/WinTrek%20Enhanced/WinTrek%20Enhanced/WinTrekE-v2.0.zip"
        "${pkgname}.pdf::http://joejaworski.com/wintrek/wintrek.pdf"
        "${pkgname}.html::http://joejaworski.com/wintrek/")
noextract=("${pkgname}.zip")
b2sums=('4ebab132c58b621a97a4e289a0e2d30f915184fca15cf35a9a144c89b58f48af962f7340b878961d6ba0ddf15939e460d28315a51327955b9a5d280b0cbb381e'
        '096cf820a5ec9520d2a22de934b98532848cc7214ebdc027f27aeffc531dfbc0aad846c884bec1b4c7552f03eb280f66b1a88decf8f0b8a27003ca5b119c8f7e'
        '2767a97ad4b72767867615b03acff71a68b39cd8a223cce406c0a44ef1841b0da79d02e797fa1f45104d67055b5d5895517cdc9c85823bd3bbadcf64047a7ba2')

prepare() {
  # Warning about multiarch
  printf "\33[2K\r\033[1;33m%s\033[0m" "Warning:" >&2
  echo "You need to activate multiarch for wine32"
  printf "\33[2K\r\033[1;33m%s\033[0m" "Warning:" >&2
  echo "sudo dpkg --add-architecture i386"
  # cd
  cd "$srcdir"
  # extract
  rm -rf "${pkgname}"
  mkdir -p "${pkgname}"
  bsdtar -xf "${pkgname}.zip" -C "${pkgname}"
  # lower case
  for _filename in "${pkgname}/"*;
  do
    mv -n "$_filename" `echo "$_filename" | tr 'A-Z' 'a-z'`
  done
  # readme
  lynx -dump -nolist "${pkgname}.html" > "${pkgname}.readme"
  # icon
  7z e -so "${pkgname}/wintrek1.dll" .rsrc/BITMAP/19.bmp | ffmpeg -y -i pipe:bmp: "${pkgname}.png"
}

package() {
  cd "$srcdir"
  # Creating Directories
  install -dm755 $pkgdir/usr/{games,share/{games/${pkgname},doc/${pkgname},applications,pixmaps}}
  # Install
  install -Dm644 "${pkgname}/"* "${pkgdir}/usr/share/games/${pkgname}"
  # delete doc manual
  rm "${pkgdir}/usr/share/games/${pkgname}/wintrek.doc"
  # wrapper
echo '#!/bin/sh

set -eu

prog_name="wintrek-e"
prog_real_path="/usr/share/games/$prog_name"
prog_home="$HOME/.config/$prog_name"
prog_bin="wintrek.exe"
# home folder
mkdir -p "$prog_home"
# Symlinks
cp -nas "$prog_real_path/"* "$prog_home" 2> /dev/null
# exec
exec wine "$prog_home/$prog_bin" "$@"' > "$pkgdir/usr/games/${pkgname}"
  chmod 755 "$pkgdir/usr/games/${pkgname}"

  # doc
  install -Dm644 "${pkgname}.readme" "$pkgdir/usr/share/doc/${pkgname}/readme"
  install -Dm644 ${pkgname}.pdf "$pkgdir/usr/share/doc/${pkgname}/"
  # Deskrop file
echo "[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=${pkgname}.png
Name=${pkgname}
Comment=Unofficial Srar Trek simulation game, enhanced version
Exec=${pkgname}
Categories=Application;Game;" > "${pkgdir}/usr/share/applications/${pkgname}.desktop"
  # Icon
  install -Dm644 "${pkgname}.png" "$pkgdir/usr/share/pixmaps/${pkgname}.png"
}