summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3de4acec59e1dfdc423701666d396f3859c188e2 (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
118
119
120
121
122
123
# Maintainer: pat-s <patrick.schratz@gmail.com>
# Maintainer: chendaniely <chendaniely@gmail.com>
# code adapted from: Meow < a.li.devtty at gmail dot com >

# Get download links and md5sums for latest version of RStudio desktop
## R code #############
#
#  require(XML)
#  page = htmlTreeParse("http://www.rstudio.com/products/rstudio/download/",useInternalNodes = T)
#  links = sapply(getNodeSet(page,'//table[@class="downloads"]/thead/tr/th[text()="Installers"]/../../..//a[contains(@href,".deb")]'),xmlGetAttr,'href')
#  md5sums = sapply(getNodeSet(page,'//table[@class="downloads"]/thead/tr/th[text()="Installers"]/../../..//a[contains(@href,".deb")]/../..//code'),xmlValue)
#  print(cbind(links,md5sums))
#
#######################

pkgname=rstudio-desktop-preview-bin
pkgver=1.2.1320
pkgrel=1
pkgdesc="An integrated development environment (IDE) for R (binary version from RStudio official repository)"
arch=('x86_64')
license=('GPL')
url="http://www.rstudio.org/"
depends=('r' 'hicolor-icon-theme' 'libxcomposite' 'libxslt' 'shared-mime-info' 'libxrandr')
#makedepends=('patchelf')
optdepends=('pandoc: markdown support'
            'pandoc-citeproc: markdown support')
conflicts=('rstudio-desktop' 'rstudio-desktop-git' 'rstudio-desktop-bin')
provides=("rstudio-desktop=${pkgver}")
options=(!strip)

md5sums_x86_64=('70223569b3c42397739ad34f003e0094')

source_x86_64=("https://s3.amazonaws.com/rstudio-ide-build/desktop/trusty/amd64/rstudio-${pkgver}-amd64.deb")

package() {

	shopt -s extglob

  msg "Converting debian package..."

  ar x rstudio-${pkgver}-amd64.deb

  cd "$srcdir"
  tar Jxf data.tar.xz -C "$pkgdir"
  install -dm755 "$pkgdir/usr/bin"

  # libgstreamer is no dep anymore since v1.2

  # ARCH=${CARCH/686/386/}
  # ARCH=${ARCH/x86_64/amd64}
  #
  # ar x libgstreamer0.10-0_0.10.36-1.2ubuntu3_${ARCH}.deb
  # tar Jxf data.tar.xz \
  #     --wildcards \
  #     -C "${pkgdir}/usr/lib/rstudio/bin" \
  #     ./usr/lib/${CARCH/686/386}-linux-gnu/libgstreamer-0.10.so.\* \
  #     ./usr/lib/${CARCH/686/386}-linux-gnu/libgstbase-0.10.so.\* \
  #     --strip-components=4
  #
  # ar x libgstreamer-plugins-base0.10-0_0.10.36-1.1ubuntu2.1_${ARCH}.deb
  # tar Jxf data.tar.xz \
  #     --wildcards \
  #     -C "${pkgdir}/usr/lib/rstudio/bin" \
  #     ./usr/lib/${CARCH/686/386/}-linux-gnu/libgstapp-0.10.so.\* \
  #     ./usr/lib/${CARCH/686/386/}-linux-gnu/libgstinterfaces-0.10.so.\* \
  #     ./usr/lib/${CARCH/686/386/}-linux-gnu/libgstpbutils-0.10.so.\* \
  #     ./usr/lib/${CARCH/686/386/}-linux-gnu/libgstvideo-0.10.so.\* \
  #     --strip-components=4

  #cd "$pkgdir/usr/lib/rstudio/bin"
  #ln -sf /usr/lib/libncursesw.so.6 libtinfo.so.5
  #ln -sf /usr/lib/libedit.so.0  libedit.so.2

#  cd "$pkgdir/usr/lib/rstudio/bin/rsclang"
#  patchelf --set-rpath '$ORIGIN/..' libclang.so

  cd "$pkgdir/usr/lib/rstudio/bin/pandoc"
  ln -sf /usr/bin/pandoc ./
  ln -sf /usr/bin/pandoc-citeproc ./

#  cd "$pkgdir/usr/lib/rstudio/bin/plugins"
#  ls */*.so | xargs -n1 patchelf --set-rpath '$ORIGIN/../..'

  find "$pkgdir/usr" -type d -print0 | xargs -0 chmod 755
  find "$pkgdir/usr" -type f -name '*.so.*' -print0 | xargs -0 chmod 644

  # deprecated with v1.2.x
  # cd "$pkgdir/usr/lib/rstudio/bin"
  # ls libQt*.so.*| grep '\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}$'|
  # while read x;do
  #   if [[ ! -e "${x%.+([0-9]).+([0-9])}" ]];then
  #     ln -s "$x" "${x%.+([0-9]).+([0-9])}"
  #   fi
  # done
  # ls lib*.so.* | grep '\.so\.[0-9]\{1,\}\.[0-9]\{1,\}$'|
  # while read x;do
  #   if [[ ! -e "${x%.+([0-9])}" ]];then
  #     ln -s "$x" "${x%.+([0-9])}"
  #   fi
  # done

  # this throwed an error in v1.1.444
  # ln -sf /usr/lib/qt/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so plugins/platforminputcontexts/
  # ls /usr/lib/libFcitxQt5WidgetsAddons.so{,.*} \
  #     /usr/lib/libFcitxQt5DBusAddons.so{,.*} |
  #     while read x;do
  #         ln -sf "$x" ./
  #     done


  cd "$pkgdir/usr/bin"
  #ln -s -f ../lib/rstudio/bin/rstudio rstudio-bin
  echo '#!/bin/sh
export QT_DIR=/usr/lib/rstudio/bin
export QT_PLUGIN_PATH=$QT_DIR/plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_PLUGIN_PATH/platforms
export KDEDIRS=/usr
exec /usr/lib/rstudio/bin/rstudio "$@"
' > "$pkgdir/usr/bin/rstudio-bin"
  chmod 755 "$pkgdir/usr/bin/rstudio-bin"

  sed -i 's|/usr/lib/rstudio/bin/rstudio|/usr/bin/rstudio-bin|' "$pkgdir/usr/share/applications/rstudio.desktop"
}