[build] Add "--with-prebuilt-webinterface" configure flag to force usage of prebuilt web UI

This commit is contained in:
Christian Meffert 2025-01-28 19:21:08 +00:00
parent a146356ca0
commit 4500251b3f
2 changed files with 25 additions and 8 deletions

View File

@ -333,14 +333,31 @@ OWNTONE_ARG_DISABLE([include default web interface], [webinterface], [WEBINTERFA
[AS_IF([[test -f "$srcdir/web-src/htdocs/index.html"]], [AS_IF([[test -f "$srcdir/web-src/htdocs/index.html"]],
[AM_MISSING_PROG([NPM], [[npm]]) [AM_MISSING_PROG([NPM], [[npm]])
AC_MSG_NOTICE([[ AC_MSG_NOTICE([[
npm not found, but a prebuilt web interface seems to be present. npm not found, but a prebuilt web interface is present.
If you modify any web interface files, you will need to install it. If you modify any web interface source files, you will need to install npm.
]])], ]])],
[AC_MSG_ERROR([[npm required, please install it.]])]) [AC_MSG_ERROR([[npm required, please install it.]])])
] ]
)]) )])
AM_CONDITIONAL([COND_WEBINTERFACE], [[test "x$enable_webinterface" = "xyes"]]) AM_CONDITIONAL([COND_WEBINTERFACE], [[test "x$enable_webinterface" = "xyes"]])
dnl Use prebuilt webinterface even if npm is available
AC_ARG_WITH([prebuilt-webinterface],
[AS_HELP_STRING([--with-prebuilt-webinterface],
[Use prebuilt webinterface even if npm is available (default=no)]
)],
[AS_IF([[test -f "$srcdir/web-src/htdocs/index.html"]],
[[with_prebuilt_webinterface=yes]],
[AC_MSG_ERROR([[No prebuilt web interface found.]])]
)],
[[with_prebuilt_webinterface=]])
if test "x$with_prebuilt_webinterface" = "xyes"; then
BUILD_WEBINTERFACE=
else
BUILD_WEBINTERFACE=true
fi
AC_SUBST([BUILD_WEBINTERFACE])
dnl Creating and defining users and groups dnl Creating and defining users and groups
OWNTONE_ARG_ENABLE([having 'make install' add user/group and 'make uninstall' delete], [install_user], [INSTALL_USER], OWNTONE_ARG_ENABLE([having 'make install' add user/group and 'make uninstall' delete], [install_user], [INSTALL_USER],
[AC_PATH_PROG([GETENT], [[getent]], [], [$PATH$PATH_SEPARATOR/usr/sbin]) [AC_PATH_PROG([GETENT], [[getent]], [], [$PATH$PATH_SEPARATOR/usr/sbin])

View File

@ -177,19 +177,19 @@ node_modules: $(PACKAGE_JSON)
cp "$$src_path" "$$dest_path"; \ cp "$$src_path" "$$dest_path"; \
done; \ done; \
fi fi
$(if $(NPM),$(NPM) clean-install) $(if $(BUILD_WEBINTERFACE),$(NPM) clean-install)
# Build the Vue.js application # Build the Vue.js application
htdocs: node_modules $(WEB_FILES) htdocs: node_modules $(WEB_FILES)
$(if $(NPM),$(NPM) run build) $(if $(BUILD_WEBINTERFACE),$(NPM) run build)
web: htdocs web: htdocs
web-serve: node_modules web-serve: node_modules
$(if $(NPM),$(NPM) run serve) $(if $(BUILD_WEBINTERFACE),$(NPM) run serve)
web-update: web-update:
$(if $(NPM),$(NPM) update) $(if $(BUILD_WEBINTERFACE),$(NPM) update)
web-check: web-check:
@echo "Verifying that all source files in 'src' and 'public' are listed in WEB_FILES ..." @echo "Verifying that all source files in 'src' and 'public' are listed in WEB_FILES ..."
@ -208,10 +208,10 @@ web-check:
fi fi
web-lint: node_modules web-lint: node_modules
$(if $(NPM),$(NPM) run lint --no-fix) $(if $(BUILD_WEBINTERFACE),$(NPM) run lint --no-fix)
web-format: node_modules web-format: node_modules
$(if $(NPM),$(NPM) run format) $(if $(BUILD_WEBINTERFACE),$(NPM) run format)
all-local: htdocs all-local: htdocs