# 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 [ "${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" LICENSE="Apache-2.0" SLOT="0" IUSE="+emoji proxy" REQUIRED_USE="" RESTRICT="network-sandbox" #need network sandbox disabled for `yarn install` to work DEPEND="sys-devel/binutils:* >=net-libs/nodejs-10.0 >=sys-apps/yarn-1.15 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 dev-util/electron-bin )" RDEPEND="${DEPEND}" DESTINATION="/opt/Riot" #create sh file to run the webapp in an electron window create_the_executable_file() { echo -e '#!/bin/sh install_location="'"${DESTINATION}"'" if [ ! -d "$install_location" ];then echo -n "Could not chdir to install location: " >&2 if [ ! -e "$install_location" ];then echo "No such file or directory" >&2 else echo "Not a directory" >&2 fi exit 1 fi cd "$install_location" if [ ! -e 'index.html' ];then echo "Could not find index.html in '$install_location'" >&2 exit 2 fi exec electron index.html\n' > "${1}" } src_prepare() { default if use "proxy";then yarn install || die "Yarn module installation failed" else http_proxy="" yarn install || die "Yarn module installation failed" fi if [[ "${PV}" == "9999" ]]; then "${S}"/scripts/fetch-develop.deps.sh fi if [ -e "${DESTINATION}/config.json" ];then cp "${DESTINATION}/config.json" "${S}"/config.json else cp "${S}"/config.sample.json "${S}"/config.json fi } src_compile() { yarn build || die "Build failed" } src_install() { insinto "${DESTINATION}" doins -r "${S}/webapp/"* create_the_executable_file "${S}/webapp/${PN}" insopts "-m755" doins "${S}/webapp/${PN}" dosym "${DESTINATION}/${PN}" "/usr/bin/${PN}" }