diff --git a/config.sh b/config.sh index ecbc22b6144..fde36f22291 100755 --- a/config.sh +++ b/config.sh @@ -258,6 +258,9 @@ if test -z "$TARGET_ARCH"; then esac fi +# Location of Perl when running Windows builds +WIN_PERL=${WIN_PERL:-"C:/perl/bin/perl.exe"} + # Android default settings and tools ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-22.0.1} ANDROID_JAVA_SDK=${ANDROID_JAVA_SDK:-${JAVA_SDK:-/usr/lib/jvm/java-7-openjdk-amd64}} @@ -310,7 +313,8 @@ case ${OS} in "-Gandroid_ndk_version=${ANDROID_NDK_VERSION}" "$@" ;; win) - invoke_gyp $basic_args "-Gmsvs_version=${WIN_MSVS_VERSION}" "$@" + invoke_gyp $basic_args "-Gmsvs_version=${WIN_MSVS_VERSION}" \ + "-Dperl=${WIN_PERL}" "$@" ;; mac|ios) invoke_gyp $basic_args "-DOS=${OS}" \ diff --git a/config/perl.gypi b/config/perl.gypi index 234360b4448..c0a923dc3e6 100644 --- a/config/perl.gypi +++ b/config/perl.gypi @@ -1,17 +1,6 @@ { 'variables': { - 'conditions': - [ - [ - 'host_os == "win"', - { - 'perl': [ 'C:/perl/bin/perl.exe' ], - }, - { - 'perl': [ 'perl' ], - }, - ], - ], + 'perl%': [ 'perl' ], }, } diff --git a/config/win32.gypi b/config/win32.gypi index c8dac4c50e3..dc7852f6e90 100644 --- a/config/win32.gypi +++ b/config/win32.gypi @@ -2,11 +2,11 @@ 'variables': { # Path to the Windows SDK for Apple QuickTime - 'quicktime_sdk': '$(foo)C:/Program Files/QuickTime SDK', + 'quicktime_sdk%': '$(foo)C:/Program Files/QuickTime SDK', # Path to versions 4 and 5 of the Microsoft Speech SDK - 'ms_speech_sdk4': '$(foo)C:/Program Files/Microsoft Speech SDK', - 'ms_speech_sdk5': '$(foo)C:/Program Files/Microsoft Speech SDK 5.1', + 'ms_speech_sdk4%': '$(foo)C:/Program Files/Microsoft Speech SDK', + 'ms_speech_sdk5%': '$(foo)C:/Program Files/Microsoft Speech SDK 5.1', 'output_dir': '../win-<(target_arch)-bin', }, diff --git a/configure.bat b/configure.bat index 9eed4dfecd3..3a5bc774838 100644 --- a/configure.bat +++ b/configure.bat @@ -1,3 +1,80 @@ -python.exe gyp\gyp_main.py --format msvs --depth . --generator-output build-win-x86/livecode -Gmsvs_version=2010 +@echo off +REM Configures the Windows build + +SETLOCAL EnableExtensions + +REM Set this variable if any warnings have been reported +SET warnings=0 + +REM Not all versions of windows the the %programfiles(x86)% variable +IF NOT DEFINED programfiles(x86) SET programfiles(x86)=%programfiles% + +REM Note: to test whether a directory exists in batch script, you need to check +REM whether a file within that directory exists. Easiest way to do this is to +REM add the "*" wildcard after the directory + +REM Attempt to locate a copy of Perl +WHERE /Q perl 1>NUL 2>NUL +IF %ERRORLEVEL% NEQ 0 ( + IF EXIST C:\perl64\bin\perl.exe ( + SET extra_options=%extra_options% -Dperl="C:/perl64/bin/perl.exe" + ) ELSE IF EXIST C:\perl\bin\perl.exe ( + SET extra_options=%extra_options% -Dperl="C:/perl/bin/perl.exe" + ) ELSE ( + ECHO >&2 Error: could not locate a copy of perl + PAUSE + EXIT 1 + ) +) + +REM Attempt to locate a copy of Python +WHERE /Q python 1>NUL 2>NUL +IF %ERRORLEVEL% NEQ 0 ( + IF EXIST C:\Python27\python.exe ( + SET python=C:\Python27\python.exe + ) ELSE IF EXIST C:\Python26\python.exe ( + SET python=C:\Python26\python.exe + ) ELSE ( + ECHO >&2 Error: could not locate a copy of python + PAUSE + EXIT 1 + ) +) ELSE ( + SET python=python +) + +REM Attempt to locate the QuickTime SDK +IF EXIST "%programfiles(x86)%\QuickTime SDK\*" ( + SET extra_options=%extra_options% -Dquicktime_sdk="%programfiles(x86)%/QuickTime SDK" +) ELSE ( + ECHO >&2 Error: could not locate the QuickTime SDK + PAUSE + EXIT 1 +) + +REM Attempt to locate the Microsoft Speech SDK v5.1 +IF EXIST "%programfiles(x86)%\Microsoft Speech SDK 5.1\*" ( + SET extra_options=%extra_options% -Dms_speech_sdk5="%programfiles(x86)%/Microsoft Speech SDK 5.1" +) ELSE ( + ECHO >&2 Warning: could not locate the Microsoft Speech SDK v5.1; revSpeech will not build + SET warnings=1 +) + +REM Attempt to locate the Microsoft Speech SDK v4 +IF EXIST "%programfiles(x86)%\Microsoft Speech SDK\*" ( + SET extra_options=%extra_options% -Dms_speech_sdk4="%programfiles(x86)%/Microsoft Speech SDK" +) ELSE ( + ECHO >&2 Warning: could not locate the Microsoft Speech SDK v4; revSpeech will not build + SET warnings=1 +) + +REM Pause so any warnings can be seen +IF %warnings% NEQ 0 PAUSE + +REM Run the configure step +%python% gyp\gyp_main.py --format msvs --depth . --generator-output build-win-x86/livecode -Gmsvs_version=2010 %extra_options% + +REM Pause if there was an error so that the user gets a chance to see it +IF %ERRORLEVEL% NEQ 0 PAUSE EXIT %ERRORLEVEL%