summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b00c26ec0c135b33d186fca8c55e5d0bdfbee3ea (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Maintainer: Det <nimetonmaili g-mail>

# Choose, which icons to use for menus and system tray ("blue", "gray" or "default").
_icon="default"

pkgname=vuze-dev
pkgver=5.7.6.1_B01
pkgrel=1
pkgdesc="A feature-rich Java-based BitTorrent client (previously called 'Azureus') - Bleeding edge version"
arch=('x86_64')
url="http://dev.vuze.com/"
license=('GPL')
depends=('desktop-file-utils' 'java-runtime')
optdepends=('vuze-plugin-countrylocator: Country flags for the "Peers" tab'
            'vuze-plugin-mldht: The alternative Distributed Hash Table implementation (DHT) used by µTorrent'
            'xulrunner192: Needed for the channels GUI')
provides=('vuze')
options=('!strip')
install=$pkgname.install
versions=$(curl -sL http://dev.vuze.com/versions.json)
_stable_ver_flat=$(echo "$versions" | grep -Po 'version": "\K[^"]*' | tail -1) # 5730
_dev_ver_flat=$(echo "$versions" | grep -Pom1 'version": "\K[^"]*')            # 5731
_dev_ver=$(echo "$_dev_ver_flat" | sed -r 's/([0-9])/.\1/g' | cut -c 2-)       # 5.7.3.1
_dev_build=$(echo "$versions" | grep -Pom1 'build": "\K[^"]*')                 # 20
source=("http://downloads.sourceforge.net/azureus/vuze/Vuze_${_stable_ver_flat}/Vuze_${_stable_ver_flat}_linux.tar.bz2"
        "http://cf1.vuze.com/torrent/files/Azureus${_dev_ver_flat}-B${_dev_build}.jar"
         {blue,gray}_{16,32,64,128}.png)
noextract=($(basename ${source[1]}))
md5sums=('fb8f224700331de86caa8648418fb41b'
         'SKIP'
         '5eba696cfcc430504706f476e13b2ade'
         'a4cae0c46a6ac56322753f96f52b8f74'
         '5eba696cfcc430504706f476e13b2ade'
         '74fd7cf4d05e5c2111ec2dbf62b3c9d8'
         '4374a188968bf9f09cab090ca7d33ce4'
         '484182b170741132ffe2d78c6feaf230'
         '4374a188968bf9f09cab090ca7d33ce4'
         'db19086ba7bd8eefee05538f4c65aa68')

pkgver() {
  echo ${_dev_ver}_B${_dev_build}
}

package() {
  cd vuze

  msg2 "Creating directory structure..."
  install -d "$pkgdir"/opt/$pkgname/
  install -d "$pkgdir"/usr/bin/
  install -d "$pkgdir"/usr/share/applications/
  install -d "$pkgdir"/usr/share/licenses/$pkgname/
  install -d "$pkgdir"/usr/share/pixmaps/

  msg2 "Moving stuff in place..."
  # Launcher
  mv vuze "$pkgdir"/usr/bin/$pkgname

  # swt.jar
  mv swt/swt64.jar "$pkgdir"/opt/$pkgname/swt.jar

  # Icon and desktop 
  mv vuze.png "$pkgdir"/usr/share/pixmaps/$pkgname.png
  mv vuze.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop

  # Licenses
  for i in GPL.txt GPLv3.txt LICENSES.txt TOS.txt; do
    mv $i "$pkgdir"/usr/share/licenses/$pkgname/
  done

  msg2 "Removing redundancies..."
  rm -r swt/
  rm    azureus
  rm    installer.log
  rm    README.txt
  rm    vuze.schemas

  msg2 "Installing to /opt..."
  mv * "$pkgdir"/opt/$pkgname/

  msg2 "Fixing paths..."
  sed -i "s|#PROGRAM_DIR=.*|PROGRAM_DIR=\"/opt/$pkgname\"|" "$pkgdir"/usr/bin/$pkgname

  msg2 "Adding support for magnet links..."
  sed -r -e "s|Name=Vuze|Name=Vuze Development Build|" \
         -e "s|Exec=vuze %f|Exec=$pkgname %U|" \
         -e "s|Icon=vuze.png|Icon=$pkgname.png|" \
         -e "s|(x-bittorrent)|\1;x-scheme-handler/magnet;|" \
         -i "$pkgdir"/usr/share/applications/$pkgname.desktop

  msg2 "Updating to Development Build..."
  install -m644 "$srcdir"/Azureus${_dev_ver_flat}-B${_dev_build}.jar -C "$pkgdir"/opt/$pkgname/Azureus2.jar

  # Different icons for menus and systray
  if [[ $_icon = blue ]] || [[ $_icon = gray ]]; then
    msg2 "Using alternative $_icon icons..."

    # Menus
    cd "$srcdir"
    install -m644 ${_icon}_128.png "$pkgdir"/usr/share/pixmaps/$pkgname.png

    # Extract .jar
    install -d tmp/
    bsdtar -xf Azureus${_dev_ver_flat}-B${_dev_build}.jar -C tmp/

    # Place icons
    for i in 16 32 64 128; do
      install -m644 ${_icon}_${i}.png tmp/org/gudy/azureus2/ui/icons/a${i}.png
    done

    # Recreate .jar
    cd tmp
    jar cf Azureus2.jar ./*/

    # Install
    install -m644 Azureus2.jar "$pkgdir"/opt/$pkgname/
  fi
}