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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
#!/bin/bash
# Slackware build script for rstudio-desktop
# Copyright 2018 Ekin Akoglu, Erdemli/Mersin, Turkey <ekinakoglu@gmail.com>
# Copyright 2022 Isaac Yu <isaacyu1@isaacyu1.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=rstudio-desktop
SRCNAM=rstudio
VERSION=${VERSION:-2022.02.1+461}
SRCVER=${SRCVER:-$(echo $VERSION | sed 's/+/-/g')}
GITCOMMIT_VER=fc9e217
GWT_SDK_VER=${GWT_SDK_VER:-2.8.2}
NODE_VER=${NODE_VER:-14.17.5}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$SRCVER
tar xvf $CWD/$SRCNAM-$SRCVER.tar.gz
cd $SRCNAM-$SRCVER
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
GWT_DIR=src/gwt
LIB_DIR=$GWT_DIR/lib
mkdir -p $LIB_DIR
GWT_SDK_ZIP=$CWD/gwt-$GWT_SDK_VER.zip
mkdir -p $LIB_DIR/gwt
unzip -qo $GWT_SDK_ZIP -d $LIB_DIR/gwt
mv $LIB_DIR/gwt/gwt-$GWT_SDK_VER $LIB_DIR/gwt/$GWT_SDK_VER
patch -p1 < $CWD/sigstksz_gcc11.patch
cd dependencies/common
PANDOCVER=$(grep -oP "(?<=PANDOC_VERSION=\").*(?=\"$)" install-pandoc)
mkdir -p pandoc/$PANDOCVER
ln -sfT /usr/share/myspell/dicts dictionaries
ln -sfT /usr/share/mathjax2 mathjax-27
ln -sfT /usr/bin/pandoc pandoc/$PANDOCVER/pandoc
mkdir -p node
cd node && tar xvf $CWD/node-v$NODE_VER-linux-x64.tar.gz
cd ../
mv node/node-v$NODE_VER-linux-x64 node/$NODE_VER
cd $TMP/$SRCNAM-$SRCVER/src/gwt/panmirror/src/editor
yarn config set ignore-engines true
yarn install
# Fix links for src/cpp/session/CMakeLists.txt
cd $TMP/$SRCNAM-$SRCVER/dependencies
ln -sfT common/dictionaries dictionaries
ln -sfT common/mathjax-27 mathjax-27
ln -sfT common/pandoc pandoc
cd $TMP/$SRCNAM-$SRCVER
# Environmental variables (RStudio version numbers, architecture, etc.)
VERSION_AWK=${VERSION_AWK:-$(echo $VERSION | sed 's/+/\.+/g')}
export RSTUDIO_VERSION_MAJOR=$(echo $VERSION_AWK | awk -F '.' '{print $1}')
export RSTUDIO_VERSION_MINOR=$(echo $VERSION_AWK | awk -F '.' '{print $2}')
export RSTUDIO_VERSION_PATCH=$(echo $VERSION_AWK | awk -F '.' '{print $3}')
export RSTUDIO_VERSION_SUFFIX=$(echo $VERSION_AWK | awk -F '.' '{print $4}')
export GIT_COMMIT=$GITCOMMIT_VER
export PACKAGE_OS=$(uname -om)
# Ensure that RStudio builds successfully on multilib systems
QT5_CORE=-DQt5Core_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Core
QT5_DBUS=-DQt5DBus_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5DBus
QT5_GUI=-DQt5Gui_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Gui
QT5_NETWORK=-DQt5Network_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Network
QT5_OPENGL=-DQt5OpenGL_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5OpenGL
QT5_POSITIONING=-DQt5Positioning_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Positioning
QT5_PRINTSUPPORT=-DQt5PrintSupport_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5PrintSupport
QT5_QMLMODELS=-DQt5QmlModels_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5QmlModels
QT5_QML=-DQt5Qml_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Qml
QT5_QUICKWIDGETS=-DQt5QuickWidgets_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5QuickWidgets
QT5_QUICK=-DQt5Quick_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Quick
QT5_SENSORS=-DQt5Sensors_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Sensors
QT5_SQL=-DQt5Sql_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Sql
QT5_SVG=-DQt5Svg_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Svg
QT5_WEBCHANNEL=-DQt5WebChannel_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5WebChannel
QT5_WEBENGINECORE=-DQt5WebEngineCore_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5WebEngineCore
QT5_WEBENGINEWIDGETS=-DQt5WebEngineWidgets_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5WebEngineWidgets
QT5_WEBENGINE=-DQt5WebEngine_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5WebEngine
QT5_WIDGETS=-DQt5Widgets_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Widgets
QT5_XMLPATTERNS=-DQt5XmlPatterns_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5XmlPatterns
QT5_XML=-DQt5Xml_DIR:PATH=/usr/lib${LIBDIRSUFFIX}/cmake/Qt5Xml
MULTILIB=($QT5_CORE $QT5_DBUS $QT5_GUI $QT5_NETWORK $QT5_NETWORK $QT5_OPENGL \
$QT5_POSITIONING $QT5_PRINTSUPPORT $QT5_QMLMODELS $QT5_QML $QT5_QUICKWIDGETS \
$QT5_QUICK $QT5_SENSORS $QT5_SQL $QT5_SVG $QT5_WEBCHANNEL $QT5_WEBENGINECORE \
$QT5_WEBENGINEWIDGETS $QT5_WEBENGINE $QT5_WIDGETS $QT5_XMLPATTERNS $QT5_XML)
mkdir -p build
cd build
cmake -S "$TMP/$SRCNAM-$SRCVER" \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DRSTUDIO_TARGET=Desktop \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/lib/rstudio \
-DRSTUDIO_USE_SYSTEM_BOOST=yes \
-DRSTUDIO_USE_SYSTEM_YAML_CPP=yes \
-DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt5 \
-DBoost_NO_BOOST_CMAKE=ON \
-DQUARTO_ENABLED=FALSE \
-DRSTUDIO_USE_SYSTEM_SOCI=yes \
-DRSTUDIO_BUNDLE_QT=FALSE \
${MULTILIB[@]}
make
make install DESTDIR=$PKG
cd ..
mkdir -p $PKG/usr/bin
ln -sf /usr/lib/rstudio/bin/rstudio $PKG/usr/bin
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
$PKG/usr/lib/rstudio/{COPYING,INSTALL,NOTICE,README.md,SOURCE} \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|