diff --git a/Makefile b/Makefile index cc0089f2..7358cac6 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ $(eval $(call mkabspath,GLUON_PATCHESDIR)) GLUON_MULTIDOMAIN ?= 0 GLUON_DEBUG ?= 0 +GLUON_MINIFY ?= 1 # Can be overridden via environment/command line/... to use the Gluon # build system for non-Gluon builds @@ -53,7 +54,7 @@ src-link gluon_base ../../package endef GLUON_VARS = \ - GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_DEBUG GLUON_DEPRECATED GLUON_DEVICES \ + GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_DEBUG GLUON_MINIFY GLUON_DEPRECATED GLUON_DEVICES \ GLUON_TARGETSDIR GLUON_PATCHESDIR GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR \ GLUON_SITEDIR GLUON_RELEASE GLUON_BRANCH GLUON_LANGS GLUON_BASE_FEEDS \ GLUON_TARGET BOARD SUBTARGET diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index b48c2674..f4be37fd 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -212,6 +212,12 @@ GLUON_DEBUG Setting ``GLUON_DEBUG=1`` will provide firmware images including debugging symbols usable with GDB or similar tools. Requires a device or target with at least 16 MB of flash space, e.g. `x86-64`. Unset by default. +GLUON_MINIFY + Setting ``GLUON_MINIFY=0`` will omit the minification of scripts during the build process. By + default the flag is set to ``1``. Disabling the flag is handy if human readable scripts on the + devices are desired for development purposes. Be aware that this will increase the size of the + resulting images and is therefore not suitable for devices with small flash chips. + GLUON_DEVICES List of devices to build. The list contains the Gluon profile name of a device, the profile name is the first parameter of the ``device`` command in a target file. diff --git a/package/gluon-core/Config.in b/package/gluon-core/Config.in index 3f381f92..95465146 100644 --- a/package/gluon-core/Config.in +++ b/package/gluon-core/Config.in @@ -347,3 +347,7 @@ config GLUON_SPECIALIZE_KERNEL select KERNEL_IP_NF_NAT select KERNEL_IP_NF_TARGET_MASQUERADE select KERNEL_IP_NF_TARGET_REDIRECT + +config GLUON_MINIFY + bool "Minify Gluon scripts" + default y diff --git a/package/gluon-status-page/Makefile b/package/gluon-status-page/Makefile index 923f68c7..c30229e3 100644 --- a/package/gluon-status-page/Makefile +++ b/package/gluon-status-page/Makefile @@ -10,12 +10,18 @@ define Package/gluon-status-page DEPENDS:=+gluon-web +gluon-neighbour-info +gluon-respondd +uhttpd +sse-multiplex +libiwinfo +libjson-c +libnl-tiny +libubus-lua endef +PKG_CONFIG_DEPENDS += CONFIG_GLUON_MINIFY + define Package/gluon-status-page/install $(Gluon/Build/Install) $(INSTALL_DIR) $(1)/lib/gluon/status-page/providers $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations $(1)/lib/gluon/status-page/providers/ +ifndef CONFIG_GLUON_MINIFY + $(CP) ./javascript/status-page.js $(1)/lib/gluon/status-page/www/static/status-page.js +endif + $(INSTALL_DIR) $(1)/lib/gluon/status-page/view/ $(LN) /lib/gluon/web/i18n $(1)/lib/gluon/status-page/ $(LN) /lib/gluon/web/view/error $(1)/lib/gluon/status-page/view/ diff --git a/package/gluon.mk b/package/gluon.mk index 7246a318..b69caa81 100644 --- a/package/gluon.mk +++ b/package/gluon.mk @@ -3,6 +3,10 @@ PKG_FILE_DEPENDS += $(GLUON_MK) PKG_BUILD_DEPENDS += luasrcdiet/host +ifneq ($(wildcard ./luasrc/.),) + PKG_CONFIG_DEPENDS += CONFIG_GLUON_MINIFY +endif + ifneq ($(wildcard ./src/respondd.c),) PKG_BUILD_DEPENDS += respondd endif @@ -57,12 +61,14 @@ endef define GluonSrcDiet rm -rf $(2) $(CP) $(1) $(2) +ifdef CONFIG_GLUON_MINIFY $(FIND) $(2) -type f | while read src; do \ if luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; then \ chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \ mv "$$$$src.o" "$$$$src"; \ fi; \ done +endif endef diff --git a/targets/generic b/targets/generic index fc4ed0ea..7672833d 100644 --- a/targets/generic +++ b/targets/generic @@ -60,6 +60,9 @@ if istrue(env.GLUON_DEBUG) then try_config 'CONFIG_TARGET_ROOTFS_PARTSIZE=500' end +if not istrue(env.GLUON_MINIFY) then + config '# CONFIG_GLUON_MINIFY is not set' +end packages { '-odhcpd-ipv6only',