62 lines
1.7 KiB
PHP
62 lines
1.7 KiB
PHP
DESCRIPTION = "Dieser Server stellt die Weboberfläche für die TSGRain-Bewässerungssteuerung zur Verfügung"
|
|
HOMEPAGE = "https://code.thetadev.de/TSGRain/WebUI"
|
|
|
|
LICENSE = "MIT"
|
|
LIC_FILES_CHKSUM = "file://LICENSE;md5=5cd1e0cad83b5a9f21c1b2bb1ae9cde3"
|
|
|
|
UPSTREAM_CHECK_URI = "https://code.thetadev.de/TSGRain/WebUI/tags"
|
|
|
|
SRC_URI:append = " file://tsgrain-webui.service \
|
|
file://tsgrain_web.toml"
|
|
|
|
S = "${WORKDIR}/webui"
|
|
|
|
DEPENDS = "nodejs-native"
|
|
inherit go systemd
|
|
|
|
GOBUILDFLAGS += "-tags prod"
|
|
GO_LINKMODE += "-X code.thetadev.de/TSGRain/WebUI/src/util.version=v${PV}"
|
|
export GOPATH = "${WORKDIR}/go"
|
|
|
|
export NPM_CONFIG_CACHE = "${WORKDIR}/npm-cache"
|
|
export NPM_CONFIG_STORE_DIR = "${WORKDIR}/pnpm-cache"
|
|
|
|
do_configure() {
|
|
mkdir -p ${WORKDIR}/go
|
|
mkdir -p ${WORKDIR}/npm-cache
|
|
|
|
cd ${S}/ui
|
|
npm install pnpm
|
|
}
|
|
|
|
do_compile() {
|
|
# Build ui
|
|
cd ${S}/ui
|
|
npx pnpm install
|
|
VITE_VERSION=v${PV} npx pnpm run build
|
|
|
|
# Build server
|
|
${GO} build ${GO_LINKSHARED} ${GOBUILDFLAGS} -o ${WORKDIR}/build/tsgrain-webui ${S}/src/.
|
|
|
|
${GO} clean -modcache
|
|
}
|
|
|
|
do_install() {
|
|
install -d ${D}${bindir} ${D}${systemd_unitdir}/system/
|
|
|
|
install -m 755 ${WORKDIR}/build/tsgrain-webui ${D}${bindir}
|
|
|
|
install -m 644 ${WORKDIR}/tsgrain-webui.service ${D}${systemd_unitdir}/system/
|
|
sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_unitdir}/system/tsgrain-webui.service
|
|
|
|
# Install config file to appfs
|
|
install -D -m 644 ${WORKDIR}/tsgrain_web.toml ${D}/data/tsgrain/tsgrain_web.toml
|
|
}
|
|
|
|
FILES_${PN} += "${systemd_unitdir}/system/tsgrain-webui.service \
|
|
/data/tsgrain/tsgrain_web.toml"
|
|
|
|
SYSTEMD_SERVICE_${PN} = "tsgrain-webui.service"
|
|
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
|
|
|
|
RDEPENDS_${PN} += "tsgrain-controller"
|