Skip to content
Snippets Groups Projects
Unverified Commit 57516fe4 authored by lemoer's avatar lemoer Committed by GitHub
Browse files

Add GLUON_MINIFY flag to allow skipping the minification process (#1916)

parent 992457b2
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,7 @@ $(eval $(call mkabspath,GLUON_PATCHESDIR)) ...@@ -45,6 +45,7 @@ $(eval $(call mkabspath,GLUON_PATCHESDIR))
GLUON_MULTIDOMAIN ?= 0 GLUON_MULTIDOMAIN ?= 0
GLUON_DEBUG ?= 0 GLUON_DEBUG ?= 0
GLUON_MINIFY ?= 1
# Can be overridden via environment/command line/... to use the Gluon # Can be overridden via environment/command line/... to use the Gluon
# build system for non-Gluon builds # build system for non-Gluon builds
...@@ -53,7 +54,7 @@ src-link gluon_base ../../package ...@@ -53,7 +54,7 @@ src-link gluon_base ../../package
endef endef
GLUON_VARS = \ 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_TARGETSDIR GLUON_PATCHESDIR GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR \
GLUON_SITEDIR GLUON_RELEASE GLUON_BRANCH GLUON_LANGS GLUON_BASE_FEEDS \ GLUON_SITEDIR GLUON_RELEASE GLUON_BRANCH GLUON_LANGS GLUON_BASE_FEEDS \
GLUON_TARGET BOARD SUBTARGET GLUON_TARGET BOARD SUBTARGET
......
...@@ -212,6 +212,12 @@ GLUON_DEBUG ...@@ -212,6 +212,12 @@ GLUON_DEBUG
Setting ``GLUON_DEBUG=1`` will provide firmware images including debugging symbols usable with GDB or 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. 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 GLUON_DEVICES
List of devices to build. The list contains the Gluon profile name of a device, the profile 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. name is the first parameter of the ``device`` command in a target file.
......
...@@ -347,3 +347,7 @@ config GLUON_SPECIALIZE_KERNEL ...@@ -347,3 +347,7 @@ config GLUON_SPECIALIZE_KERNEL
select KERNEL_IP_NF_NAT select KERNEL_IP_NF_NAT
select KERNEL_IP_NF_TARGET_MASQUERADE select KERNEL_IP_NF_TARGET_MASQUERADE
select KERNEL_IP_NF_TARGET_REDIRECT select KERNEL_IP_NF_TARGET_REDIRECT
config GLUON_MINIFY
bool "Minify Gluon scripts"
default y
...@@ -10,12 +10,18 @@ define Package/gluon-status-page ...@@ -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 DEPENDS:=+gluon-web +gluon-neighbour-info +gluon-respondd +uhttpd +sse-multiplex +libiwinfo +libjson-c +libnl-tiny +libubus-lua
endef endef
PKG_CONFIG_DEPENDS += CONFIG_GLUON_MINIFY
define Package/gluon-status-page/install define Package/gluon-status-page/install
$(Gluon/Build/Install) $(Gluon/Build/Install)
$(INSTALL_DIR) $(1)/lib/gluon/status-page/providers $(INSTALL_DIR) $(1)/lib/gluon/status-page/providers
$(INSTALL_BIN) $(PKG_BUILD_DIR)/stations $(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/ $(INSTALL_DIR) $(1)/lib/gluon/status-page/view/
$(LN) /lib/gluon/web/i18n $(1)/lib/gluon/status-page/ $(LN) /lib/gluon/web/i18n $(1)/lib/gluon/status-page/
$(LN) /lib/gluon/web/view/error $(1)/lib/gluon/status-page/view/ $(LN) /lib/gluon/web/view/error $(1)/lib/gluon/status-page/view/
......
...@@ -3,6 +3,10 @@ PKG_FILE_DEPENDS += $(GLUON_MK) ...@@ -3,6 +3,10 @@ PKG_FILE_DEPENDS += $(GLUON_MK)
PKG_BUILD_DEPENDS += luasrcdiet/host PKG_BUILD_DEPENDS += luasrcdiet/host
ifneq ($(wildcard ./luasrc/.),)
PKG_CONFIG_DEPENDS += CONFIG_GLUON_MINIFY
endif
ifneq ($(wildcard ./src/respondd.c),) ifneq ($(wildcard ./src/respondd.c),)
PKG_BUILD_DEPENDS += respondd PKG_BUILD_DEPENDS += respondd
endif endif
...@@ -57,12 +61,14 @@ endef ...@@ -57,12 +61,14 @@ endef
define GluonSrcDiet define GluonSrcDiet
rm -rf $(2) rm -rf $(2)
$(CP) $(1) $(2) $(CP) $(1) $(2)
ifdef CONFIG_GLUON_MINIFY
$(FIND) $(2) -type f | while read src; do \ $(FIND) $(2) -type f | while read src; do \
if luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; then \ if luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; then \
chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \ chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \
mv "$$$$src.o" "$$$$src"; \ mv "$$$$src.o" "$$$$src"; \
fi; \ fi; \
done done
endif
endef endef
......
...@@ -60,6 +60,9 @@ if istrue(env.GLUON_DEBUG) then ...@@ -60,6 +60,9 @@ if istrue(env.GLUON_DEBUG) then
try_config 'CONFIG_TARGET_ROOTFS_PARTSIZE=500' try_config 'CONFIG_TARGET_ROOTFS_PARTSIZE=500'
end end
if not istrue(env.GLUON_MINIFY) then
config '# CONFIG_GLUON_MINIFY is not set'
end
packages { packages {
'-odhcpd-ipv6only', '-odhcpd-ipv6only',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment