summaryrefslogtreecommitdiff
path: root/build/win32/gengir.bat
blob: 453b45e710b267b0ba1a6cc5125e16b0da859c25 (plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
@echo off

setlocal EnableDelayedExpansion

rem Needed environmental variables:
rem PLAT: Windows platform-Win32 (i.e. x86) or x64 (i.e. x86-64)
rem CONF: Configuration Type, Release or Debug
rem VSVER: Visual C++ version used

rem Check the environemental variables...
if /i "%PLAT%" == "Win32" goto PLAT_OK
if /i "%PLAT%" == "x64" goto PLAT_OK
if /i "%PLAT%" == "x86" (
   set PLAT=Win32
   goto PLAT_OK
)
if /i "%PLAT%" == "x86-64" (
   set PLAT=x64
   goto PLAT_OK
)
goto ERR_PLAT
:PLAT_OK
if %VSVER% == 9 goto VSVER_OK
if %VSVER% == 10 goto VSVER_OK
if %VSVER% == 11 goto VSVER_OK
goto ERR_VSVER
:VSVER_OK
if /i "%CONF%" == "Release" goto CONF_OK
if /i "%CONF%" == "Debug" goto CONF_OK
goto ERR_CONF
:CONF_OK
if "%BASEDIR%" == "" goto ERR_BASEDIR
if not exist %BASEDIR% goto ERR_BASEDIR


set BINDIR=..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\bin
set PATH=%BINDIR%;%PATH%
set PYTHONPATH=..\..;%BINDIR%

set UNINSTALLED_INTROSPECTION_SRCDIR=..\..
echo Setup .bat for generating GLib .gir's...

rem =====================================================
rem Feed the "installed" GLib headers into a listing file
rem =====================================================
echo %BASEDIR%\lib\glib-2.0\include\glibconfig.h> glib_list
for /f %%a in ('dir /b %BASEDIR%\include\glib-2.0\glib\*.h') do (
   echo %BASEDIR%\include\glib-2.0\glib\%%a>> glib_list
)
echo %BASEDIR%\include\glib-2.0\gobject\glib-types.h>> glib_list
echo ..\..\gir\glib-2.0.c>> glib_list

rem ========================================================
rem Feed the "installed" GObject headers into a listing file
rem ========================================================

if exist gobject_list del gobject_list
for /f %%a in ('dir /b %BASEDIR%\include\glib-2.0\gobject\*.h') do (
   if not %%a == glib-types.h (
      echo %BASEDIR%\include\glib-2.0\gobject\%%a>> gobject_list
   )
)
echo ..\..\gir\gobject-2.0.c>> gobject_list

rem =====================================================
rem Feed the "installed" Gio headers into a listing file
rem =====================================================

for /f %%a in ('dir /b %BASEDIR%\include\gio-win32-2.0\gio\*.h') do (
   echo %BASEDIR%\include\gio-win32-2.0\gio\%%a> gio_list
)

for /f %%a in ('dir /b %BASEDIR%\include\glib-2.0\gio\*.h') do (
   if not %%a == gsettingsbackend.h (
      echo %BASEDIR%\include\glib-2.0\gio\%%a>> gio_list
   )
)
echo ..\..\gir\gio-2.0.c>> gio_list

rem =================================================================================================
rem Begin setup of glib_gir.bat to create GLib-2.0.gir
rem (The ^^ is necessary to span the command to multiple lines on Windows cmd.exe!)
rem =================================================================================================

echo echo Generating GLib-2.0.gir...> glib_gir.bat
echo @echo on>> glib_gir.bat
echo.>> glib_gir.bat
rem ================================================================
rem Setup the command line flags to g-ir-scanner for GLib-2.0.gir...
rem ================================================================
echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
echo --add-include-path=..\..\gir --add-include-path=. --namespace=GLib --nsversion=2.0 ^^>> glib_gir.bat
echo --no-libtool --pkg=glib-2.0 --include=win32-1.0 --library=glib-2-vs%VSVER% --library=gobject-2-vs%VSVER% ^^>> glib_gir.bat
echo --external-library --reparse-validate --identifier-prefix=G --symbol-prefix=g ^^>> glib_gir.bat
echo --symbol-prefix=glib --c-include="glib.h" -I%BASEDIR%\include\glib-2.0 ^^>> glib_gir.bat
echo -I%BASEDIR%\lib\glib-2.0\include -I%BASEDIR%\include -DGETTEXT_PACKAGE=Dummy ^^>> glib_gir.bat
echo -DGLIB_COMPILATION -D__G_I18N_LIB_H__ ^^>> glib_gir.bat
echo --filelist=glib_list ^^>> glib_gir.bat
echo -o GLib-2.0.gir>> glib_gir.bat
echo.>> glib_gir.bat

echo Completed setup of .bat for generating GLib-2.0.gir.
echo.>> glib_gir.bat

rem ===================================================
rem Finish setup of glib_gir.bat to create GLib-2.0.gir
rem ===================================================

rem ====================================================================
rem Next, begin the setup for the glib_gir.bat to create GModule-2.0.gir
rem ====================================================================
echo echo Generating GModule-2.0.gir...>> glib_gir.bat
echo.>> glib_gir.bat

rem ===================================================================
rem Setup the command line flags to g-ir-scanner for GModule-2.0.gir...
rem ===================================================================

echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
echo --add-include-path=..\..\gir --add-include-path=. --namespace=GModule --nsversion=2.0 ^^>> glib_gir.bat
echo --no-libtool --include=GLib-2.0 --pkg=gmodule-2.0 --library=gmodule-2-vs%VSVER% ^^>> glib_gir.bat
echo --external-library --reparse-validate --identifier-prefix=G --c-include="gmodule.h" ^^>> glib_gir.bat
echo -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include -I%BASEDIR%\include ^^>> glib_gir.bat
echo %BASEDIR%\include\glib-2.0\gmodule.h -o GModule-2.0.gir>> glib_gir.bat
echo.>> glib_gir.bat

echo Completed setup of .bat for generating GModule-2.0.gir.
echo.>> glib_gir.bat

rem ======================================================
rem Finish setup of glib_gir.bat to create GModule-2.0.gir
rem ======================================================

rem ====================================================================
rem Next, begin the setup for the glib_gir.bat to create GObject-2.0.gir
rem ====================================================================

echo echo Generating GObject-2.0.gir...>> glib_gir.bat
echo.>> glib_gir.bat

rem ===================================================================
rem Setup the command line flags to g-ir-scanner for GObject-2.0.gir...
rem ===================================================================

echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
echo --add-include-path=..\..\gir --add-include-path=. --namespace=GObject --nsversion=2.0 ^^>> glib_gir.bat
echo --no-libtool --include=GLib-2.0 --pkg=gobject-2.0 --library=gobject-2-vs%VSVER% ^^>> glib_gir.bat
echo --external-library --reparse-validate --identifier-prefix=G --c-include="glib-gobject.h" ^^>> glib_gir.bat
echo -I%BASEDIR%/include/glib-2.0 -I%BASEDIR%/lib/glib-2.0/include -I%BASEDIR%/include ^^>> glib_gir.bat
echo -DGOBJECT_COMPILATION ^^>> glib_gir.bat
echo --filelist=gobject_list -o GObject-2.0.gir>> glib_gir.bat
echo.>> glib_gir.bat

echo Completed setup of .bat for generating GObject-2.0.gir.
echo.>> glib_gir.bat
rem ======================================================
rem Finish setup of glib_gir.bat to create GObject-2.0.gir
rem ======================================================

rem ================================================================
rem Next, begin the setup for the glib_gir.bat to create Gio-2.0.gir
rem ================================================================
echo echo Generating Gio-2.0.gir...>> glib_gir.bat
echo.>> glib_gir.bat

rem ===============================================================
rem Setup the command line flags to g-ir-scanner for Gio-2.0.gir...
rem ===============================================================
echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
echo --add-include-path=..\..\gir --add-include-path=. --namespace=Gio --nsversion=2.0 ^^>> glib_gir.bat
echo --no-libtool --pkg=gio-2.0 --pkg=gio-windows-2.0 --include=GObject-2.0 ^^>> glib_gir.bat
echo --library=gio-2-vs%VSVER% --external-library --reparse-validate --warn-all ^^>> glib_gir.bat
echo --identifier-prefix=G --include=GLib-2.0 --c-include="gio/gio.h" -DGIO_COMPILATION ^^>> glib_gir.bat
echo -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include ^^>> glib_gir.bat
echo -I%BASEDIR%\include ^^>> glib_gir.bat
echo --filelist=gio_list ^^>> glib_gir.bat
echo -o Gio-2.0.gir>> glib_gir.bat
echo.>> glib_gir.bat

echo Completed setup of .bat for generating Gio-2.0.gir.
echo.>> glib_gir.bat
rem ==================================================
rem Finish setup of glib_gir.bat to create Gio-2.0.gir
rem ==================================================

rem =========================================================================
rem Next, begin the setup for the glib_gir.bat to create GIRepository-2.0.gir
rem =========================================================================
copy /b %BINDIR%\girepository-1.0.lib %BINDIR%\girepository-2.0.lib
echo echo Generating GIRepository-2.0.gir...>> glib_gir.bat
echo.>> glib_gir.bat

rem ========================================================================
rem Setup the command line flags to g-ir-scanner for GIRepository-2.0.gir...
rem ========================================================================
echo python ..\..\tools\g-ir-scanner --verbose --warn-all ^^>> glib_gir.bat
echo --add-include-path=..\..\gir --add-include-path=. --namespace=GIRepository --nsversion=2.0 ^^>> glib_gir.bat
echo --identifier-prefix=GI --symbol-prefix=g --c-include="girepository.h" --add-include-path=. ^^>> glib_gir.bat
echo --no-libtool --pkg=gobject-2.0 --include=GObject-2.0 ^^>> glib_gir.bat
echo --library=girepository-1-vs%VSVER% -I..\..\girepository -I..\.. -I%BASEDIR%\include  ^^>> glib_gir.bat
echo -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include -DGI_COMPILATION ^^>> glib_gir.bat
echo ..\..\girepository\girepository.h ^^>> glib_gir.bat
echo ..\..\girepository\girepository.c ^^>> glib_gir.bat

for /f %%a in ('dir /b ..\..\girepository\gi*info.c') do (
   echo ..\..\girepository\%%a ^^>> glib_gir.bat
)

for /f %%a in ('dir /b ..\..\girepository\gi*info.h') do (
   echo ..\..\girepository\%%a ^^>> glib_gir.bat
)

echo ..\..\girepository\gitypelib.h ^^>> glib_gir.bat
echo ..\..\girepository\gitypes.h ^^>> glib_gir.bat
echo -o GIRepository-2.0.gir>> glib_gir.bat
echo.>> glib_gir.bat

echo Completed setup of .bat for generating GIRepository-2.0.gir.
echo.>> glib_gir.bat
rem ===========================================================
rem Finish setup of glib_gir.bat to create GIRepository-2.0.gir
rem ===========================================================

rem =======================
rem Now generate the .gir's
rem =======================
CALL glib_gir.bat

@echo off
rem =======
rem Cleanup
rem =======
rem del %BINDIR%\girepository-2.0.lib
del gio_list
del gobject_list
del glib_list
del glib_gir.bat
goto DO_COMPILE_GIR
:ERR_PLAT
echo You need to specify a valid Platform [set PLAT=Win32 or PLAT=x64]
goto DONE
:ERR_VSVER
echo You need to specify your Visual Studio version [set VSVER=9 or VSVER=10 or VSVER=11]
goto DONE
:ERR_CONF
echo You need to specify a valid Configuration [set CONF=Release or CONF=Debug]
goto DONE
:ERR_BASEDIR
echo You need to specify a valid BASEDIR.
goto DONE
:DO_COMPILE_GIR
rem Now compile the generated .gir files
g-ir-compiler --includedir=. --includedir=..\..\gir --debug --verbose GLib-2.0.gir -o GLib-2.0.typelib
g-ir-compiler --includedir=. --includedir=..\..\gir --debug --verbose GModule-2.0.gir -o GModule-2.0.typelib
g-ir-compiler --includedir=. --includedir=..\..\gir --debug --verbose GObject-2.0.gir -o GObject-2.0.typelib
g-ir-compiler --includedir=. --includedir=..\..\gir --debug --verbose Gio-2.0.gir -o Gio-2.0.typelib
g-ir-compiler --includedir=. --includedir=..\..\gir --debug --verbose GIRepository-2.0.gir -o GIRepository-2.0.typelib

rem Now process the bundled .gir files
python create_nonglib_gir.py --vsver=%VSVER%
set CURRDIR=%CD%
cd ..\..\gir
g-ir-compiler --includedir=. --debug --verbose cairo-1.0.gir -o cairo-1.0.typelib
g-ir-compiler --includedir=. --debug --verbose freetype2-2.0.gir -o freetype2-2.0.typelib
g-ir-compiler --includedir=. --debug --verbose GL-1.0.gir -o GL-1.0.typelib
g-ir-compiler --includedir=. --debug --verbose libxml2-2.0.gir -o libxml2-2.0.typelib
g-ir-compiler --includedir=. --debug --verbose win32-1.0.gir -o win32-1.0.typelib
cd %CURRDIR%

rem Copy the generated .girs and .typelibs to their appropriate places

mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0
move /y *.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
copy /y ..\..\gir\freetype2-2.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
copy /y ..\..\gir\GL-1.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
copy /y ..\..\gir\libxml2-2.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
copy /y ..\..\gir\cairo-1.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
copy /y ..\..\gir\win32-1.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\

mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0
move /y *.typelib ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0\
move /y ..\..\gir\*.typelib ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0\
:DONE