当前位置:编程学习 > 网站相关 >>

webkit在win32下的编译规则(三)

 

首先来看WTF这个project,这个project的Pre-build event如下:

   1: REM Do not edit from the Visual Studio IDE! Customize via a $(ProjectName)PreBuild.cmd file.
   2: if not exist "$(ProjectDir)$(ProjectName)PreBuild.cmd" exit /b
   3: 
   4: set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
   5: set CONFIGURATIONNAME=$(ConfigurationName)
   6: set INPUTDIR=$(InputDir)
   7: set INPUTFILENAME=$(InputFileName)
   8: set INPUTPATH=$(InputPath)
   9: set INTDIR=$(IntDir)
  10: set LIBRARYCONFIGSUFFIX=$(LibraryConfigSuffix)
  11: set OUTDIR=$(OutDir)
  12: set PLATFORMNAME=$(PlatformName)
  13: set PROJECTDIR=$(ProjectDir)
  14: set PROJECTFILENAME=$(ProjectFileName)
  15: set PROJECTNAME=$(ProjectName)
  16: set PROJECTPATH=$(ProjectPath)
  17: set SOLUTIONDIR=$(SolutionDir)
  18: set SOLUTIONFILENAME=$(SolutionFileName)
  19: set SOLUTIONNAME=$(SolutionName)
  20: set SOLUTIONPATH=$(SolutionPath)
  21: set TARGETDIR=$(TargetDir)
  22: set TARGETEXT=$(TargetExt)
  23: set TARGETFILENAME=$(TargetFileName)
  24: set TARGETPATH=$(TargetPath)
  25: set WEBKITCONFIGSUFFIX=$(WebKitConfigSuffix)
  26: set WEBKITDLLCONFIGSUFFIX=$(WebKitDLLConfigSuffix)
  27: 
  28: REM If any of the above variables didnt exist previously and
  29: REM were set to an empty string, set will set the errorlevel to 1,
  30: REM which will cause the project-specific script to think the build
  31: REM has failed. This cmd /c call will clear the errorlevel.
  32: cmd /c
  33: 
  34: "$(ProjectDir)$(ProjectName)PreBuild.cmd"

这些脚本首先利用vs自带的一些内置变量来设置环境变量,然后调用"$(ProjectDir)$(ProjectName)PreBuild.cmd"这个脚本,展开后的路径是D: oolscygwinhomexufanWebKitSourceJavaScriptCoreJavaScriptCore.vcprojJavaScriptCoreJavaScriptCorePreBuild.cmd。从上面的28-31行可以看出,cmd /c的主要作用是为了清除errorlevel。JavaScriptCorePreBuild.cmd这个脚本的内容如下:

   1: %SystemDrive%cygwininwhich.exe bash
   2: if errorlevel 1 set PATH=%SystemDrive%cygwinin;%PATH%
   3: cmd /c
   4: if exist "%CONFIGURATIONBUILDDIR%uildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%uildfailed"
   5: if errorlevel 1 exit 1
   6: echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%uildfailed"
   7: 
   8: bash "%WEBKITLIBRARIESDIR% oolsscriptsauto-version.sh" "%INTDIR%"

JavaScriptCorePreBuild.cmd首先检查前面的编译有没有问题,如果没有问题,就会调用D: oolscygwinhomexufanWebKitWebKitLibrarieswin oolsscriptsauto-version.sh这个perl脚本,内容如下:

 

   1: #!/usr/bin/bash
   2: 
   3: # Copyright (C) 2007, 2009 Apple Inc.  All rights reserved.
   4: #
   5: # Redistribution and use in source and binary forms, with or without
   6: # modification, are permitted provided that the following conditions
   7: # are met:
   8: # 1. Redistributions of source code must retain the above copyright
   9: #    notice, this list of conditions and the following disclaimer.
  10: # 2. Redistributions in binary form must reproduce the above copyright
  11: #    notice, this list of conditions and the following disclaimer in the
  12: #    documentation and/or other materials provided with the distribution.
  13: #
  14: # THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS AND ANY
  15: # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  17: # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  18: # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19: # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20: # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  21: # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  22: # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23: # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24: # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25: 
  26: 
  27: # Trim any trailing or from the given variable.
  28: chomp()
  29: {
  30:     local old_value=$(eval echo "$$1");
  31:     local value=$(echo "$old_value" | sed s/[ ]*$//)
  32:     eval $1=$value;
  33: }
  34: 
  35: if [[ -n "$WEBKITLIBRARIESDIR" ]]; then
  36:     FALLBACK_VERSION_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\tools\scripts\VERSION"`
  37:     FALLBACK_VERSION=$(cat "$FALLBACK_VERSION_PATH");
  38: 
  39:     COPYRIGHT_END_YEAR_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\tools\scripts\COPYRIGHT-END-YEAR"`
  40:     COPYRIGHT_END_YEAR=$(cat "$COPYRIGHT_END_YEAR_PATH");
  41:     chomp COPYRIGHT_END_YEAR
  42: fi
  43: 
  44: OUTPUT_FILE=$(cygpath -u "$1")/include/autoversion.h
  45: mkdir -p "$(dirname "$OUTPUT_FILE")"
  46: 
  47: # Take the initial version number from RC_PROJECTSOURCEVERSION if it
  48: # exists, otherwise fall back to the version number stored in the source.
  49: ENVIRONMENT_VERSION="$RC_PROJECTSOURCEVERSION";
  50: PROPOSED_VERSION=${ENVIRONMENT_VERSION:-$FALLBACK_VERSION}
  51: chomp PROPOSED_VERSION
  52: 
  53: # Split out the three components of the dotted version number.  We pad
  54: # the input with trailing dots to handle the case where the input version
  55: # has fewer components than we expect.
  56: BUILD_MAJOR_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d . -f 1)
  57: BUILD_MINOR_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d . -f 2)
  58: BUILD_TINY_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d . -f 3)
  59: 
  60: # Cut the major component down to three characters by dropping any
  61: # extra leading digits, then adjust the major version portion of the
  62: # version string to match.
  63: CHARACTERS_TO_DROP=$(( ${#BUILD_MAJOR_VERSION} > 3 ? ${#BUILD_MAJOR_VERSION} - 3 : 0 ))
  64: BUILD_MAJOR_VERSION=${BUILD_MAJOR_VERSION:$CHARACTERS_TO_DROP}
  65: PROPOSED_VERSION=${PROPOSED_VERSION:$CHARACTERS_TO_DROP}
  66: 
  67: # Have the minor and tiny components default to zero if not present.
  68: BUILD_MINOR_VERSION=${BUILD_MINOR_VERSION:-0}
  69: BUILD_TINY_VERSION=${BUILD_TINY_VERSION:-0}
  70: 
  71: # Split the first component further by using the first digit for the
  72: # major version and the remaining two characters as the minor version.
  73: # The minor version is shifted down to the tiny version, with the tiny
  74: # version becoming the variant version.
  75: MAJOR_VERSION=${BUILD_MAJOR_VERSION:0:1}
  76: MINOR_VERSION=${BUILD_MAJOR_VERSION:1}
  77: TINY_VERSION=${BUILD_MINOR_VERSION}
  78: VARIANT_VERSION=${BUIL

补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,