[Libreoffice-commits] online.git: loleaflet/loleaflet-src.js.m4 loleaflet/Makefile.am

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 2 15:51:51 UTC 2020


 loleaflet/Makefile.am         |   13 ++++++++-----
 loleaflet/loleaflet-src.js.m4 |   13 +++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

New commits:
commit 3697315349720ddadada8ef8e88f9d471c1c5baf
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Feb 21 13:57:58 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Mon Mar 2 16:51:32 2020 +0100

    loleaflet: makefile: use m4 to bundle src js files
    
    It is a flexible bundling of the loleafet source files
    and each platform (ANDROID, IOS, DESKTOP) can prevent to
    bundle some files that is not necessary.
    
    (i.e Mouse handling in native mobile devices)
    
    Change-Id: If018bcc8682df5ae4bf5dd9943aa977e18c0de36
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89734
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Henry Castro <hcastro at collabora.com>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 618bbd093..2710f180e 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -357,11 +357,14 @@ $(LOLEAFLET_PREFIX)/dist/loleaflet-src.js: $(LOLEAFLET_JS_SRC)
 	@echo "Checking for loleaflet JS errors..."
 	@NODE_PATH=$(abs_builddir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(srcdir)/src \
 		$(srcdir)/js --ignore-path $(srcdir)/.eslintignore --config $(srcdir)/.eslintrc
-	@(cat $(srcdir)/src/copyright.js | sed 's/{VERSION}/$(LOLEAFLET_VERSION)/' - \
-		&& echo "(function (window, document, undefined) {" \
-		&& awk 'FNR == 1 {print ""} 1' \
-		$(patsubst %.js,$(srcdir)/%.js,$(LOLEAFLET_JS)) \
-		&& echo "}(window, document));") > $@
+	@m4 -PE -DIOSAPP=$(ENABLE_IOSAPP) \
+		-DGTKAPP=$(ENABLE_GTKAPP) \
+		-DANDROIDAPP=$(ENABLE_ANDROIDAPP) \
+		-DMOBILEAPPNAME="$(APP_NAME)" \
+		-DVERSION=$(LOLEAFLET_VERSION) \
+		-DCOPYRIGHT=$(srcdir)/src/copyright.js \
+		-DLOLEAFLET_JS=$(subst $(SPACE),$(COMMA),$(patsubst %.js,$(srcdir)/%.js,$(LOLEAFLET_JS))) \
+		$(srcdir)/loleaflet-src.js.m4 > $@
 
 $(builddir)/dist/bundle.css: $(LOLEAFLET_CSS)
 	@echo "Uglify loleaflet css files..."
diff --git a/loleaflet/loleaflet-src.js.m4 b/loleaflet/loleaflet-src.js.m4
new file mode 100644
index 000000000..02c674545
--- /dev/null
+++ b/loleaflet/loleaflet-src.js.m4
@@ -0,0 +1,13 @@
+m4_changequote([,])m4_dnl
+m4_dnl# m4_foreachq(x, `item_1, item_2, ..., item_n', stmt)
+m4_dnl# quoted list, alternate improved version
+m4_define([m4_foreachq],[m4_ifelse([$2],[],[],[m4_pushdef([$1])_$0([$1],[$3],[],$2)m4_popdef([$1])])])m4_dnl
+m4_define([_m4_foreachq],[m4_ifelse([$#],[3],[],[m4_define([$1],[$4])$2[]$0([$1],[$2],m4_shift(m4_shift(m4_shift($@))))])])m4_dnl
+m4_dnl
+m4_include(COPYRIGHT)m4_dnl
+
+(function (window) {
+
+m4_foreachq([fileJS],[LOLEAFLET_JS],[m4_syscmd([cat ]fileJS)])
+
+}(window));


More information about the Libreoffice-commits mailing list