b9a15de
From 375f363df04c51b4f20b68dd567070d9e912e037 Mon Sep 17 00:00:00 2001
b9a15de
From: Petr Vobornik <pvoborni@redhat.com>
b9a15de
Date: Wed, 31 Jul 2013 15:12:19 +0200
b9a15de
Subject: [PATCH] Increase stack size for Web UI builder
b9a15de
b9a15de
Web UI build fails on some architectures or configuration due to
b9a15de
StackOverflow. This patch increases the stack size to solve it.
b9a15de
b9a15de
512k is usually enough but we encountered fail on ppc64 even with 2m,
b9a15de
therefore the 8m. The build is single threaded so it shouldn't waste
b9a15de
much memory.
b9a15de
---
b9a15de
 Makefile                        | 5 +++++
b9a15de
 install/ui/util/build.sh        | 5 +++--
b9a15de
 install/ui/util/uglifyjs/uglify | 9 +++++----
b9a15de
 3 files changed, 13 insertions(+), 6 deletions(-)
b9a15de
b9a15de
diff --git a/Makefile b/Makefile
b9a15de
index a7226341e6bd10106309997aae558fc07239482d..e54f8f0ba6484a12343f389b3cffbc20d7420a5f 100644
b9a15de
--- a/Makefile
b9a15de
+++ b/Makefile
b9a15de
@@ -55,6 +55,11 @@ PYTHON ?= $(shell rpm -E %__python || echo /usr/bin/python)
b9a15de
 CFLAGS := -g -O2 -Werror -Wall -Wextra -Wformat-security -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers $(CFLAGS)
b9a15de
 export CFLAGS
b9a15de
 
b9a15de
+# Uncomment to increase Java stack size for Web UI build in case it fails
b9a15de
+# because of stack overflow exception. Default should be OK for most platforms.
b9a15de
+#JAVA_STACK_SIZE ?= 8m
b9a15de
+#export JAVA_STACK_SIZE
b9a15de
+
b9a15de
 all: bootstrap-autogen server tests
b9a15de
 	@for subdir in $(SUBDIRS); do \
b9a15de
 		(cd $$subdir && $(MAKE) $@) || exit 1; \
b9a15de
diff --git a/install/ui/util/build.sh b/install/ui/util/build.sh
b9a15de
index 7cd623485a8a87872e29d32f529bd77a45d59810..03776c1fe54f750cf028981bce625702af32aa1d 100755
b9a15de
--- a/install/ui/util/build.sh
b9a15de
+++ b/install/ui/util/build.sh
b9a15de
@@ -31,5 +31,6 @@ if [[ ! $profile ]] ; then
b9a15de
     exit 1
b9a15de
 fi
b9a15de
 
b9a15de
-rhino $DIR/build/build.js baseUrl=$DIR/build load=build profile=$DIR/../src/$profile.profile.js
b9a15de
-exit $?
b9a15de
\ No newline at end of file
b9a15de
+RHINO="java -Xss${JAVA_STACK_SIZE:-512k} -classpath /usr/share/java/rhino.jar  org.mozilla.javascript.tools.shell.Main"
b9a15de
+$RHINO $DIR/build/build.js baseUrl=$DIR/build load=build profile=$DIR/../src/$profile.profile.js
b9a15de
+exit $?
b9a15de
diff --git a/install/ui/util/uglifyjs/uglify b/install/ui/util/uglifyjs/uglify
b9a15de
index 7d25b38df19e465227f29b8b70ccf7ca140f725a..1227f589b4c50de49c465f6c696ecdc8af5e3c91 100755
b9a15de
--- a/install/ui/util/uglifyjs/uglify
b9a15de
+++ b/install/ui/util/uglifyjs/uglify
b9a15de
@@ -25,8 +25,9 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
b9a15de
 
b9a15de
 # rhino-1.7R4 doesn't have -main option to enable CommonJS support. It was
b9a15de
 # replaced by -require option.
b9a15de
-if [ `rhino --help | grep -e -require | wc -l` -gt 0 ] ; then
b9a15de
-    rhino -require $DIR/uglify-js.js $@
b9a15de
+RHINO="java -Xss${JAVA_STACK_SIZE:-512k} -classpath /usr/share/java/rhino.jar  org.mozilla.javascript.tools.shell.Main"
b9a15de
+if [ `$RHINO --help | grep -e -require | wc -l` -gt 0 ] ; then
b9a15de
+    $RHINO -require $DIR/uglify-js.js $@
b9a15de
 else
b9a15de
-    rhino -main $DIR/uglify-js.js $DIR/ug.js $@
b9a15de
-fi
b9a15de
\ No newline at end of file
b9a15de
+    $RHINO -main $DIR/uglify-js.js $DIR/ug.js $@
b9a15de
+fi
b9a15de
-- 
b9a15de
1.8.3.1
b9a15de