Fossil SCM

Modify the MSVC makefile and build tool to support building binaries that work on Windows XP using Visual Studio 201x.

mistachkin 2014-10-08 22:21 UTC trunk
Commit afe765c0b855ee549c4bb2e9cf02b73ad7dd8295
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -1174,10 +1174,13 @@
11741174
PERLDIR = C:\Perl\bin
11751175
PERL = perl.exe
11761176
11771177
# Uncomment to enable debug symbols
11781178
# DEBUG = 1
1179
+
1180
+# Uncomment to support Windows XP with Visual Studio 201x
1181
+# FOSSIL_ENABLE_WINXP = 1
11791182
11801183
# Uncomment to enable JSON API
11811184
# FOSSIL_ENABLE_JSON = 1
11821185
11831186
# Uncomment to enable miniz usage
@@ -1246,10 +1249,19 @@
12461249
INCL = $(INCL) /I$(TCLINCDIR)
12471250
!endif
12481251
12491252
CFLAGS = /nologo
12501253
LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
1254
+
1255
+!ifdef FOSSIL_ENABLE_WINXP
1256
+CFLAGS = $(CFLAGS) /D_USING_V110_SDK71_=1
1257
+!if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64"
1258
+LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.02
1259
+!else
1260
+LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.01
1261
+!endif
1262
+!endif
12511263
12521264
!ifdef DEBUG
12531265
CFLAGS = $(CFLAGS) /Zi /MTd /Od
12541266
LDFLAGS = $(LDFLAGS) /DEBUG
12551267
!else
12561268
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -1174,10 +1174,13 @@
1174 PERLDIR = C:\Perl\bin
1175 PERL = perl.exe
1176
1177 # Uncomment to enable debug symbols
1178 # DEBUG = 1
 
 
 
1179
1180 # Uncomment to enable JSON API
1181 # FOSSIL_ENABLE_JSON = 1
1182
1183 # Uncomment to enable miniz usage
@@ -1246,10 +1249,19 @@
1246 INCL = $(INCL) /I$(TCLINCDIR)
1247 !endif
1248
1249 CFLAGS = /nologo
1250 LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
 
 
 
 
 
 
 
 
 
1251
1252 !ifdef DEBUG
1253 CFLAGS = $(CFLAGS) /Zi /MTd /Od
1254 LDFLAGS = $(LDFLAGS) /DEBUG
1255 !else
1256
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -1174,10 +1174,13 @@
1174 PERLDIR = C:\Perl\bin
1175 PERL = perl.exe
1176
1177 # Uncomment to enable debug symbols
1178 # DEBUG = 1
1179
1180 # Uncomment to support Windows XP with Visual Studio 201x
1181 # FOSSIL_ENABLE_WINXP = 1
1182
1183 # Uncomment to enable JSON API
1184 # FOSSIL_ENABLE_JSON = 1
1185
1186 # Uncomment to enable miniz usage
@@ -1246,10 +1249,19 @@
1249 INCL = $(INCL) /I$(TCLINCDIR)
1250 !endif
1251
1252 CFLAGS = /nologo
1253 LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
1254
1255 !ifdef FOSSIL_ENABLE_WINXP
1256 CFLAGS = $(CFLAGS) /D_USING_V110_SDK71_=1
1257 !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64"
1258 LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.02
1259 !else
1260 LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.01
1261 !endif
1262 !endif
1263
1264 !ifdef DEBUG
1265 CFLAGS = $(CFLAGS) /Zi /MTd /Od
1266 LDFLAGS = $(LDFLAGS) /DEBUG
1267 !else
1268
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -29,10 +29,13 @@
2929
PERLDIR = C:\Perl\bin
3030
PERL = perl.exe
3131
3232
# Uncomment to enable debug symbols
3333
# DEBUG = 1
34
+
35
+# Uncomment to support Windows XP with Visual Studio 201x
36
+# FOSSIL_ENABLE_WINXP = 1
3437
3538
# Uncomment to enable JSON API
3639
# FOSSIL_ENABLE_JSON = 1
3740
3841
# Uncomment to enable miniz usage
@@ -101,10 +104,19 @@
101104
INCL = $(INCL) /I$(TCLINCDIR)
102105
!endif
103106
104107
CFLAGS = /nologo
105108
LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
109
+
110
+!ifdef FOSSIL_ENABLE_WINXP
111
+CFLAGS = $(CFLAGS) /D_USING_V110_SDK71_=1
112
+!if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64"
113
+LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.02
114
+!else
115
+LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.01
116
+!endif
117
+!endif
106118
107119
!ifdef DEBUG
108120
CFLAGS = $(CFLAGS) /Zi /MTd /Od
109121
LDFLAGS = $(LDFLAGS) /DEBUG
110122
!else
111123
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -29,10 +29,13 @@
29 PERLDIR = C:\Perl\bin
30 PERL = perl.exe
31
32 # Uncomment to enable debug symbols
33 # DEBUG = 1
 
 
 
