externals: Update script to take URLs as params
authorMike Weiblen <mikew@lunarg.com>
Fri, 17 Feb 2017 00:00:35 +0000 (17:00 -0700)
committerMike Weiblen <mikew@lunarg.com>
Fri, 17 Feb 2017 19:25:34 +0000 (12:25 -0700)
To provide flexibility in which git repositories are used as the
upstream source for LVL's externals, remove the hardcoded repo URLs
from the update scripts, and instead read those URLs from parameter
files.

Also fix typos and comments.

Change-Id: Ic1b49fcf30d37b602e20bf3f83eb5991847476dc

external_revisions/glslang_giturl [new file with mode: 0644]
external_revisions/spirv-headers_giturl [new file with mode: 0644]
external_revisions/spirv-tools_giturl [new file with mode: 0644]
update_external_sources.bat
update_external_sources.sh

diff --git a/external_revisions/glslang_giturl b/external_revisions/glslang_giturl
new file mode 100644 (file)
index 0000000..d661000
--- /dev/null
@@ -0,0 +1 @@
+https://github.com/KhronosGroup/glslang.git
diff --git a/external_revisions/spirv-headers_giturl b/external_revisions/spirv-headers_giturl
new file mode 100644 (file)
index 0000000..c37214f
--- /dev/null
@@ -0,0 +1 @@
+https://github.com/KhronosGroup/SPIRV-Headers.git
diff --git a/external_revisions/spirv-tools_giturl b/external_revisions/spirv-tools_giturl
new file mode 100644 (file)
index 0000000..19ccae7
--- /dev/null
@@ -0,0 +1 @@
+https://github.com/KhronosGroup/SPIRV-Tools.git
index 91b49ec..237f775 100644 (file)
@@ -28,7 +28,7 @@ REM // ======== Parameter parsing ======== //
       echo   --sync-spirv-tools  just pull spirv-tools_revision
       echo   --build-glslang     pulls glslang_revision, configures CMake, builds Release and Debug
       echo   --build-spirv-tools pulls spirv-tools_revision, configures CMake, builds Release and Debug
-      echo   --all               sync and build glslang, LunarGLASS, spirv-tools
+      echo   --all               sync and build glslang, spirv-tools
       goto:finish
    )
 
@@ -122,9 +122,23 @@ if %errorCode% neq 0 (goto:error)
 
 REM Read the target versions from external file, which is shared with Linux script
 
+if not exist %REVISION_DIR%\glslang_giturl (
+   echo.
+   echo Missing glslang_giturl file!  Place it in %REVISION_DIR% with git repo URL in it.
+   set errorCode=1
+   goto:error
+)
+
 if not exist %REVISION_DIR%\glslang_revision (
    echo.
-   echo Missing glslang_revision file!  Place it in %REVSION_DIR% with target version in it.
+   echo Missing glslang_revision file!  Place it in %REVISION_DIR% with target version in it.
+   set errorCode=1
+   goto:error
+)
+
+if not exist %REVISION_DIR%\spirv-tools_giturl (
+   echo.
+   echo Missing spirv-tools_giturl file!  Place it in %REVISION_DIR% with git repo URL in it.
    set errorCode=1
    goto:error
 )
@@ -136,6 +150,13 @@ if not exist %REVISION_DIR%\spirv-tools_revision (
    goto:error
 )
 
+if not exist %REVISION_DIR%\spirv-headers_giturl (
+   echo.
+   echo Missing spirv-headers_giturl file!  Place it in %REVISION_DIR% with git repo URL in it.
+   set errorCode=1
+   goto:error
+)
+
 if not exist %REVISION_DIR%\spirv-headers_revision (
    echo.
    echo Missing spirv-headers_revision file!  Place it in %REVISION_DIR% with target version in it.
@@ -143,11 +164,18 @@ if not exist %REVISION_DIR%\spirv-headers_revision (
    goto:error
 )
 
+set /p GLSLANG_GITURL= < %REVISION_DIR%\glslang_giturl
 set /p GLSLANG_REVISION= < %REVISION_DIR%\glslang_revision
+set /p SPIRV_TOOLS_GITURL= < %REVISION_DIR%\spirv-tools_giturl
 set /p SPIRV_TOOLS_REVISION= < %REVISION_DIR%\spirv-tools_revision
+set /p SPIRV_HEADERS_GITURL= < %REVISION_DIR%\spirv-headers_giturl
 set /p SPIRV_HEADERS_REVISION= < %REVISION_DIR%\spirv-headers_revision
+
+echo GLSLANG_GITURL=%GLSLANG_GITURL%
 echo GLSLANG_REVISION=%GLSLANG_REVISION%
+echo SPIRV_TOOLS_GITURL=%SPIRV_TOOLS_GITURL%
 echo SPIRV_TOOLS_REVISION=%SPIRV_TOOLS_REVISION%
+echo SPIRV_HEADERS_GITURL=%SPIRV_HEADERS_GITURL%
 echo SPIRV_HEADERS_REVISION=%SPIRV_HEADERS_REVISION%
 
 
@@ -205,7 +233,7 @@ REM // ======== Functions ======== //
    echo Creating local glslang repository %GLSLANG_DIR%)
    mkdir %GLSLANG_DIR%
    cd %GLSLANG_DIR%
