-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_gdal.bat
77 lines (56 loc) · 2.92 KB
/
build_gdal.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
setlocal
call settings.bat
git clone -b tags/1.11.2 https://github.com/OSGeo/gdal.git
cd gdal\gdal
if "%1"=="clean" (git clean -f -x)
SET "PREFIX1=%PREFIX:\=/%"
set GDAL_HOME=%PREFIX%
if "%COMPILER%" == "MINGW" (
SET PKG_CONFIG_PATH=/%PREFIX1::=%/lib/pkgconfig
SET "PATH=%MSYSDIR%;%PREFIX%\bin;%PATH%"
rem set "LIBS=-lspatialite -lsqlite3 -lgeos_c -lfreexl -lexpat -lproj -lxml2 -liconv -lz"
if NOT EXIST GDALmake.opt (bash -c "./configure %CONFARGS% --without-libtool --disable-static --enable-shared --without-python --with-spatialite=%PREFIX:\=/% --with-expat=%PREFIX:\=/% --with-sqlite3=%PREFIX:\=/% --with-freexl=%PREFIX:\=/" )
%ER%
rem Build EXEs against DLL, not static .a
bash -c "sed -i GDALmake.opt -e 's@endif # HAVE_LIBTOOL@endif # HAVE_LIBTOOL\nEXE_DEP_LIBS=$(GDAL_SLIB)@g'"
rem Omit GDAL_ROOT to shorten command line
bash -c "sed -i GNUmakefile -e 's@\$(GDAL_ROOT)\/@@g'"
bash -c "make install"
%ER%
copy /y %PREFIX%\lib\libgdal.dll %PREFIX%\bin
) else (
if "%COMPILER:32=%"=="%COMPILER%" (
"%SEDC%" -i nmake.opt -e "s@#WIN64@WIN64@"
)
echo "Using latest cpl_config.h.vc file to support newer compilers"
git checkout origin/HEAD port/cpl_config.h.vc
rem "%SEDC%" -i nmake.opt -e "s@DLLBUILD=1@DLLBUILD=0@"
"%SEDC%" -i nmake.opt -e "s@#SQLITE_INC=.*@SQLITE_INC=-I$(PREFIX)\\\\include -DHAVE_SPATIALITE@"
"%SEDC%" -i nmake.opt -e "s@#SQLITE_LIB=.*@SQLITE_LIB=$(PREFIX)\\\\lib\\\\spatialite.lib $(PREFIX)\\\\lib\\\\geos_c.lib $(PREFIX)\\\\lib\\\\sqlite3.lib@"
"%SEDC%" -i nmake.opt -e "s@#SPATIALITE_412_OR_LATER@SPATIALITE_412_OR_LATER@"
"%SEDC%" -i nmake.opt -e "s@#LIBXML2_INC =.*@LIBXML2_INC = -I$(PREFIX)\\\\include@"
"%SEDC%" -i nmake.opt -e "s@#LIBXML2_LIB =.*@LIBXML2_LIB = $(PREFIX)\\\\lib\\\\libxml2_a.lib@"
"%SEDC%" -i nmake.opt -e "s@#FREEXL_CFLAGS =.*@FREEXL_CFLAGS = -I$(PREFIX)\\\\include@"
"%SEDC%" -i nmake.opt -e "s@#FREEXL_LIBS =.*@FREEXL_LIBS = $(PREFIX)\\\\lib\\\\freexl.lib@"
"%SEDC%" -i nmake.opt -e "s@#LIBICONV_INCLUDE =.*@LIBICONV_INCLUDE = -I$(PREFIX)\\\\include@"
"%SEDC%" -i nmake.opt -e "s@#LIBICONV_LIBRARY =.*@LIBICONV_LIBRARY = $(PREFIX)\\\\lib\\\\iconv.lib@"
"%SEDC%" -i nmake.opt -e "s@#LIBICONV_CFLAGS =.*@LIBICONV_CFLAGS = -DICONV_CONST=const@"
"%SEDC%" -i nmake.opt -e "s@#PROJ_FLAGS =.*@PROJ_FLAGS = -DPROJ_STATIC@"
"%SEDC%" -i nmake.opt -e "s@#PROJ_INCLUDE =.*@PROJ_INCLUDE = -I$(PREFIX)\\\\include@"
"%SEDC%" -i nmake.opt -e "s@#PROJ_LIBRARY =.*@PROJ_LIBRARY = $(PREFIX)\\\\lib\\\\proj.lib@"
"%SEDC%" -i nmake.opt -e "s@ODBC_SUPPORTED = 1@#ODBC_SUPPORTED = 1@"
rem "%SEDC%" -i nmake.opt -e s@#SQLITE_LIB=.*@SQLITE_LIB=\$\(PREFIX\)\\\\lib\\\\sqlite3.lib@"
rem "%SEDC%" -i nmake.opt -e "s@#SQLITE_INC=.*@SQLITE_INC=-I\$\(PREFIX\)\\\\include@"
if "%Variant%" == "Debug" (
set "DBG=DEBUG=1"
"%SEDC%" -i nmake.opt -e "s@\/MD @\/MDd @"
) else (
set DBG
)
nmake -f makefile.vc %DBG%
%ER%
nmake -f makefile.vc %DBG% devinstall
%ER%
ECHO ------------- Installed to %PREFIX% --------------
cd ..\..
)