Building Mapnik dependencies on Windows
来源:互联网 发布:js显示display 编辑:程序博客网 时间:2024/06/05 10:59
(Visual C++ express 2008, 2010 and 2012 32-bit)
Buiding dependencies on windows can be very tedious. The goal here is to provide concise instructions for building individual packages using either VC++ 2008, or 2010/2012.
Hopefully, this will allow fully automated builds in the future.
Prerequisites
- Visual C++ 2008, 2010 or 2012, Express or Professional versions
- http://www.microsoft.com/visualstudio/en-us/products/2008-editions/visual-basic-express
- http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-basic-express
- GNU Unix tools (GnuWin32)
- bsdtar
- make
- wget
- msysgit - install into c:/Git to avoid issues with spaces in paths
- unzip (from msysgit)
- patch (from msysgit)
- sed (from msysgit)
- curl (from msysgit)
- cygwin (install bash,make,coreutils) - needed to build pixman and icu (vs 2008)
Environment
We'll be using combination of "Visual Studio 2008 Command Prompt" (or "Visual Studio 2010 Command Prompt" or "Developer Command Prompt for VS2012") and GNU tools. Please, ensure PATH is setup correctly and GNU tools can be accessed from VC++ command prompt. The order in %PATH% variable is important (Git / Cygwin / GnuWin32 )
set PATH=%PATH%;c:\git\bin;c:\cygwin\bin;c:\GnuWin32\binset ROOTDIR=c:\dev2cd %ROOTDIR%mkdir packages set PKGDIR=%ROOTDIR%/packages
Packages versions:
set ICU_VERSION=4.8set BOOST_VERSION=49set ZLIB_VERSION=1.2.8set LIBPNG_VERSION=1.5.17set JPEG_VERSION=8dset WEBP_VERSION=1.4.0set FREETYPE_VERSION=2.4.9set POSTGRESQL_VERSION=9.1.3set TIFF_VERSION=4.0.0beta7set PROJ_VERSION=4.8.0set PROJ_GRIDS_VERSION=1.5set GDAL_VERSION=1.9.0set LIBXML2_VERSION=2.7.8set PIXMAN_VERSION=0.28.2set CAIRO_VERSION=1.12.14set SQLITE_VERSION=3071100set EXPAT_VERSION=2.1.0set GEOS_VERSION=3.3.3
Download
wget https://raw.github.com/mapnik/mapnik-packaging/master/windows/cairo-win32.patch --no-check-certificatewget https://raw.github.com/mapnik/mapnik-packaging/master/windows/libxml.patch --no-check-certificatecd %PKGDIR%curl http://iweb.dl.sourceforge.net/project/boost/boost/1.%BOOST_VERSION%.0/boost_1_%BOOST_VERSION%_0.tar.gz -Ocurl http://www.ijg.org/files/jpegsr%JPEG_VERSION%.zip -Ocurl https://webp.googlecode.com/files/libwebp-%WEBP_VERSION%-windows-x86.zip -Ocurl http://ftp.igh.cnrs.fr/pub/nongnu/freetype/freetype-%FREETYPE_VERSION%.tar.gz -Ocurl http://ftp.postgresql.org/pub/source/v%POSTGRESQL_VERSION%/postgresql-%POSTGRESQL_VERSION%.tar.gz -Ocurl ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng15/libpng-%LIBPNG_VERSION%.tar.gz -Ocurl http://www.zlib.net/zlib-%ZLIB_VERSION%.tar.gz -Ocurl http://download.osgeo.org/libtiff/tiff-%TIFF_VERSION%.tar.gz -Ocurl http://www.cairographics.org/releases/pixman-%PIXMAN_VERSION%.tar.gz -Ocurl http://www.cairographics.org/releases/cairo-%CAIRO_VERSION%.tar.xz -Ocurl http://download.icu-project.org/files/icu4c/4.8.1.1/icu4c-4_8_1_1-src.tgz -Ocurl ftp://xmlsoft.org/libxml2/libxml2-%LIBXML2_VERSION%.tar.gz -Ocurl http://iweb.dl.sourceforge.net/project/expat/expat_win32/%EXPAT_VERSION%/expat-win32bin-%EXPAT_VERSION%.exe -Ocurl http://download.osgeo.org/gdal/gdal-%GDAL_VERSION%.tar.gz -Ocurl http://www.sqlite.org/sqlite-amalgamation-%SQLITE_VERSION%.zip -Ocurl http://download.osgeo.org/proj/proj-%PROJ_VERSION%.tar.gz -Ocurl http://download.osgeo.org/proj/proj-datumgrid-%PROJ_GRIDS_VERSION%.zip -Ocurl http://download.osgeo.org/geos/geos-%GEOS_VERSION%.tar.bz2 -OIf BOOST and EXPAT don't seem to download properly by CURL, check the file you get. It probably containsan error/redirect, telling you to visit their project download URLs like these to select a mirror:http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.gz/downloadhttp://downloads.sourceforge.net/project/expat/expat_win32/2.1.0/expat-win32bin-2.1.0.execd %ROOTDIR%
Building individual packages
NOTE: Some packages require different commands depending on the VC++ version. To avoid run-time clashes, it is a good idea to have a separate %ROOTDIR% for every build variant.
ICU
bsdtar xvfz %PKGDIR%\icu4c-4_8_1_1-src.tgz
VC++ 2008
cd icu/sourcebash ./runConfigure Cygwin/MSVC --prefix=%ROOTDIR%\icumake install
VC++ 2010/2012
cd icu/msbuild source\allinone\allinone.sln /t:Rebuild /p:Configuration="Release" /p:Platform=Win32cd %ROOTDIR%
boost
bsdtar xzf %PKGDIR%/boost_1_%BOOST_VERSION%_0.tar.gzcd boost_1_%BOOST_VERSION%_0#set to -vc110 if using MSVC 2012set BOOST_PREFIX=boost-%BOOST_VERSION%-vc100bootstrap.bat# note for VS2012, use toolset=msvc-11.0 and VS2010 use toolset=msvc-10.0 bjam toolset=msvc --prefix=..\\%BOOST_PREFIX% --with-thread --with-filesystem --with-date_time --with-system --with-program_options --with-regex --with-chrono --disable-filesystem2 -sHAVE_ICU=1 -sICU_PATH=%ROOTDIR%\\icu -sICU_LINK=%ROOTDIR%\\icu\\lib\\icuuc.lib release link=static install --build-type=complete# if you need python# note for VS2012, use toolset=msvc-11.0 and VS2010 use toolset=msvc-10.0 bjam toolset=msvc --prefix=..\\%BOOST_PREFIX% --with-python python=2.7 release link=static --build-type=complete installcd %ROOTDIR%
webp
unzip %PKGDIR%\libwebp-%WEBP_VERSION%-windows-x86.ziprename libwebp-%WEBP_VERSION%-windows-x86 webp@rem nothing more needed as we use the binariescd %ROOTDIR%
Jpeg
unzip %PKGDIR%\jpegsr%JPEG_VERSION%.ziprename jpeg-%JPEG_VERSION% jpegcd jpeg copy jconfig.txt jconfig.hnmake /f Makefile.vc nodebug=1If you receive an error about not finding Win32.mak, you may need to do something like:set INCLUDE=%include%;C:\Program Files\Microsoft SDKs\Windows\v7.1\Includecd %ROOTDIR%
Freetype
bsdtar xfz "%PKGDIR%\freetype-%FREETYPE_VERSION%.tar.gz"rename freetype-%FREETYPE_VERSION% freetypecd freetype
VC++ 2008
vcbuild builds\win32\vc2008\freetype.vcproj "Release|Win32"
VC++ 2010/2012
msbuild builds\win32\vc2010\freetype.sln /p:Configuration=Release /p:Platform=Win32move objs\win32\vc2010\freetype249.lib freetype.libcd %ROOTDIR%
zlib
VC++ 2008
bsdtar xvfz %PKGDIR%\zlib-%ZLIB_VERSION%.tar.gz#libpng 2010/2012 project looks for a folder called zlib-1.2.5, this is here for consistencyrename zlib-%ZLIB_VERSION% zlib-1.2.5cd %ROOTDIR%\zlib-1.2.5\contrib\masmx86bld_ml32.batcd %ROOTDIR%\zlib-1.2.5\contrib\vstudio\cd vc9vcbuild /rebuild zlibstat.vcproj "Release|Win32"cd %ROOTDIR%\zlib-1.2.5move contrib\vstudio\vc9\x86\ZlibStatRelease\zlibstat.lib zlib.libcd %ROOTDIR%
VC++ 2010/2012
bsdtar xvfz %PKGDIR%\zlib-%ZLIB_VERSION%.tar.gz#libpng build scripts look for a folder called zlib-1.2.5rename zlib-%ZLIB_VERSION% zlib-1.2.5#zlib will be built with/by libpng belowcd %ROOTDIR%
libpng
bsdtar xvfz %PKGDIR%\libpng-%LIBPNG_VERSION%.tar.gzrename libpng-%LIBPNG_VERSION% libpng
VC++ 2008
cd %ROOTDIR%\libpng\projects\visualc71vcbuild /upgrade libpng.vcprojvcbuild libpng.vcproj "LIB Release"cd %ROOTDIR%\libpngmove projects\visualc71\Win32_LIB_Release\libpng.lib libpng.libcd %ROOTDIR%
VC++ 2010/2012
cd %ROOTDIR%\libpng\projects\vstudio\msbuild vstudio.sln /t:Rebuild /p:Configuration="Release" /p:Platform=Win32cd %ROOTDIR%\libpngmove projects\vstudio\Release\libpng15.lib libpng.libmove projects\vstudio\Release\zlib.lib ..\zlib-1.2.5\zlib.libcd %ROOTDIR%
libpq (PostgreSQL C-interface)
bsdtar xvfz "%PKGDIR%\postgresql-%POSTGRESQL_VERSION%.tar.gz"rename postgresql-%POSTGRESQL_VERSION% postgresqlcd postgresql\srcnmake /f win32.mak#Note: The following errors occurred uring this process:#.\Release\libpq.dll.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Windows Kits\8.0\bin\x86\mt.EXE"' : return code '0x1f' # However libpq.lib was successfully built.
cd %ROOTDIR%
Tiff
bsdtar xvfz %PKGDIR%\tiff-%TIFF_VERSION%.tar.gzrename tiff-%TIFF_VERSION% tiffcd tiffset P1=s/\^#JPEG_SUPPORT.*/JPEG_SUPPORT = 1/;set P2=s/\^#JPEGDIR.*/JPEGDIR = %ROOTDIR:\=\\\%\\\jpeg/;set P3=s/\^#JPEG_INCLUDE/JPEG_INCLUDE/;set P4=s/\^#JPEG_LIB.*/JPEG_LIB = \$(JPEGDIR^)\\\libjpeg.lib/;set P5=s/\^#ZIP_SUPPORT.*/ZIP_SUPPORT = 1/;set P6=s/\^#ZLIBDIR.*/ZLIBDIR = %ROOTDIR:\=\\\%\\\zlib-1.2.5/;set P7=s/\^#ZLIB_INCLUDE/ZLIB_INCLUDE/;
VC++ 2008
set P8=s/\^#ZLIB_LIB.*/ZLIB_LIB = \$(ZLIBDIR^)\\\zlib.lib/;
VC++ 2010/2012
set P8=s/\^#ZLIB_LIB.*/ZLIB_LIB = \$(ZLIBDIR^)\\\zlib.lib/;
Common
set PATTERN="%P1%%P2%%P3%%P4%%P5%%P6%%P7%%P8%"sed %PATTERN% nmake.opt > nmake.opt.fixedmove /Y nmake.opt.fixed nmake.optnmake /f Makefile.vccd %ROOTDIR%
Pixman
bsdtar xvfz %PKGDIR%\pixman-%PIXMAN_VERSION%.tar.gzrename pixman-%PIXMAN_VERSION% pixmancd pixman\pixmanmake -f Makefile.win32 "CFG=release"cd %ROOTDIR%
Cairo
@rem extract with 7zip GUI%PKGDIR%\cairo-%CAIRO_VERSION%.tar.xzrename cairo-%CAIRO_VERSION% cairocd cairo@rem edit the build\Makefile.win32.features@rem enable CAIRO_HAS_FT_FONT=1@rem edit the build\Makefile.win32.common@rem change zdll.lib to zlib.lib and zlib path to zlib-1.2.5@rem add freetype lib path and freetype.lib to CAIRO_LIBS variableset INCLUDE=%INCLUDE%;%ROOTDIR%\zlib-1.2.5set INCLUDE=%INCLUDE%;%ROOTDIR%\libpngset INCLUDE=%INCLUDE%;%ROOTDIR%\pixman\pixmanset INCLUDE=%INCLUDE%;%ROOTDIR%\cairo\boilerplateset INCLUDE=%INCLUDE%;%ROOTDIR%\cairoset INCLUDE=%INCLUDE%;%ROOTDIR%\cairo\srcset INCLUDE=%INCLUDE%;%ROOTDIR%\freetype\includemake -f Makefile.win32 "CFG=release"@rem - delete bogus cairo-version.h@rem https://github.com/mapnik/mapnik-packaging/issues/56del src\cairo-version.hcd %ROOTDIR%
LibXML2
bsdtar xvfz %PKGDIR%\libxml2-%LIBXML2_VERSION%.tar.gzrename libxml2-%LIBXML2_VERSION% libxml2cd libxml2\win32cscript configure.js compiler=msvc prefix=%ROOTDIR%\libxml2 iconv=no icu=yes include=%ROOTDIR%\icu\include lib=%ROOTDIR%\icu\libpatch -p1 < %ROOTDIR%\libxml.patchnmake /f Makefile.msvccd %ROOTDIR%
Proj4
Official release
bsdtar xfz %PKGDIR%\proj-%PROJ_VERSION%.tar.gzrename proj-%PROJ_VERSION% projcd proj/nadunzip -o ../../packages/proj-datumgrid-%PROJ_GRIDS_VERSION%.zipcd ..nmake /f Makefile.vccd %ROOTDIR%
Expat (for GDAL's KML,GPX, GeoRSS read support)
@rem - run the binary installerstart packages\expat-win32bin-%EXPAT_VERSION%.exe
GDAL
bsdtar xvfz %PKGDIR%\gdal-%GDAL_VERSION%.tar.gzmkdir gdal@rem create gdal/gdal directory to mirror if we@rem checked out from githubrename gdal-%GDAL_VERSION% gdal/gdalcd gdal/gdal@rem Edit the 'nmake.opt' to point to the location the expat binary was installed to:EXPAT_DIR="C:\Program Files (x86)\Expat 2.1.0"@rem un-comment the other two lines as wellEXPAT_INCLUDE = -I$(EXPAT_DIR)/source/libEXPAT_LIB = $(EXPAT_DIR)/bin/libexpat.lib
VC++ 2008
nmake /f makefile.vc MSVC_VER=1500
VC++ 2010
nmake /f makefile.vc MSVC_VER=1600
VC++ 2012
nmake /f makefile.vc MSVC_VER=1700cd %ROOTDIR%
sqlite
NOTE: there's no build step for sqlite, we simply unzip archive and rename dir
unzip %PKGDIR%\sqlite-amalgamation-%SQLITE_VERSION%.ziprename sqlite-amalgamation-%SQLITE_VERSION% sqlite
If you want to build sqlite standalone you might be interested in: https://skydrive.live.com/view.aspx?resid=A737583042956228!1940&cid=a737583042956228
protobuf
*NOTE: only needed if building node-mapnik >=1.x (which needs protobuf to work with vector tiles)
Download https://protobuf.googlecode.com/files/protobuf-2.5.0.zip and unzip
rename protobuf-2.5.0 protobufcd protobuf\vcprojectsvcupgrade libprotobuf-lite.vcprojvcupgrade libprotobuf.vcprojvcupgrade protoc.vcprojmsbuild libprotobuf-lite.vcxproj /p:Configuration="Release" /p:Platform=Win32msbuild libprotobuf.vcxproj /p:Configuration="Release" /p:Platform=Win32# fails linking so I used binary from google code#msbuild protoc.vcxproj /p:Configuration="Release" /p:Platform=Win32extract_includes.bat
GEOS
NOTE: this is optional as GEOS is not used by Mapnik
bsdtar xvf %PKGDIR%\geos-%GEOS_VERSION%.tar.bz2rename geos-%GEOS_VERSION% geos
VC++ 2010/2012
#on VS2012, take note of these issues:#http://trac.osgeo.org/geos/ticket/616#add #define NOMINMAX to the beginning of geos\src\operation\buffer\BufferOp.cppcd geosmkdir buildcd buildcmake -G "NMake Makefiles" ..nmake /f Makefile geos
- Building Mapnik dependencies on Windows
- Building GDAL On Windows
- Building PWLib on Windows
- SOAR系统 Building on Windows
- Building MySQLdb for Python on Windows
- Building glew on windows with mingw.txt
- Building of Kaldi VS2015 Project on Windows
- Windows 7 上安装 Mapnik
- 在Windows 7 上安装 Mapnik
- Building GTK apps for MS Windows on Linux
- (翻译)Building WebKit on Windows 7 with VS2010
- Building and Installing ACE on Windows with Microsoft Visual C++
- Building ArduPilot for Pixhawk/PX4 on Windows with Make
- Building VirtualBox OSE 5.0.0 on Windows 7 (x86)
- one 0f dependencies couldnot be loaded about sharepoint 2010 on windows 2012 / 2008 server
- Dependencies for Windows + Android
- Building ON on OpenSolaris 2008.05
- Building PHP5 on Win32
- 大数据分析师吴女士观点:大数据是回暖的计算机行业中绩增速最高的子行业
- Solr基础教程之Schema.xml(二)
- 【CSS3】background-clip
- 基于S3C6410的ARM11学习(六) 核心初始化之关闭所有中断
- codeforces 629 D. Babaei and Birthday Cake dp + 线段树
- Building Mapnik dependencies on Windows
- linux字符驱动之异步通知按键驱动
- 【算法总结】Binary Tree & Binary Search Tree 二叉树
- Android自定义view-弹性ScrollView(上)
- LeetCode之Intersection of two linked list不同方法
- 初识HTML
- NSMutableAttributedString同一个label中显示不同的字体样式
- 【android 开 发 】 - Android studio 下 NDK Jni 开发 简单例子
- 根据进程名批量杀死进程