From d386124702654d1ee4313eac2797a3e19caaaa01 Mon Sep 17 00:00:00 2001 From: Peter TB Brett Date: Fri, 28 Aug 2015 14:29:10 +0100 Subject: [PATCH 1/4] [emscripten] Remove unnecessary #ifdef. --- engine/src/mode_standalone.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engine/src/mode_standalone.cpp b/engine/src/mode_standalone.cpp index 9cbcdf2aa56..bbd1d98c412 100644 --- a/engine/src/mode_standalone.cpp +++ b/engine/src/mode_standalone.cpp @@ -449,8 +449,6 @@ IO_stat MCDispatch::startup(void) MCdispatcher -> loadexternal(MCSTR("revxml")); MCdispatcher -> loadexternal(MCSTR("dbsqlite")); MCdispatcher -> loadexternal(MCSTR("dbmysql")); -#elif defined(__EMSCRIPTEN__) - /* Don't load any externals */ #else MCdispatcher -> loadexternal(MCSTR("revzip.dylib")); MCdispatcher -> loadexternal(MCSTR("revdb.dylib")); From 993b4e4ac482f514b4a8b68db4c30e233b0e3c43 Mon Sep 17 00:00:00 2001 From: Peter TB Brett Date: Fri, 28 Aug 2015 14:29:10 +0100 Subject: [PATCH 2/4] [emscripten] Don't include dotfiles from standalone template. Ignore all filenames in the standalone archive template directory that start with "." (like ".gitignore", for example). --- ide-support/revsaveasemscriptenstandalone.livecodescript | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ide-support/revsaveasemscriptenstandalone.livecodescript b/ide-support/revsaveasemscriptenstandalone.livecodescript index aeb7c17db2a..c06eb1d661c 100644 --- a/ide-support/revsaveasemscriptenstandalone.livecodescript +++ b/ide-support/revsaveasemscriptenstandalone.livecodescript @@ -230,6 +230,11 @@ private command getStandaloneTemplateFiles_Impl @xCount, @xFiles, pRelPath -- List files repeat for each line tFile in the files + -- Skip dotfiles + if tFile begins with "." then + next repeat + end if + add 1 to xCount put pRelPath & slash & tFile into tFilePath put tFilePath into xFiles[xCount] From a8eba6d75bd512909730bf80b9351a634d522736 Mon Sep 17 00:00:00 2001 From: Peter TB Brett Date: Fri, 28 Aug 2015 14:29:10 +0100 Subject: [PATCH 3/4] [emscripten] Remove unused function from standalone builder. --- ide-support/revsaveasemscriptenstandalone.livecodescript | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ide-support/revsaveasemscriptenstandalone.livecodescript b/ide-support/revsaveasemscriptenstandalone.livecodescript index c06eb1d661c..31130258021 100644 --- a/ide-support/revsaveasemscriptenstandalone.livecodescript +++ b/ide-support/revsaveasemscriptenstandalone.livecodescript @@ -296,9 +296,3 @@ private function getRepoBinariesFolder return revEnvironmentRepositoryPath() & slash & "emscripten-bin" end getRepoBinariesFolder ---------------------------------------- --- FIXME REMOVE THESE - -function revEmscriptenGetRepoBinariesFolder - return getRepoBinariesFolder() -end revEmscriptenGetRepoBinariesFolder From 8bdeab57618e346d0dcaed42719a16995b270be4 Mon Sep 17 00:00:00 2001 From: Peter TB Brett Date: Fri, 28 Aug 2015 14:29:11 +0100 Subject: [PATCH 4/4] [emscripten] When not installed, use original standalone template The build process copies the standalone template directory into the top level `emscripten-bin` directory. However, it doesn't check for changes to the original directory and update the copy. This patch makes the standalone builder use the original version of the template in `engine/rsrc` rather than the copy, when running from the git repository. --- ...vsaveasemscriptenstandalone.livecodescript | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/ide-support/revsaveasemscriptenstandalone.livecodescript b/ide-support/revsaveasemscriptenstandalone.livecodescript index 31130258021..dd89ebe5cec 100644 --- a/ide-support/revsaveasemscriptenstandalone.livecodescript +++ b/ide-support/revsaveasemscriptenstandalone.livecodescript @@ -132,7 +132,7 @@ command revSaveAsEmscriptenStandalone pStack, pOutputFolder put tBuildFolder & slash & tName & ".html" into tHtmlFile logDebug "html", "Creating" && tHtmlFile logDebug "html", "Copying" && getHtmlTemplateFile() - revSBCopyFileToFile mapPath(getHtmlTemplateFile()), tHtmlFile, \ + revSBCopyFileToFile mapBinPath(getHtmlTemplateFile()), tHtmlFile, \ "revStandaloneProgressCallback", the long id of me catch tError @@ -161,9 +161,9 @@ end revSaveAsEmscriptenStandalone -- File & path helper functions ---------------------------------------------------------------- --- Map a file path into an absolute filesystem path. This is used to --- cope with running from a git repository working tree. -private function mapPath pPath +-- Map a compiled file's path into an absolute filesystem path. This +-- is used to cope with running from a git repository working tree. +private function mapBinPath pPath if there is a file pPath then return pPath end if @@ -175,7 +175,21 @@ private function mapPath pPath -- We're running from a git checkout return getRepoBinariesFolder() & slash & pPath end if -end mapPath +end mapBinPath + +-- Map a resource file's path into an absolute filesystem path. This +-- is used to cope with running from a git repository working tree. +private function mapResPath pPath + if there is a file pPath then + return pPath + end if + + if revEnvironmentIsInstalled() then + return getRuntimeFolder() & slash & pPath + else + return getRepoResourceFolder() & slash & pPath + end if +end mapResPath -- Return a number-indexed array of engine files that need to be -- copied into the standalone output folder. @@ -183,10 +197,10 @@ private function getEngineFiles local tFiles -- Engine JavaScript - put mapPath("standalone-" & revLicenseType() & "-" & the version & ".js") into tFiles[1] + put mapBinPath("standalone-" & revLicenseType() & "-" & the version & ".js") into tFiles[1] -- Memory initialisation file - put mapPath("standalone-" & revLicenseType() & "-" & the version & ".html.mem") into tFiles[2] + put mapBinPath("standalone-" & revLicenseType() & "-" & the version & ".html.mem") into tFiles[2] return tFiles end getEngineFiles @@ -196,7 +210,7 @@ end getEngineFiles -- initialisation data that's automatically included in all -- standalones (especially fonts). private function getStandaloneTemplateFolder - return mapPath("emscripten-standalone-template") + return mapResPath("emscripten-standalone-template") end getStandaloneTemplateFolder -- Return a number-indexed array of files in the Emscripten standalone @@ -261,7 +275,7 @@ end getStandaloneTemplateFiles_Impl -- This has some standalone-dependent JavaScript substituted into it -- to instantiate the engine. private function getHtmlTemplateFile - return mapPath("standalone-" & revLicenseType() & "-" & the version & ".html") + return mapBinPath("standalone-" & revLicenseType() & "-" & the version & ".html") end getHtmlTemplateFile -- Get the directory containing the Emscripten runtime @@ -296,3 +310,7 @@ private function getRepoBinariesFolder return revEnvironmentRepositoryPath() & slash & "emscripten-bin" end getRepoBinariesFolder +-- Get the directory where Emscripten resources are kept +private function getRepoResourceFolder + return revEnvironmentRepositoryPath() & slash & "engine" & slash & "rsrc" +end getRepoResourceFolder