forked from rogerbinns/apsw
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mingwsetup.bat
110 lines (95 loc) · 4.23 KB
/
mingwsetup.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
@rem You can use this script to setup the necessary libraries for building with MinGW on Windows
@rem We assume you use the default install directory of c:\PythonVERSION
@rem Change below if you don't
set PYTHONDIRBASE=c:\Python
@rem The location of Python dlls in the system32 directory - below is correct for Win NT/2k/XP etc
set WINSYS32=%systemroot%\system32
@set PYTHONVER=22
@if not exist %PYTHONDIRBASE%%PYTHONVER% goto no%PYTHONVER%
@if exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto lib%PYTHONVER%ok
pexports %WINSYS32%\python%PYTHONVER%.dll > %TEMP%\py%PYTHONVER%exports.def
dlltool --dllname python%PYTHONVER%.dll --def %TEMP%\py%PYTHONVER%exports.def --output-lib %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a
del %TEMP%\py%PYTHONVER%exports.def
@if not exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto fail%PYTHONVER%
@goto lib%PYTHONVER%ok
:no22
@echo You do not have Python %PYTHONVER% installed
@goto py%PYTHONVER%done
:fail22
@echo Setup failed for Python %PYTHONVER%
@goto py%PYTHONVER%done
:lib22ok
@echo MinGW is setup for Python %PYTHONVER%
:py22done
@set PYTHONVER=23
@if not exist %PYTHONDIRBASE%%PYTHONVER% goto no%PYTHONVER%
@if exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto lib%PYTHONVER%ok
pexports %WINSYS32%\python%PYTHONVER%.dll > %TEMP%\py%PYTHONVER%exports.def
dlltool --dllname python%PYTHONVER%.dll --def %TEMP%\py%PYTHONVER%exports.def --output-lib %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a
del %TEMP%\py%PYTHONVER%exports.def
@if not exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto fail%PYTHONVER%
@goto lib%PYTHONVER%ok
:no23
@echo You do not have Python %PYTHONVER% installed
@goto py%PYTHONVER%done
:fail23
@echo Setup failed for Python %PYTHONVER%
@goto py%PYTHONVER%done
:lib23ok
@echo MinGW is setup for Python %PYTHONVER%
:py23done
@set PYTHONVER=24
@if not exist %PYTHONDIRBASE%%PYTHONVER% goto no%PYTHONVER%
@if exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto lib%PYTHONVER%ok
pexports %WINSYS32%\python%PYTHONVER%.dll > %TEMP%\py%PYTHONVER%exports.def
dlltool --dllname python%PYTHONVER%.dll --def %TEMP%\py%PYTHONVER%exports.def --output-lib %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a
del %TEMP%\py%PYTHONVER%exports.def
@if not exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto fail%PYTHONVER%
@goto lib%PYTHONVER%ok
:no24
@echo You do not have Python %PYTHONVER% installed
@goto py%PYTHONVER%done
:fail24
@echo Setup failed for Python %PYTHONVER%
@goto py%PYTHONVER%done
:lib24ok
@echo MinGW is setup for Python %PYTHONVER%
:py24done
@set PYTHONVER=25
@if not exist %PYTHONDIRBASE%%PYTHONVER% goto no%PYTHONVER%
@if exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto lib%PYTHONVER%ok
pexports %WINSYS32%\python%PYTHONVER%.dll > %TEMP%\py%PYTHONVER%exports.def
dlltool --dllname python%PYTHONVER%.dll --def %TEMP%\py%PYTHONVER%exports.def --output-lib %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a
del %TEMP%\py%PYTHONVER%exports.def
@if not exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto fail%PYTHONVER%
@goto lib%PYTHONVER%ok
:no25
@echo You do not have Python %PYTHONVER% installed
@goto py%PYTHONVER%done
:fail25
@echo Setup failed for Python %PYTHONVER%
@goto py%PYTHONVER%done
:lib25ok
@echo MinGW is setup for Python %PYTHONVER%
:py25done
@set PYTHONVER=26
@if not exist %PYTHONDIRBASE%%PYTHONVER% goto no%PYTHONVER%
@if exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto lib%PYTHONVER%ok
pexports %WINSYS32%\python%PYTHONVER%.dll > %TEMP%\py%PYTHONVER%exports.def
dlltool --dllname python%PYTHONVER%.dll --def %TEMP%\py%PYTHONVER%exports.def --output-lib %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a
del %TEMP%\py%PYTHONVER%exports.def
@if not exist %PYTHONDIRBASE%%PYTHONVER%\libs\libpython%PYTHONVER%.a goto fail%PYTHONVER%
@goto lib%PYTHONVER%ok
:no26
@echo You do not have Python %PYTHONVER% installed
@goto py%PYTHONVER%done
:fail26
@echo Setup failed for Python %PYTHONVER%
@goto py%PYTHONVER%done
:lib26ok
@echo MinGW is setup for Python %PYTHONVER%
:py26done
@rem clean out variables
@set PYTHONDIRBASE=
@set PYTHONVER=
@set WINSYS32=