You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by pm...@apache.org on 2015/01/10 19:21:15 UTC

[03/14] incubator-corinthia git commit: extract_downloads.bat and helper unzip-win.js 1.00

extract_downloads.bat and helper unzip-win.js 1.00

The pair of scripts provide custom extraction of external downloads for
win32 x86 dependencies from Corinthia components.   Implementation uses
native Windows technology with no additional components required.


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/13846644
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/13846644
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/13846644

Branch: refs/heads/stable
Commit: 13846644c85b27a4500717ddb2e02e07e56fa041
Parents: e8d93d4
Author: Dennis Hamilton <or...@apache.org>
Authored: Fri Jan 2 16:43:19 2015 -0800
Committer: Dennis Hamilton <or...@apache.org>
Committed: Fri Jan 2 17:09:41 2015 -0800

----------------------------------------------------------------------
 external/extract_downloads.bat | 118 ++++++++++++++++++++++++++++++++++++
 external/unzip-win.js          |  46 ++++++++++++++
 2 files changed, 164 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/13846644/external/extract_downloads.bat
----------------------------------------------------------------------
diff --git a/external/extract_downloads.bat b/external/extract_downloads.bat
new file mode 100644
index 0000000..4157a8e
--- /dev/null
+++ b/external/extract_downloads.bat
@@ -0,0 +1,118 @@
+@echo off
+rem extract_downloads.bat 1.00       UTF-8
+rem    EXTRACT THE EXTERNAL DOWNLOADS TO INCLUDE, LIB, AND BIN FOLDERS
+
+rem Fetch downloads in case not done yet
+CALL "%~dp0fetch_downloads.bat"
+
+rem Determine if any of the packages are missing
+SET extract_downloads=
+CALL :CHECKON zlib128-dll.zip
+CALL :CHECKON iconv-1.9.2.win32.zip
+CALL :CHECKON libxml2-2.7.8.win32.zip
+CALL :CHECKON SDL2-devel-2.0.3-VC.zip
+CALL :CHECKON SDL2_image-devel-2.0.0-VC.zip
+
+rem This procedure can't proceed unless all are present
+IF NOT "%extract_downloads%" == "" GOTO :FAIL1
+
+CALL :CLEAN
+
+rem For extractions, use the zip name listed and the path, if any, from the
+rem root of the zipped hierarchy to the level where include and libs are found
+
+CALL :SDL2x86 SDL2-devel-2.0.3-VC.zip         SDL2-2.0.3\
+CALL :SDL2x86 SDL2_image-devel-2.0.0-VC.zip   SDL2_image-2.0.0\
+CALL :ICONV   iconv-1.9.2.win32.zip           iconv-1.9.2.win32\
+CALL :LIBXML2 libxml2-2.7.8.win32.zip         libxml2-2.7.8.win32\
+CALL :ZLIB    zlib128-dll.zip                 ""
+
+EXIT /B 0
+
+rem MOST MAINTENANCE IS BY UPDATING THE FILENAMES AND TOP PATHES ABOVE.
+rem    The extraction procedure do not require maintenance unless there is
+rem    a Zip layout change or new extraction cases are needed.
+
+rem CUSTOM EXTRACTION CASES FOR COLLECTING EXTERNAL INCLUDES, LIBS, AND BINS
+rem    Each one of these cases below accepts two parameters
+rem       %1 is the filename of the zip file, to be unzipped from
+rem          %~dp0download\%1 with expansion to folder %~dp0download\T
+rem       %2 is the path from T to the level at which parts like include
+rem          and lib are to be found.  %2 is either empty or it is one or more
+rem          path segments each ending with "\".
+
+:SDL2x86
+rem taking T\%2include and T\%2lib\*.lib across, with T\%2lib\*.dll to bin
+CALL :UNZIP %1
+XCOPY "%~dp0download\T\%2include\*.*" "%~dp0download\include" /I /Q /Y >nul
+XCOPY "%~dp0download\T\%2lib\x86\*.lib" "%~dp0download\lib" /I /Q /Y >nul
+XCOPY "%~dp0download\T\%2lib\x86\*.dll" "%~dp0download\bin" /I /Q /Y >nul
+EXIT /B 0
+
+:ICONV
+rem taking T\%2include, T\%2lib, and T\%2bin\*.dll across
+CALL :UNZIP %1
+XCOPY "%~dp0download\T\%2include\*.*" "%~dp0download\include" /I /Q /Y >nul
+XCOPY "%~dp0download\T\%2lib\*.*" "%~dp0download\lib" /I /Q /Y >nul
+XCOPY "%~dp0download\T\%2bin\*.dll" "%~dp0download\bin" /I /Q /Y >nul
+EXIT /B 0
+
+:LIBXML2
+rem taking T\%2include\libxml\, T\%2lib, and T\%2bin\*.dll across
+CALL :UNZIP %1
+XCOPY "%~dp0download\T\%2include\libxml\*.*" "%~dp0download\include\libxml" /I /Q /Y >nul 2>&1
+XCOPY "%~dp0download\T\%2lib\*.*" "%~dp0download\lib" /I /Q /Y >nul
+XCOPY "%~dp0download\T\%2bin\*.dll" "%~dp0download\bin" /I /Q /Y >nul
+EXIT /B 0
+
+:ZLIB
+rem taking all across from T\%2include and T\%2lib, with T\%2*.dll to bin
+CALL :UNZIP %1
+XCOPY "%~dp0download\T\%2include\*.*" "%~dp0download\include" /I /Q /Y >nul
+XCOPY "%~dp0download\T\%2lib\*.*" "%~dp0download\lib" /I /Q /Y >nul
+XCOPY "%~dp0download\T\%2*.dll" "%~dp0download\bin" /I /Q /Y >nul
+EXIT /B 0
+
+:UNZIP
+rem EXTRACT ALL OF ZIP "%~dp0download\%1" TO "%~dp0download\T"
+rem     "%~dp0download\T" is not deleted until needed again, leaving the
+rem     last one for inspection when trouble-shooting.
+RMDIR /S /Q "%~dp0download\T" >nul
+ECHO:     extracting %1
+Cscript /nologo "%~dp0unzip-win.js" //B "%~dp0download\%1" "%~dp0download\T"
+EXIT /B 0
+
+:CHECKON
+IF EXIST "%~dp0download\%1" EXIT /B 0
+IF "%extract_downloads%" == "" ECHO:
+ECHO: *** %1 UNAVAILABLE FOR EXTRACTION
+SET extract_downloads=0
+EXIT /B 2
+
+:CLEAN
+rem clean out any previous material and be quiet about it
+RMDIR /S /Q "%~dp0download\include" >nul
+RMDIR /S /Q "%~dp0download\lib" >nul
+RMDIR /S /Q "%~dp0download\bin" >nul
+rem set up empty include, lib, and bin to receive fresh extractions
+MKDIR "%~dp0download\include"
+MKDIR "%~dp0download\lib"
+MKDIR "%~dp0download\bin"
+EXIT /B 0
+
+:FAIL1
+SET extract_downloads=
+ECHO: *** EXTRACTION REQUIRES ALL OF THE DOWNLOADS TO BE AVAILABLE
+ECHO: *** Ensure that the archives downloaded by fetch_downloads.bat and
+ECHO: *** expected here are the same.  If the unavailable archives are
+ECHO: *** no longer found at the URLs used in fetch_downloads.bat, find
+ECHO: *** alternative locations for them.
+ECHO: ***    No extractions have been performed.
+ECHO:
+EXIT /B 2
+
+rem 1.00 2015-01-02-16:25 Complete Full-Functioning Externals Extraction
+rem      Delivering the download\include, donwload\lib, and download\bin
+rem      collections established for the current external downloads.
+
+rem                 *** end of extract_downloads.bat ***

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/13846644/external/unzip-win.js
----------------------------------------------------------------------
diff --git a/external/unzip-win.js b/external/unzip-win.js
new file mode 100644
index 0000000..8c89e19
--- /dev/null
+++ b/external/unzip-win.js
@@ -0,0 +1,46 @@
+/* unzip-win.js 1.00                  UTF-8
+ *               USE WINDOWS SHELL TO EXTRACT ALL FROM ZIPS
+ *
+ * Cscript unzip-win.js zip dest
+ *   performas an "extract all" of the zip to the dest folder, where
+ *
+ *     zip is the full path file location of the zip to extract
+ *    dest is the full path of the folder to which extraction occurs
+ *
+ * This is a helper script designed to be used with a larger script or
+ * batch file that provides clean parameters and usage.
+ *
+ * The present script is adapted from the solution by Greg Zakharov at
+ * <http://stackoverflow.com/a/19711019/33810> on 2013-10-31.
+ *
+ * TODO
+ *   It is a little startling when the Windows copying-files animation
+ *   pops up when one of these runs long enough for its visibility.
+ *   Find a way to inhibit that, if possible.
+ */
+
+
+try
+{ var  zip = WScript.Arguments(0);
+  var dest = WScript.Arguments(1);
+
+  with (new ActiveXObject('Scripting.FileSystemObject'))
+  {
+    if (!FolderExists(dest)) CreateFolder(dest);
+    with (new ActiveXObject('Shell.Application'))
+    {
+      NameSpace(GetFolder(dest).Path)
+         .CopyHere(Namespace(GetFile(zip).Path).Items());
+    }
+  }
+}
+catch (e)
+{
+  WScript.echo(e.message);
+}
+
+/* 1.00 2015-01-02 Complete Adaptation for Corinthia Externals Extraction
+ */
+
+/*                   *** end of unzip-win.js ***                           */
+