Imported Upstream version 1.35.9
[platform/upstream/gobject-introspection.git] / build / win32 / gengir.bat
1 @echo off
2
3 setlocal EnableDelayedExpansion
4
5 rem Needed environmental variables:
6 rem PLAT: Windows platform-Win32 (i.e. x86) or x64 (i.e. x86-64)
7 rem CONF: Configuration Type, Release or Debug
8 rem VSVER: Visual C++ version used
9
10 rem Check the environemental variables...
11 if /i "%PLAT%" == "Win32" goto PLAT_OK
12 if /i "%PLAT%" == "x64" goto PLAT_OK
13 if /i "%PLAT%" == "x86" (
14    set PLAT=Win32
15    goto PLAT_OK
16 )
17 if /i "%PLAT%" == "x86-64" (
18    set PLAT=x64
19    goto PLAT_OK
20 )
21 goto ERR_PLAT
22 :PLAT_OK
23 if %VSVER% == 9 goto VSVER_OK
24 if %VSVER% == 10 goto VSVER_OK
25 if %VSVER% == 11 goto VSVER_OK
26 goto ERR_VSVER
27 :VSVER_OK
28 if /i "%CONF%" == "Release" goto CONF_OK
29 if /i "%CONF%" == "Debug" goto CONF_OK
30 goto ERR_CONF
31 :CONF_OK
32 if "%BASEDIR%" == "" goto ERR_BASEDIR
33 if not exist %BASEDIR% goto ERR_BASEDIR
34
35
36 set BINDIR=..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\bin
37 set PATH=%BINDIR%;%PATH%
38 set PYTHONPATH=..\..;%BINDIR%
39
40 set UNINSTALLED_INTROSPECTION_SRCDIR=..\..
41 echo Setup .bat for generating GLib .gir's...
42
43 rem =====================================================
44 rem Feed the "installed" GLib headers into a listing file
45 rem =====================================================
46 echo %BASEDIR%\lib\glib-2.0\include\glibconfig.h> glib_list
47 for /f %%a in ('dir /b %BASEDIR%\include\glib-2.0\glib\*.h') do (
48    echo %BASEDIR%\include\glib-2.0\glib\%%a>> glib_list
49 )
50 echo %BASEDIR%\include\glib-2.0\gobject\glib-types.h>> glib_list
51 echo ..\..\gir\glib-2.0.c>> glib_list
52
53 rem ========================================================
54 rem Feed the "installed" GObject headers into a listing file
55 rem ========================================================
56
57 if exist gobject_list del gobject_list
58 for /f %%a in ('dir /b %BASEDIR%\include\glib-2.0\gobject\*.h') do (
59    if not %%a == glib-types.h (
60       echo %BASEDIR%\include\glib-2.0\gobject\%%a>> gobject_list
61    )
62 )
63 echo ..\..\gir\gobject-2.0.c>> gobject_list
64
65 rem =====================================================
66 rem Feed the "installed" Gio headers into a listing file
67 rem =====================================================
68
69 for /f %%a in ('dir /b %BASEDIR%\include\gio-win32-2.0\gio\*.h') do (
70    echo %BASEDIR%\include\gio-win32-2.0\gio\%%a> gio_list
71 )
72
73 for /f %%a in ('dir /b %BASEDIR%\include\glib-2.0\gio\*.h') do (
74    if not %%a == gsettingsbackend.h (
75       echo %BASEDIR%\include\glib-2.0\gio\%%a>> gio_list
76    )
77 )
78 echo ..\..\gir\gio-2.0.c>> gio_list
79
80 rem =================================================================================================
81 rem Begin setup of glib_gir.bat to create GLib-2.0.gir
82 rem (The ^^ is necessary to span the command to multiple lines on Windows cmd.exe!)
83 rem =================================================================================================
84
85 echo echo Generating GLib-2.0.gir...> glib_gir.bat
86 echo @echo on>> glib_gir.bat
87 echo.>> glib_gir.bat
88 rem ================================================================
89 rem Setup the command line flags to g-ir-scanner for GLib-2.0.gir...
90 rem ================================================================
91 echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
92 echo --add-include-path=..\..\gir --add-include-path=. --namespace=GLib --nsversion=2.0 ^^>> glib_gir.bat
93 echo --no-libtool --pkg=glib-2.0 --library=glib-2-vs%VSVER% --library=gobject-2-vs%VSVER% ^^>> glib_gir.bat
94 echo --external-library --reparse-validate --identifier-prefix=G --symbol-prefix=g ^^>> glib_gir.bat
95 echo --symbol-prefix=glib --c-include="glib.h" -I%BASEDIR%\include\glib-2.0 ^^>> glib_gir.bat
96 echo -I%BASEDIR%\lib\glib-2.0\include -I%BASEDIR%\include -DGETTEXT_PACKAGE=Dummy ^^>> glib_gir.bat
97 echo -DGLIB_COMPILATION -D__G_I18N_LIB_H__ ^^>> glib_gir.bat
98 echo --filelist=glib_list ^^>> glib_gir.bat
99 echo -o GLib-2.0.gir>> glib_gir.bat
100 echo.>> glib_gir.bat
101
102 echo Completed setup of .bat for generating GLib-2.0.gir.
103 echo.>> glib_gir.bat
104
105 rem ===================================================
106 rem Finish setup of glib_gir.bat to create GLib-2.0.gir
107 rem ===================================================
108
109 rem ====================================================================
110 rem Next, begin the setup for the glib_gir.bat to create GModule-2.0.gir
111 rem ====================================================================
112 echo echo Generating GModule-2.0.gir...>> glib_gir.bat
113 echo.>> glib_gir.bat
114
115 rem ===================================================================
116 rem Setup the command line flags to g-ir-scanner for GModule-2.0.gir...
117 rem ===================================================================
118
119 echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
120 echo --add-include-path=..\..\gir --add-include-path=. --namespace=GModule --nsversion=2.0 ^^>> glib_gir.bat
121 echo --no-libtool --include=GLib-2.0 --pkg=gmodule-2.0 --library=gmodule-2-vs%VSVER% ^^>> glib_gir.bat
122 echo --external-library --reparse-validate --identifier-prefix=G --c-include="gmodule.h" ^^>> glib_gir.bat
123 echo -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include -I%BASEDIR%\include ^^>> glib_gir.bat
124 echo %BASEDIR%\include\glib-2.0\gmodule.h -o GModule-2.0.gir>> glib_gir.bat
125 echo.>> glib_gir.bat
126
127 echo Completed setup of .bat for generating GModule-2.0.gir.
128 echo.>> glib_gir.bat
129
130 rem ======================================================
131 rem Finish setup of glib_gir.bat to create GModule-2.0.gir
132 rem ======================================================
133
134 rem ====================================================================
135 rem Next, begin the setup for the glib_gir.bat to create GObject-2.0.gir
136 rem ====================================================================
137
138 echo echo Generating GObject-2.0.gir...>> glib_gir.bat
139 echo.>> glib_gir.bat
140
141 rem ===================================================================
142 rem Setup the command line flags to g-ir-scanner for GObject-2.0.gir...
143 rem ===================================================================
144
145 echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
146 echo --add-include-path=..\..\gir --add-include-path=. --namespace=GObject --nsversion=2.0 ^^>> glib_gir.bat
147 echo --no-libtool --include=GLib-2.0 --pkg=gobject-2.0 --library=gobject-2-vs%VSVER% ^^>> glib_gir.bat
148 echo --external-library --reparse-validate --identifier-prefix=G --c-include="glib-gobject.h" ^^>> glib_gir.bat
149 echo -I%BASEDIR%/include/glib-2.0 -I%BASEDIR%/lib/glib-2.0/include -I%BASEDIR%/include ^^>> glib_gir.bat
150 echo -DGOBJECT_COMPILATION ^^>> glib_gir.bat
151 echo --filelist=gobject_list -o GObject-2.0.gir>> glib_gir.bat
152 echo.>> glib_gir.bat
153
154 echo Completed setup of .bat for generating GObject-2.0.gir.
155 echo.>> glib_gir.bat
156 rem ======================================================
157 rem Finish setup of glib_gir.bat to create GObject-2.0.gir
158 rem ======================================================
159
160 rem ================================================================
161 rem Next, begin the setup for the glib_gir.bat to create Gio-2.0.gir
162 rem ================================================================
163 echo echo Generating Gio-2.0.gir...>> glib_gir.bat
164 echo.>> glib_gir.bat
165
166 rem ===============================================================
167 rem Setup the command line flags to g-ir-scanner for Gio-2.0.gir...
168 rem ===============================================================
169 echo python ..\..\tools\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> glib_gir.bat
170 echo --add-include-path=..\..\gir --add-include-path=. --namespace=Gio --nsversion=2.0 ^^>> glib_gir.bat
171 echo --no-libtool --pkg=gio-2.0 --pkg=gio-windows-2.0 --include=GObject-2.0 ^^>> glib_gir.bat
172 echo --library=gio-2-vs%VSVER% --external-library --reparse-validate --warn-all ^^>> glib_gir.bat
173 echo --identifier-prefix=G --include=GLib-2.0 --c-include="gio/gio.h" -DGIO_COMPILATION ^^>> glib_gir.bat
174 echo -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include ^^>> glib_gir.bat
175 echo -I%BASEDIR%\include ^^>> glib_gir.bat
176 echo --filelist=gio_list ^^>> glib_gir.bat
177 echo -o Gio-2.0.gir>> glib_gir.bat
178 echo.>> glib_gir.bat
179
180 echo Completed setup of .bat for generating Gio-2.0.gir.
181 echo.>> glib_gir.bat
182 rem ==================================================
183 rem Finish setup of glib_gir.bat to create Gio-2.0.gir
184 rem ==================================================
185
186 rem =========================================================================
187 rem Next, begin the setup for the glib_gir.bat to create GIRepository-2.0.gir
188 rem =========================================================================
189 copy /b %BINDIR%\girepository-1.0.lib %BINDIR%\girepository-2.0.lib
190 echo echo Generating GIRepository-2.0.gir...>> glib_gir.bat
191 echo.>> glib_gir.bat
192
193 rem ========================================================================
194 rem Setup the command line flags to g-ir-scanner for GIRepository-2.0.gir...
195 rem ========================================================================
196 echo python ..\..\tools\g-ir-scanner --verbose --warn-all ^^>> glib_gir.bat
197 echo --add-include-path=..\..\gir --add-include-path=. --namespace=GIRepository --nsversion=2.0 ^^>> glib_gir.bat
198 echo --identifier-prefix=GI --symbol-prefix=g --c-include="girepository.h" --add-include-path=. ^^>> glib_gir.bat
199 echo --no-libtool --pkg=gobject-2.0 --include=GObject-2.0 ^^>> glib_gir.bat
200 echo --library=girepository-1-vs%VSVER% -I..\..\girepository -I..\.. -I%BASEDIR%\include  ^^>> glib_gir.bat
201 echo -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include -DGI_COMPILATION ^^>> glib_gir.bat
202 echo ..\..\girepository\girepository.h ^^>> glib_gir.bat
203 echo ..\..\girepository\girepository.c ^^>> glib_gir.bat
204
205 for /f %%a in ('dir /b ..\..\girepository\gi*info.c') do (
206    echo ..\..\girepository\%%a ^^>> glib_gir.bat
207 )
208
209 for /f %%a in ('dir /b ..\..\girepository\gi*info.h') do (
210    echo ..\..\girepository\%%a ^^>> glib_gir.bat
211 )
212
213 echo ..\..\girepository\gitypelib.h ^^>> glib_gir.bat
214 echo ..\..\girepository\gitypes.h ^^>> glib_gir.bat
215 echo -o GIRepository-2.0.gir>> glib_gir.bat
216 echo.>> glib_gir.bat
217
218 echo Completed setup of .bat for generating GIRepository-2.0.gir.
219 echo.>> glib_gir.bat
220 rem ===========================================================
221 rem Finish setup of glib_gir.bat to create GIRepository-2.0.gir
222 rem ===========================================================
223
224 rem =======================
225 rem Now generate the .gir's
226 rem =======================
227 CALL glib_gir.bat
228
229 @echo off
230 rem =======
231 rem Cleanup
232 rem =======
233 rem del %BINDIR%\girepository-2.0.lib
234 del gio_list
235 del gobject_list
236 del glib_list
237 del glib_gir.bat
238 goto DO_COMPILE_GIR
239 :ERR_PLAT
240 echo You need to specify a valid Platform [set PLAT=Win32 or PLAT=x64]
241 goto DONE
242 :ERR_VSVER
243 echo You need to specify your Visual Studio version [set VSVER=9 or VSVER=10 or VSVER=11]
244 goto DONE
245 :ERR_CONF
246 echo You need to specify a valid Configuration [set CONF=Release or CONF=Debug]
247 goto DONE
248 :ERR_BASEDIR
249 echo You need to specify a valid BASEDIR.
250 goto DONE
251 :DO_COMPILE_GIR
252 rem Now compile the generated .gir files
253 g-ir-compiler --includedir=. --debug --verbose GLib-2.0.gir -o GLib-2.0.typelib
254 g-ir-compiler --includedir=. --debug --verbose GModule-2.0.gir -o GModule-2.0.typelib
255 g-ir-compiler --includedir=. --debug --verbose GObject-2.0.gir -o GObject-2.0.typelib
256 g-ir-compiler --includedir=. --debug --verbose Gio-2.0.gir -o Gio-2.0.typelib
257 g-ir-compiler --includedir=. --debug --verbose GIRepository-2.0.gir -o GIRepository-2.0.typelib
258
259 rem Now process the bundled .gir files
260 python create_nonglib_gir.py --vsver=%VSVER%
261 set CURRDIR=%CD%
262 cd ..\..\gir
263 g-ir-compiler --includedir=. --debug --verbose cairo-1.0.gir -o cairo-1.0.typelib
264 g-ir-compiler --includedir=. --debug --verbose freetype2-2.0.gir -o freetype2-2.0.typelib
265 g-ir-compiler --includedir=. --debug --verbose GL-1.0.gir -o GL-1.0.typelib
266 g-ir-compiler --includedir=. --debug --verbose libxml2-2.0.gir -o libxml2-2.0.typelib
267 cd %CURRDIR%
268
269 rem Copy the generated .girs and .typelibs to their appropriate places
270
271 mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0
272 move /y *.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
273 copy /y ..\..\gir\freetype2-2.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
274 copy /y ..\..\gir\GL-1.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
275 copy /y ..\..\gir\libxml2-2.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
276 copy /y ..\..\gir\cairo-1.0.gir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0\
277
278 mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0
279 move /y *.typelib ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0\
280 move /y ..\..\gir\*.typelib ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0\
281 :DONE
282