Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Commit

Permalink
windows fixes for latest node-mapnik
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Feb 7, 2014
1 parent 6f22f3a commit 1021d69
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 52 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (process.platform === 'win32') {
// HOME is undefined on windows
process.env.HOME = process.env.USERPROFILE;
// Add custom library paths to the PATH
process.env.PATH = path.join(__dirname,"node_modules/mapnik/lib/mapnik/lib") +
process.env.PATH = path.join(__dirname,"node_modules/mapnik/lib/binding/") +
";" + path.join(__dirname,"node_modules/zipfile/lib");
}

Expand Down
5 changes: 3 additions & 2 deletions platforms/windows/build.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@rem for some reason this causes script to exit
@rem npm cache clean
rd /q /s node_modules
npm install --force --no-rollback
call rd /q /s node_modules
call npm cache clean
call npm install --force
1 change: 1 addition & 0 deletions platforms/windows/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
\ipch\
\include\
\obj\
\build\
.exp
.lib
.pdb
Expand Down
65 changes: 16 additions & 49 deletions platforms/windows/package.bat
Original file line number Diff line number Diff line change
@@ -1,70 +1,37 @@
set DEVROOT=c:\dev2
@rem place c++ addons outside of node_modules for now
@rem to make it easier to remove/recreate node_modules
set DEST=node_modules
set MAPNIK_INSTALL=c:\mapnik-v2.3.0
set NODEEXE="C:\Program Files (x86)\nodejs\node.exe"
set MAPNIK_DEST=%DEST%\mapnik\lib\mapnik
set MAPNIK_DATA_DEST=%DEST%\mapnik\lib\mapnik\share
mkdir %MAPNIK_DATA_DEST%

@rem make sure Python is on the PATH
set NODEEXE="c:\dev2\nodist\v\0.10.25\node.exe"
set PATH=%PATH%;c:\Python27

@rem change into current directory
cd /d %~dp0
@rem then move to main tilemill folder
cd ..\..\
set TILEMILL_DIR=%CD%

@rem mkdir %DEST%

@rem nuke any failed c++ module installs
@rem rd /q /s node_modules\bones\node_modules\jquery\node_modules\jsdom\node_modules\contextify
@rem rd /q /s node_modules\sqlite3
rd /q /s node_modules\mapnik
rd /q /s node_modules\tilelive-mapnik\node_modules\mapnik
@rem rd /q /s node_modules\millstone\node_modules\srs
@rem rd /q /s node_modules\millstone\node_modules\zipfile
@rem rd /q /s node_modules\tilelive-mapnik\node_modules\eio
set DEST=%TILEMILL_DIR%\node_modules

@rem remove then re-copy node-mapnik
xcopy /i /s /exclude:platforms\windows\excludes.txt %DEVROOT%\node-mapnik %DEST%\mapnik

rd /q /s %TILEMILL_DIR%\node_modules\mapnik
rd /q /s %TILEMILL_DIR%\node_modules\tilelive-mapnik\node_modules\mapnik
xcopy /i /s /exclude:%TILEMILL_DIR%\platforms\windows\excludes.txt %DEVROOT%\node-mapnik %DEST%\mapnik
@rem fixup paths to plugins making them relative
@rem to future location of mapnik itself
cd %DEST%\mapnik
@rem - note, intentially not quoting the below
set MAPNIK_INPUT_PLUGINS=path.join(__dirname, 'mapnik/lib/mapnik/input')
set MAPNIK_FONTS=path.join(__dirname, 'mapnik/lib/mapnik/fonts')
set MAPNIK_INPUT_PLUGINS=path.join(__dirname, 'mapnik/input')
set MAPNIK_FONTS=path.join(__dirname, 'mapnik/fonts')
python gen_settings.py
@rem augment the settings
echo var path = require('path'); module.exports.env = {'ICU_DATA': path.join(__dirname, 'mapnik/share/icu'), 'GDAL_DATA': path.join(__dirname, 'mapnik/share/gdal'),'PROJ_LIB': path.join(__dirname, 'mapnik/share/proj') }; >> lib/mapnik_settings.js

echo var path = require('path'); module.exports.env = {'GDAL_DATA': path.join(__dirname, 'mapnik/share/gdal'),'PROJ_LIB': path.join(__dirname, 'mapnik/share/proj') }; >> lib/binding/mapnik_settings.js

chdir /d %TILEMILL_DIR%
@rem symlink mapnik into main directory so npm is happy
@rem mklink /d /j node_modules/mapnik %DEST%/mapnik
set MAPNIK_DEST=%DEST%\mapnik\lib\binding\
mkdir %MAPNIK_DEST%\share
mkdir %MAPNIK_DEST%\fonts
mkdir %MAPNIK_DEST%\input

@rem - handle mapnik itself
rd /q /s %MAPNIK_DEST%
xcopy /i /s /exclude:platforms\windows\excludes.txt %MAPNIK_INSTALL% %MAPNIK_DEST%

@rem - move all other C++ addons into place
@rem rd /q /s %DEST%\zipfile
@rem xcopy /i /s /exclude:platforms\windows\excludes.txt %DEVROOT%\node-zipfile %DEST%\zipfile
@rem rd /q /s %DEST%\srs
@rem xcopy /i /s /exclude:platforms\windows\excludes.txt %DEVROOT%\node-srs %DEST%\srs
@rem rd /q /s %DEST%\sqlite3
@rem xcopy /i /s /exclude:platforms\windows\excludes.txt %DEVROOT%\node-sqlite3 %DEST%\sqlite3
@rem rd /q /s %DEST%\contextify
@rem xcopy /i /s /exclude:platforms\windows\excludes.txt %DEVROOT%\contextify %DEST%\contextify

@rem - move icu, proj, and gdal data into node-mapnik folder
rd /q /s %MAPNIK_DATA_DEST%\proj
xcopy /i /s %DEVROOT%\proj\nad %MAPNIK_DATA_DEST%\proj
rd /q /s %MAPNIK_DATA_DEST%\gdal
xcopy /i /s %DEVROOT%\gdal\data %MAPNIK_DATA_DEST%\gdal
xcopy /i /s /exclude:%TILEMILL_DIR%\platforms\windows\excludes.txt %MAPNIK_INSTALL%\lib %MAPNIK_DEST%
xcopy /i /s /exclude:%TILEMILL_DIR%\platforms\windows\excludes.txt %MAPNIK_INSTALL%\share %MAPNIK_DEST%\mapnik\share

del /q node.exe
del /q %TILEMILL_DIR%\node.exe
xcopy %NODEEXE% %TILEMILL_DIR%\node.exe
chdir %TILEMILL_DIR%

0 comments on commit 1021d69

Please sign in to comment.