Add riot-web live ebuild

This commit is contained in:
rexy712 2019-10-26 08:15:34 -07:00
parent ac7b4ab3bf
commit 066fdbf5d8
4 changed files with 168 additions and 48 deletions

View File

@ -8,16 +8,25 @@ HOMEPAGE="https://riot.im"
inherit eutils
if [ "${PR}" != "r0" ];then
rc_num="${PR:1}"
MY_PV="${PV}-rc.${rc_num}"
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
MY_PV="${PV}"
fi
MY_PF="${PN}-${MY_PV}"
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
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"
@ -70,16 +79,10 @@ src_prepare() {
if use "proxy";then
yarn install || die "Yarn module installation failed"
[ "${PV}" == "9999" ] && "${S}"/scripts/fetch-develop.deps.sh
else
http_proxy="" yarn install || die "Yarn module installation failed"
fi
if [[ "${PV}" == "9999" ]]; then
if use "proxy";then
"${S}"/scripts/fetch-develop.deps.sh
else
http_proxy="" "${S}"/scripts/fetch-develop.deps.sh
fi
[ "${PV}" == "9999" ] && { http_proxy=""; "${S}"/scripts/fetch-develop.deps.sh; }
fi
if [ -e "${DESTINATION}/config.json" ] && use savedconfig;then

View File

@ -8,16 +8,25 @@ HOMEPAGE="https://riot.im"
inherit eutils
if [ "${PR}" != "r0" ];then
rc_num="${PR:1}"
MY_PV="${PV}-rc.${rc_num}"
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
MY_PV="${PV}"
fi
MY_PF="${PN}-${MY_PV}"
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
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"
@ -70,16 +79,10 @@ src_prepare() {
if use "proxy";then
yarn install || die "Yarn module installation failed"
[ "${PV}" == "9999" ] && "${S}"/scripts/fetch-develop.deps.sh
else
http_proxy="" yarn install || die "Yarn module installation failed"
fi
if [[ "${PV}" == "9999" ]]; then
if use "proxy";then
"${S}"/scripts/fetch-develop.deps.sh
else
http_proxy="" "${S}"/scripts/fetch-develop.deps.sh
fi
[ "${PV}" == "9999" ] && { http_proxy=""; "${S}"/scripts/fetch-develop.deps.sh; }
fi
if [ -e "${DESTINATION}/config.json" ] && use savedconfig;then

View File

@ -8,16 +8,25 @@ HOMEPAGE="https://riot.im"
inherit eutils
if [ "${PR}" != "r0" ];then
rc_num="${PR:1}"
MY_PV="${PV}-rc.${rc_num}"
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
MY_PV="${PV}"
fi
MY_PF="${PN}-${MY_PV}"
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
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"
@ -70,16 +79,10 @@ src_prepare() {
if use "proxy";then
yarn install || die "Yarn module installation failed"
[ "${PV}" == "9999" ] && "${S}"/scripts/fetch-develop.deps.sh
else
http_proxy="" yarn install || die "Yarn module installation failed"
fi
if [[ "${PV}" == "9999" ]]; then
if use "proxy";then
"${S}"/scripts/fetch-develop.deps.sh
else
http_proxy="" "${S}"/scripts/fetch-develop.deps.sh
fi
[ "${PV}" == "9999" ] && { http_proxy=""; "${S}"/scripts/fetch-develop.deps.sh; }
fi
if [ -e "${DESTINATION}/config.json" ] && use savedconfig;then

View File

@ -0,0 +1,111 @@
# 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-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"
[ "${PV}" == "9999" ] && "${S}"/scripts/fetch-develop.deps.sh
else
http_proxy="" yarn install || die "Yarn module installation failed"
[ "${PV}" == "9999" ] && { http_proxy=""; "${S}"/scripts/fetch-develop.deps.sh; }
fi
if [ -e "${DESTINATION}/config.json" ] && use savedconfig;then
cp "${DESTINATION}/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
}
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}"
}