-   git clone https://github.com/KhronosGroup/glslang.git .
+   git clone %GLSLANG_GITURL% .
    git checkout %GLSLANG_REVISION%
    if not exist %GLSLANG_DIR%\SPIRV (
       echo glslang source download failed!
@@ -226,7 +254,7 @@ goto:eof
    echo Creating local spirv-tools repository %SPIRV_TOOLS_DIR%)
    mkdir %SPIRV_TOOLS_DIR%
    cd %SPIRV_TOOLS_DIR%
-   git clone https://github.com/KhronosGroup/SPIRV-Tools.git .
+   git clone %SPIRV_TOOLS_GITURL% .
    git checkout %SPIRV_TOOLS_REVISION%
    if not exist %SPIRV_TOOLS_DIR%\source (
       echo spirv-tools source download failed!
@@ -235,7 +263,7 @@ goto:eof
    mkdir %SPIRV_TOOLS_DIR%\external
    mkdir %SPIRV_TOOLS_DIR%\external\spirv-headers
    cd %SPIRV_TOOLS_DIR%\external\spirv-headers
-   git clone https://github.com/KhronosGroup/SPIRV-HEADERS.git .
+   git clone %SPIRV_HEADERS_GITURL% .
    git checkout %SPIRV_HEADERS_REVISION%
    if not exist %SPIRV_TOOLS_DIR%\external\spirv-headers\README.md (
       echo spirv-headers download failed!
index 06dca16..5440023 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Update source for glslang, LunarGLASS, spirv-tools
+# Update source for glslang, spirv-tools
 
 set -e
 
@@ -14,11 +14,18 @@ echo CORE_COUNT=$CORE_COUNT
 
 REVISION_DIR="$CURRENT_DIR/external_revisions"
 
+GLSLANG_GITURL=$(cat "${REVISION_DIR}/glslang_giturl")
 GLSLANG_REVISION=$(cat "${REVISION_DIR}/glslang_revision")
+SPIRV_TOOLS_GITURL=$(cat "${REVISION_DIR}/spirv-tools_giturl")
 SPIRV_TOOLS_REVISION=$(cat "${REVISION_DIR}/spirv-tools_revision")
+SPIRV_HEADERS_GITURL=$(cat "${REVISION_DIR}/spirv-headers_giturl")
 SPIRV_HEADERS_REVISION=$(cat "${REVISION_DIR}/spirv-headers_revision")
+
+echo "GLSLANG_GITURL=${GLSLANG_GITURL}"
 echo "GLSLANG_REVISION=${GLSLANG_REVISION}"
+echo "SPIRV_TOOLS_GITURL=${SPIRV_TOOLS_GITURL}"
 echo "SPIRV_TOOLS_REVISION=${SPIRV_TOOLS_REVISION}"
+echo "SPIRV_HEADERS_GITURL=${SPIRV_HEADERS_GITURL}"
 echo "SPIRV_HEADERS_REVISION=${SPIRV_HEADERS_REVISION}"
 
 BUILDDIR=${CURRENT_DIR}
@@ -29,7 +36,7 @@ function create_glslang () {
    echo "Creating local glslang repository (${BASEDIR}/glslang)."
    mkdir -p "${BASEDIR}"/glslang
    cd "${BASEDIR}"/glslang
-   git clone https://github.com/KhronosGroup/glslang.git .
+   git clone ${GLSLANG_GITURL} .
    git checkout ${GLSLANG_REVISION}
 }
 
@@ -45,11 +52,11 @@ function create_spirv-tools () {
    echo "Creating local spirv-tools repository (${BASEDIR}/spirv-tools)."
    mkdir -p "${BASEDIR}"/spirv-tools
    cd "${BASEDIR}"/spirv-tools
-   git clone https://github.com/KhronosGroup/SPIRV-Tools.git .
+   git clone ${SPIRV_TOOLS_GITURL} .
    git checkout ${SPIRV_TOOLS_REVISION}
    mkdir -p "${BASEDIR}"/spirv-tools/external/spirv-headers
    cd "${BASEDIR}"/spirv-tools/external/spirv-headers
-   git clone https://github.com/KhronosGroup/SPIRV-Headers .
+   git clone ${SPIRV_HEADERS_GITURL} .
    git checkout ${SPIRV_HEADERS_REVISION}
 }
 
@@ -61,7 +68,7 @@ function update_spirv-tools () {
    if [ ! -d "${BASEDIR}/spirv-tools/external/spirv-headers" -o ! -d "${BASEDIR}/spirv-tools/external/spirv-headers/.git" ]; then
       mkdir -p "${BASEDIR}"/spirv-tools/external/spirv-headers
       cd "${BASEDIR}"/spirv-tools/external/spirv-headers
-      git clone https://github.com/KhronosGroup/SPIRV-Headers .
+      git clone ${SPIRV_HEADERS_GITURL} .
    else
       cd "${BASEDIR}"/spirv-tools/external/spirv-headers
       git fetch --all