rexy712-overlay/net-im/riot-web/riot-web-1.5.15.ebuild
2020-04-02 10:50:14 -07:00

107 lines
2.6 KiB
Bash

# Copyright 2019 rexy712
# Distributed under the terms of the GNU General Public License v3
EAPI=6
DESCRIPTION="A glossy Matrix collaboration client for the web"
HOMEPAGE="https://riot.im"
inherit eutils
if [ "${PV}" == "9999" ];then
inherit git-r3
SRC_URI=""
KEYWORDS=""
EGIT_REPO_URI="https://github.com/vector-im/riot-web.git"
EGIT_BRANCH="develop"
else
if [ "${PR}" != "r0" ];then
rc_num="${PR:1}"
MY_PV="${PV}-rc.${rc_num}"
else
MY_PV="${PV}"
fi
MY_PF="${PN}-${MY_PV}"
SRC_URI="https://github.com/vector-im/riot-web/archive/v${MY_PV}.tar.gz -> ${MY_PF}.tar.gz" #change source tar file name to include package name
KEYWORDS="~amd64"
fi
LICENSE="Apache-2.0"
SLOT="0"
IUSE="+emoji proxy +darkmode +labs +savedconfig"
REQUIRED_USE=""
RESTRICT="network-sandbox" #need network sandbox disabled for `yarn install` to work
DEPEND="sys-devel/binutils:*
>=net-libs/nodejs-13.0
>=sys-apps/yarn-1.20
x11-libs/libXScrnSaver
net-print/cups
dev-libs/nss
gnome-base/gconf
emoji? ( >=media-fonts/noto-emoji-20180823 )
>=media-video/ffmpeg-4.0
|| ( dev-util/electron-bin-next:7 dev-util/electron-next:7 )"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/riot-1.5.6-icon-path.patch"
)
DESTINATION="/opt/Riot"
src_prepare() {
if ! use "proxy";then
my_proxy=""
else
my_proxy="$http_proxy"
fi
http_proxy="$my_proxy" yarn install || die "Yarn module installation failed"
pushd electron_app >/dev/null 2>&1 || die
http_proxy="$my_proxy" yarn install || die "Yarn module installation failed"
popd >/dev/null 2>&1 || die
[ "${PV}" == "9999" ] && "${S}"/scripts/fetch-develop.deps.sh
if [ -e "${DESTINATION}/webapp/config.json" ] && use savedconfig;then
cp "${DESTINATION}/webapp/config.json" "${S}"/config.json
else
cp "${S}"/config.sample.json "${S}"/config.json
use "darkmode" && sed -e 's/^\([[:space:]]*"default_theme":[[:space:]]*\)"light"/\1"dark"/' "${S}"/config.json -i
use "labs" && sed -e 's/^\([[:space:]]*"showLabsSettings":[[:space:]]*\)false/\1true/' "${S}"/config.json -i
fi
if [ "${PV}" == "9999" ];then
#skip built in patches
eapply_user
else
default
fi
}
src_compile() {
yarn build || die "Build failed"
}
src_install() {
insinto "${DESTINATION}"
doins -r "${S}/webapp"
doins -r "${S}/electron_app"
cp "${FILESDIR}"/runscript.sh "${S}/${PN}"
sed -e 's@{::install_location::}@'"${DESTINATION}"'@g' "${S}/${PN}" -i
insopts "-m755"
doins "${S}/${PN}"
insinto "${DESTINATION}/electron_app"
cp "${FILESDIR}/${PN}.desktop" "${T}"
sed -e 's@{::install_location::}@'"${DESTINATION}"'@g' "${T}/${PN}.desktop" -i
domenu "${T}/${PN}.desktop"
dosym "${DESTINATION}/${PN}" "/usr/bin/${PN}"
}