diff --git a/configure.in b/configure.in
index 6037452..2251d85 100644
--- libreoffice-3.5.0/configure.in
+++ libreoffice-3.5.0/configure.in
@@ -7507,6 +7508,7 @@ AC_MSG_CHECKING([whether to build extension for support of scripts in JavaScript
 if test "x$enable_ext_scripting_javascript" = "xyes" -a "x$enable_extension_integration" != "xno" -a "x$with_java" != "xno"; then
    AC_MSG_RESULT([yes])
    ENABLE_SCRIPTING_JAVASCRIPT=YES
+   BUILD_TYPE="$BUILD_TYPE RHINO"
 else
    AC_MSG_RESULT([no])
    ENABLE_SCRIPTING_JAVASCRIPT=NO
diff --git a/scripting/Module_scripting.mk b/scripting/Module_scripting.mk
index b926b07..67f8a71 100644
--- libreoffice-3.5.0/scripting/Module_scripting.mk
+++ libreoffice-3.5.0/scripting/Module_scripting.mk
@@ -54,7 +55,8 @@ $(eval $(call gb_Module_add_targets,scripting,\
 	Pyuno_mailmerge \
 	Zip_scriptbindinglib \
 	Zip_ScriptsBeanShell \
-	Zip_ScriptsJavaScript \
+	$(if $(filter $(ENABLE_SCRIPTING_JAVASCRIPT),YES),\
+		Zip_ScriptsJavaScript) \
 	Zip_ScriptsPython \
 ))
 
diff --git a/scripting/prj/build.lst b/scripting/prj/build.lst
index 2bd4c61..f874898 100644
--- libreoffice-3.5.0/scripting/prj/build.lst
+++ libreoffice-3.5.0/scripting/prj/build.lst
@@ -1,2 +1,2 @@
-tc	scripting	:	filter oovbaapi vbahelper bridges DESKTOP:rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper LIBXSLT:libxslt NULL
+tc	scripting	:	filter oovbaapi vbahelper bridges DESKTOP:rdbmaker vcl xmlscript basic sfx2 RHINO:rhino BSH:beanshell javaunohelper LIBXSLT:libxslt NULL
 tc	scripting\prj						nmake	-	all	tc1_prj NULL
--- libreoffice-3.5.0/scp2/source/ooo/file_ooo.scp
+++ libreoffice-3.5.0/scp2/source/ooo/file_ooo.scp
@@ -701,13 +701,15 @@ File gid_File_Scripts_Java
     ARCHIVE_TXT_FILE_BODY;
     Name = "ScriptsJava.zip";
 End
-#endif
 
+#ifndef WITHOUT_EXTENSION_SCRIPTING_JAVASCRIPT
 File gid_File_Scripts_Javascript
     Dir = gid_Dir_Share_Scripts;
     ARCHIVE_TXT_FILE_BODY;
     Name = "ScriptsJavaScript.zip";
 End
+#endif
+#endif
 
 // new user interface configuration files
 File gid_File_Share_Config_Sofficecfg_uiconfig_Zip
--- libreoffice-3.5.0/tail_build/prj/build.lst-old   2011-10-20 22:44:37.000000000 +0000
+++ libreoffice-3.5.0/tail_build/prj/build.lst       2011-10-20 22:44:49.000000000 +0000
@@ -1,2 +1,2 @@
-tb      tail_build : APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost DESKTOP:l10ntools LIBXML2:libxml2 LIBXMLSEC:libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LPSOLVE:lpsolve MDDS:mdds NEON:neon NSS:nss OPENSSL:openssl PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations XPDF:xpdf avmedia basegfx basic bridges canvas comphelper configmgr connectivity cppcanvas cppu cppuhelper DESKTOP:fpicker javaunohelper jurt jvmaccess offapi officecfg oovbaapi QADEVOOO:qadevOOo DESKTOP:rdbmaker readlicense_oo rhino ridljar sal sax sfx2 solenv soltools sot stoc svtools svx sysui test toolkit tools ucbhelper udkapi unoil unotools ure vcl xmlhelp xmloff xmlscript xsltml NULL
+tb      tail_build : APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost DESKTOP:l10ntools LIBXML2:libxml2 LIBXMLSEC:libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LPSOLVE:lpsolve MDDS:mdds NEON:neon NSS:nss OPENSSL:openssl PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations XPDF:xpdf avmedia basegfx basic bridges canvas comphelper configmgr connectivity cppcanvas cppu cppuhelper DESKTOP:fpicker javaunohelper jurt jvmaccess offapi officecfg oovbaapi QADEVOOO:qadevOOo DESKTOP:rdbmaker readlicense_oo RHINO:rhino ridljar sal sax sfx2 solenv soltools sot stoc svtools svx sysui test toolkit tools ucbhelper udkapi unoil unotools ure vcl xmlhelp xmloff xmlscript xsltml NULL
 tb tail_build\prj nmake - all tb_prj   NULL
