You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by or...@apache.org on 2015/01/03 02:09:45 UTC

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

Repository: incubator-corinthia
Updated Branches:
  refs/heads/master e8d93d482 -> a48521515


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/master
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 ***                           */
+


[2/2] incubator-corinthia git commit: Completed fetch_downloads extract_downloads pairing

Posted by or...@apache.org.
Completed  fetch_downloads extract_downloads pairing

The procedures work together and extract_downloads always calls
fetch_downloads just in case needed (already-downloaded files are not
refetched).  Basic tests are successful.


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

Branch: refs/heads/master
Commit: a48521515f567038768287d67448cb5748ae3df3
Parents: 1384664
Author: Dennis Hamilton <or...@apache.org>
Authored: Fri Jan 2 17:09:25 2015 -0800
Committer: Dennis Hamilton <or...@apache.org>
Committed: Fri Jan 2 17:09:42 2015 -0800

----------------------------------------------------------------------
 external/extract_downloads.bat | 15 +++++++++------
 external/fetch_downloads.bat   | 27 +++++++++++++++++----------
 2 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/a4852151/external/extract_downloads.bat
----------------------------------------------------------------------
diff --git a/external/extract_downloads.bat b/external/extract_downloads.bat
index 4157a8e..a431567 100644
--- a/external/extract_downloads.bat
+++ b/external/extract_downloads.bat
@@ -1,5 +1,5 @@
 @echo off
-rem extract_downloads.bat 1.00       UTF-8
+rem extract_downloads.bat 1.01       UTF-8
 rem    EXTRACT THE EXTERNAL DOWNLOADS TO INCLUDE, LIB, AND BIN FOLDERS
 
 rem Fetch downloads in case not done yet
@@ -21,6 +21,7 @@ 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
 
+rem           File Name                       Top Path
 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\
@@ -29,7 +30,7 @@ CALL :ZLIB    zlib128-dll.zip                 ""
 
 EXIT /B 0
 
-rem MOST MAINTENANCE IS BY UPDATING THE FILENAMES AND TOP PATHES ABOVE.
+rem MOST MAINTENANCE IS BY UPDATING THE FILENAMES AND TOP PATHS ABOVE.
 rem    The extraction procedure do not require maintenance unless there is
 rem    a Zip layout change or new extraction cases are needed.
 
@@ -77,7 +78,7 @@ EXIT /B 0
 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
+RMDIR /S /Q "%~dp0download\T" >nul 2>&1
 ECHO:     extracting %1
 Cscript /nologo "%~dp0unzip-win.js" //B "%~dp0download\%1" "%~dp0download\T"
 EXIT /B 0
@@ -91,9 +92,9 @@ 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
+RMDIR /S /Q "%~dp0download\include" >nul 2>&1
+RMDIR /S /Q "%~dp0download\lib" >nul 2>&1
+RMDIR /S /Q "%~dp0download\bin" >nul 2>&1
 rem set up empty include, lib, and bin to receive fresh extractions
 MKDIR "%~dp0download\include"
 MKDIR "%~dp0download\lib"
@@ -111,6 +112,8 @@ ECHO: ***    No extractions have been performed.
 ECHO:
 EXIT /B 2
 
+rem 1.01 2015-01-02-17:03 Silence warnings when removing non-existent
+rem      directories
 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.

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/a4852151/external/fetch_downloads.bat
----------------------------------------------------------------------
diff --git a/external/fetch_downloads.bat b/external/fetch_downloads.bat
index 0663217..0d5309b 100644
--- a/external/fetch_downloads.bat
+++ b/external/fetch_downloads.bat
@@ -1,32 +1,39 @@
 @echo off
-rem fetch_downloads.bat               UTF-8
+rem fetch_downloads.bat 1.00              UTF-8
 rem   FETCH EXTERNAL ARCHIVES FOR NATIVE WINDOWS BUILDS OF CORINTHIA
 
-mkdir %~dp0download
+MKDIR "%~dp0download" >nul 2>&1
 rem Make download directory at same location as this script.
-rem It does not matter if the directory already exists.
+rem Be silent even if the directory already exists.  No worries.
 
-rem  MAINTAIN THIS LIST MANUALLY
+rem  MAINTAIN THIS LIST MANUALLY.  MATCH UP IN EXTRACT_DOWNLOADS.BAT
 CALL :FETCH "http://zlib.net/zlib128-dll.zip"
 CALL :FETCH "http://xmlsoft.org/sources/win32/iconv-1.9.2.win32.zip"
 CALL :FETCH "http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip"
 CALL :FETCH "https://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip"
 CALL :FETCH  "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.0-VC.zip"
 EXIT /B 0
+
+:FETCH
+IF EXIST "%~dp0download\%~n1%~x1" EXIT /B 0
+rem do not download an archive that is already present.
+Cscript /nologo "%~dp0wget-win.js" //B "%1" "%~dp0download\%~n1%~x1"
+IF EXIST "%~dp0download\%~n1%~x1" ECHO:     %~n1%~x1% downloaded
+EXIT /B 0
+
 rem TODO
 rem  * Might want to pass up and act on error codes from the individual
 rem    :FETCH operations.
 rem  * It might be handy to fetch these URLs from a file so that it can
 rem    be kept maintained in one place, even though the win32 cases are
 rem    unique to building for Windows.
+rem  * Silent the warning on download folder already existing
 rem XXX
 rem  * wget-win.js does not do FTP.  So alternative locations have been
 rem    used for iconv and libmxl2.
 
-:FETCH
-IF EXIST "%~dp0download\%~n1%~x1" EXIT /B 0
-rem do not download an archive that is already present.
-ECHO "%~n1%~x1"
-Cscript /nologo "%~dp0wget-win.js" //B "%1" "%~dp0download\%~n1%~x1"
-EXIT /B 0
+rem 1.00 2015-01-02-16:51 Complete with mating to extract_downloads.bat
+rem      The tested version is adjusted to list successful downloads
+rem      and not any that are not needed or fail.
 
+rem               *** end of fetch_downloads.bat ***