Author: brane
Date: Tue Aug 7 21:15:58 2012
New Revision: 1370526
URL: http://svn.apache.org/viewvc?rev=1370526&view=rev
Log:
Replace CPU type and Windows version in SVN_BUILD_HOST during the build.
* build/transform_config_hw.py: New script, Windows-specific.
* build/generator/templates/svn_config.vcproj.ezt,
build/generator/templates/svn_config.vcxproj.ezt: Use transform_config_hw.py
to generate svn_private_config.h instead of just copying.
* subversion/svn_private_config.hw: Remove ### comment for SVN_BUILD_HOST.
Added:
subversion/trunk/build/transform_config_hw.py
Modified:
subversion/trunk/build/generator/templates/svn_config.vcproj.ezt
subversion/trunk/build/generator/templates/svn_config.vcxproj.ezt
subversion/trunk/subversion/svn_private_config.hw
Modified: subversion/trunk/build/generator/templates/svn_config.vcproj.ezt
URL:
http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/svn_config.vcproj.ezt?rev=1370526&r1=1370525&r2=1370526&view=diff
==============================================================================
--- subversion/trunk/build/generator/templates/svn_config.vcproj.ezt (original)
+++ subversion/trunk/build/generator/templates/svn_config.vcproj.ezt Tue Aug 7
21:15:58 2012
@@ -68,9 +68,9 @@
<Tool
Name="VCCustomBuildTool"
Description="Creating
svn_private_config.h from svn_private_config.hw."
- CommandLine="copy
..\..\..\subversion\svn_private_config.hw
..\..\..\subversion\svn_private_config.h > nul
+[for sql]
CommandLine=""[sql.svn_python]"
"$(SolutionDir)\build\transform_config_hw.py" [platforms]
..\..\..\subversion\svn_private_config.hw
..\..\..\subversion\svn_private_config.h
"
-
Outputs="..\..\subversion\svn_private_config.h"/>
+[end]
Outputs="..\..\subversion\svn_private_config.h"/>
</FileConfiguration>
[end][end] </File>
[for sql] <File
Modified: subversion/trunk/build/generator/templates/svn_config.vcxproj.ezt
URL:
http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/svn_config.vcxproj.ezt?rev=1370526&r1=1370525&r2=1370526&view=diff
==============================================================================
--- subversion/trunk/build/generator/templates/svn_config.vcxproj.ezt (original)
+++ subversion/trunk/build/generator/templates/svn_config.vcxproj.ezt Tue Aug
7 21:15:58 2012
@@ -57,8 +57,8 @@
<CustomBuild Include="$(SolutionDir)\subversion\svn_private_config.hw">
<FileType>Document</FileType>
[for configs][for platforms] <Message
Condition="'$(Configuration)|$(Platform)'=='[configs]|[platforms]'">Creating
svn_private_config.h from svn_private_config.hw.</Message>
- <Command
Condition="'$(Configuration)|$(Platform)'=='[configs]|[platforms]'">copy
$(SolutionDir)\subversion\svn_private_config.hw
$(SolutionDir)\subversion\svn_private_config.h > nul:</Command>
- <Outputs
Condition="'$(Configuration)|$(Platform)'=='[configs]|[platforms]'">$(SolutionDir)\subversion\svn_private_config.h;%(Outputs)</Outputs>
+[for sql] <Command
Condition="'$(Configuration)|$(Platform)'=='[configs]|[platforms]'">"[sql.svn_python]"
"$(SolutionDir)\build\transform_config_hw.py" $(Platform)
$(SolutionDir)\subversion\svn_private_config.hw
$(SolutionDir)\subversion\svn_private_config.h</Command>
+[end] <Outputs
Condition="'$(Configuration)|$(Platform)'=='[configs]|[platforms]'">$(SolutionDir)\subversion\svn_private_config.h;%(Outputs)</Outputs>
[end][end] </CustomBuild>
[for sql] <CustomBuild Include="$(SolutionDir)\[sql.source]">
<FileType>Document</FileType>
Added: subversion/trunk/build/transform_config_hw.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/build/transform_config_hw.py?rev=1370526&view=auto
==============================================================================
--- subversion/trunk/build/transform_config_hw.py (added)
+++ subversion/trunk/build/transform_config_hw.py Tue Aug 7 21:15:58 2012
@@ -0,0 +1,104 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+#
+# transform_config_hw.py -- Generate svn_private_config.h
+# from svn_private_config.hw while editing SVN_BUILD_HOST
+
+
+import os
+import re
+import sys
+import platform
+
+
+def usage_and_exit(msg):
+ if msg:
+ sys.stderr.write('%s\n\n' % msg)
+ sys.stderr.write(
+ 'USAGE: %s ARCHITECTURE TEMPLATE_FILE [OUTPUT_FILE]\n'
+ ' stdout will be used if OUTPUT_FILE is not provided.\n'
+ % os.path.basename(sys.argv[0]))
+ sys.stderr.flush()
+ sys.exit(1)
+
+
+_wincpu_map = {
+ 'x86': 'x86',
+ 'x64': 'x86_64',
+ 'x86_64': 'x86_64',
+ 'ia64': 'ia64',
+ 'powerpc': 'powerpc',
+ 'alfa': 'alfa',
+ }
+
+_arch_map = _wincpu_map.copy()
+_arch_map.update({
+ 'win32': 'x86',
+ })
+
+_interesting_rx = re.compile(
+ r'^\s*#\s*define\s+SVN_BUILD_HOST\s+(?P<host>"[^"]+")\s*$')
+
+def process_header(input, output, architecture):
+ uname = platform.uname()
+ winver = uname[3]
+ wincpu = _wincpu_map.get(uname[4].lower(), 'unknown')
+ arch = _arch_map.get(architecture.lower(), 'unknown')
+
+ if wincpu == arch:
+ host = '"%s-microsoft-windows%s"' % (arch, winver)
+ else:
+ host = '"%s/%s-microsoft-windows%s"' % (arch, wincpu, winver)
+
+ for line in input.split('\n'):
+ match = _interesting_rx.match(line)
+ if match is not None:
+ line = line.replace(match.group('host'), host)
+ output.write(line + '\n')
+
+
+def main(input_filepath, output, architecture):
+ filename = os.path.basename(input_filepath)
+ input = open(input_filepath, 'r').read()
+
+ output.write(
+ '/* This file is automatically generated from %s.\n'
+ ' * Do not edit this file -- edit the source and rerun gen-make.py */'
+ '\n\n'
+ % (filename,))
+
+ process_header(input, output, architecture)
+
+
+if __name__ == '__main__':
+ if os.name != 'nt':
+ usage_and_exit('This script should only be run on Windows')
+
+ if len(sys.argv) < 3 or len(sys.argv) > 4:
+ usage_and_exit('Incorrect number of arguments')
+
+ architecture = sys.argv[1]
+ input_filepath = sys.argv[2]
+
+ if len(sys.argv) > 3:
+ output_file = open(sys.argv[3], 'w')
+ else:
+ output_file = sys.stdout
+
+ main(input_filepath, output_file, architecture)
Modified: subversion/trunk/subversion/svn_private_config.hw
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn_private_config.hw?rev=1370526&r1=1370525&r2=1370526&view=diff
==============================================================================
--- subversion/trunk/subversion/svn_private_config.hw (original)
+++ subversion/trunk/subversion/svn_private_config.hw Tue Aug 7 21:15:58 2012
@@ -31,7 +31,6 @@
/* Define to a Windows-specific equivalent of config.guess output */
-/* ### Replace CPU type and Windows version during build script generation */
#define SVN_BUILD_HOST "x86-microsoft-windows"
/* The minimal version of Berkeley DB we want */