34
35 # Uncomment to enable JSON API
36 # FOSSIL_ENABLE_JSON = 1
37
38 # Uncomment to enable miniz usage
@@ -101,10 +104,19 @@
101 INCL = $(INCL) /I$(TCLINCDIR)
102 !endif
103
104 CFLAGS = /nologo
105 LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
 
 
 
 
 
 
 
 
 
106
107 !ifdef DEBUG
108 CFLAGS = $(CFLAGS) /Zi /MTd /Od
109 LDFLAGS = $(LDFLAGS) /DEBUG
110 !else
111
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -29,10 +29,13 @@
29 PERLDIR = C:\Perl\bin
30 PERL = perl.exe
31
32 # Uncomment to enable debug symbols
33 # DEBUG = 1
34
35 # Uncomment to support Windows XP with Visual Studio 201x
36 # FOSSIL_ENABLE_WINXP = 1
37
38 # Uncomment to enable JSON API
39 # FOSSIL_ENABLE_JSON = 1
40
41 # Uncomment to enable miniz usage
@@ -101,10 +104,19 @@
104 INCL = $(INCL) /I$(TCLINCDIR)
105 !endif
106
107 CFLAGS = /nologo
108 LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
109
110 !ifdef FOSSIL_ENABLE_WINXP
111 CFLAGS = $(CFLAGS) /D_USING_V110_SDK71_=1
112 !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64"
113 LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.02
114 !else
115 LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE,5.01
116 !endif
117 !endif
118
119 !ifdef DEBUG
120 CFLAGS = $(CFLAGS) /Zi /MTd /Od
121 LDFLAGS = $(LDFLAGS) /DEBUG
122 !else
123
--- win/buildmsvc.bat
+++ win/buildmsvc.bat
@@ -192,15 +192,29 @@
192192
IF ERRORLEVEL 1 (
193193
ECHO Could not change to directory "%ROOT%\msvcbld".
194194
GOTO errors
195195
)
196196
197
+REM
198
+REM NOTE: If requested, setup the build environment to refer to the Windows
199
+REM SDK v7.1A, which is required if the binaries are being built with
200
+REM Visual Studio 201x and need to work on Windows XP.
201
+REM
202
+IF DEFINED USE_V110SDK71A (
203
+ %_AECHO% Forcing use of the Windows SDK v7.1A...
204
+ CALL :fn_UseV110Sdk71A
205
+)
206
+
207
+%_VECHO% Path = '%PATH%'
208
+%_VECHO% Include = '%INCLUDE%'
209
+%_VECHO% Lib = '%LIB%'
210
+
197211
REM
198212
REM NOTE: Attempt to execute NMAKE for the Fossil MSVC makefile, passing
199213
REM anything extra from our command line along (e.g. extra options).
200214
REM
201
-%__ECHO% nmake /f "%TOOLS%\Makefile.msc" %*
215
+%__ECHO% nmake /f "%TOOLS%\Makefile.msc" %NMAKE_ARGS% %*
202216
203217
IF ERRORLEVEL 1 (
204218
GOTO errors
205219
)
206220
@@ -213,10 +227,35 @@
213227
ECHO Could not restore directory.
214228
GOTO errors
215229
)
216230
217231
GOTO no_errors
232
+
233
+:fn_UseV110Sdk71A
234
+ IF "%PROCESSOR_ARCHITECTURE%" == "x86" GOTO set_v110Sdk71A_x86
235
+ SET PFILES_SDK71A=%ProgramFiles(x86)%
236
+ GOTO set_v110Sdk71A_done
237
+ :set_v110Sdk71A_x86
238
+ SET PFILES_SDK71A=%ProgramFiles%
239
+ :set_v110Sdk71A_done
240
+ SET PATH=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
241
+ SET INCLUDE=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
242
+ IF "%PLATFORM%" == "x64" (
243
+ SET LIB=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
244
+ ) ELSE (
245
+ SET LIB=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Lib\x64;%LIB%
246
+ )
247
+ CALL :fn_UnsetVariable PFILES_SDK71A
248
+ SET NMAKE_ARGS=%NMAKE_ARGS% FOSSIL_ENABLE_WINXP=1
249
+ GOTO :EOF
250
+
251
+:fn_UnsetVariable
252
+ IF NOT "%1" == "" (
253
+ SET %1=
254
+ CALL :fn_ResetErrorLevel
255
+ )
256
+ GOTO :EOF
218257
219258
:fn_ResetErrorLevel
220259
VERIFY > NUL
221260
GOTO :EOF
222261
223262
--- win/buildmsvc.bat
+++ win/buildmsvc.bat
@@ -192,15 +192,29 @@
192 IF ERRORLEVEL 1 (
193 ECHO Could not change to directory "%ROOT%\msvcbld".
194 GOTO errors
195 )
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197 REM
198 REM NOTE: Attempt to execute NMAKE for the Fossil MSVC makefile, passing
199 REM anything extra from our command line along (e.g. extra options).
200 REM
201 %__ECHO% nmake /f "%TOOLS%\Makefile.msc" %*
202
203 IF ERRORLEVEL 1 (
204 GOTO errors
205 )
206
@@ -213,10 +227,35 @@
213 ECHO Could not restore directory.
214 GOTO errors
215 )
216
217 GOTO no_errors
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
219 :fn_ResetErrorLevel
220 VERIFY > NUL
221 GOTO :EOF
222
223
--- win/buildmsvc.bat
+++ win/buildmsvc.bat
@@ -192,15 +192,29 @@
192 IF ERRORLEVEL 1 (
193 ECHO Could not change to directory "%ROOT%\msvcbld".
194 GOTO errors
195 )
196
197 REM
198 REM NOTE: If requested, setup the build environment to refer to the Windows
199 REM SDK v7.1A, which is required if the binaries are being built with
200 REM Visual Studio 201x and need to work on Windows XP.
201 REM
202 IF DEFINED USE_V110SDK71A (
203 %_AECHO% Forcing use of the Windows SDK v7.1A...
204 CALL :fn_UseV110Sdk71A
205 )
206
207 %_VECHO% Path = '%PATH%'
208 %_VECHO% Include = '%INCLUDE%'
209 %_VECHO% Lib = '%LIB%'
210
211 REM
212 REM NOTE: Attempt to execute NMAKE for the Fossil MSVC makefile, passing
213 REM anything extra from our command line along (e.g. extra options).
214 REM
215 %__ECHO% nmake /f "%TOOLS%\Makefile.msc" %NMAKE_ARGS% %*
216
217 IF ERRORLEVEL 1 (
218 GOTO errors
219 )
220
@@ -213,10 +227,35 @@
227 ECHO Could not restore directory.
228 GOTO errors
229 )
230
231 GOTO no_errors
232
233 :fn_UseV110Sdk71A
234 IF "%PROCESSOR_ARCHITECTURE%" == "x86" GOTO set_v110Sdk71A_x86
235 SET PFILES_SDK71A=%ProgramFiles(x86)%
236 GOTO set_v110Sdk71A_done
237 :set_v110Sdk71A_x86
238 SET PFILES_SDK71A=%ProgramFiles%
239 :set_v110Sdk71A_done
240 SET PATH=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
241 SET INCLUDE=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
242 IF "%PLATFORM%" == "x64" (
243 SET LIB=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
244 ) ELSE (
245 SET LIB=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Lib\x64;%LIB%
246 )
247 CALL :fn_UnsetVariable PFILES_SDK71A
248 SET NMAKE_ARGS=%NMAKE_ARGS% FOSSIL_ENABLE_WINXP=1
249 GOTO :EOF
250
251 :fn_UnsetVariable
252 IF NOT "%1" == "" (
253 SET %1=
254 CALL :fn_ResetErrorLevel
255 )
256 GOTO :EOF
257
258 :fn_ResetErrorLevel
259 VERIFY > NUL
260 GOTO :EOF
261
262

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button