diff --git a/ports/mapnik/portfile.cmake b/ports/mapnik/portfile.cmake new file mode 100644 index 00000000000000..1d87c6e9853e1f --- /dev/null +++ b/ports/mapnik/portfile.cmake @@ -0,0 +1,113 @@ +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mathisloge/mapnik + REF 3397fff8eaf3f4a40bc478e64cfb7db6ad4c5474 + SHA512 7ffb698a30e26078b8cee37249680f0206636464016b85d2898345480cd046fe1a7eb78391a7033d12d26652026735a8a9ca91ce56044a3bba4c6e79062023b3 + HEAD_REF master + PATCHES + "use-proj4.patch" +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + jpeg USE_JPEG + png USE_PNG + tiff USE_TIFF + webp USE_WEBP + libxml2 USE_LIBXML2 + cairo USE_CAIRO + proj USE_PROJ + "grid-renderer" USE_GRID_RENDERER + "svg-renderer" USE_SVG_RENDERER + "input-csv" USE_PLUGIN_INPUT_CSV + "input-gdal" USE_PLUGIN_INPUT_GDAL + "input-geobuf" USE_PLUGIN_INPUT_GEOBUF + "input-geojson" USE_PLUGIN_INPUT_GEOJSON + "input-ogr" USE_PLUGIN_INPUT_OGR + "input-pgraster" USE_PLUGIN_INPUT_PGRASTER + "input-postgis" USE_PLUGIN_INPUT_POSTGIS + "input-raster" USE_PLUGIN_INPUT_RASTER + "input-shape" USE_PLUGIN_INPUT_SHAPE + "input-sqlite" USE_PLUGIN_INPUT_SQLITE + "input-topojson" USE_PLUGIN_INPUT_TOPOJSON + viewer BUILD_DEMO_VIEWER + demo BUILD_DEMO_CPP + "utility-geometry-to-wkb" BUILD_UTILITY_GEOMETRY_TO_WKB + "utility-mapnik-index" BUILD_UTILITY_MAPNIK_INDEX + "utility-mapnik-render" BUILD_UTILITY_MAPNIK_RENDER + "utility-ogrindex" BUILD_UTILITY_OGRINDEX + "utility-pgsql2sqlite" BUILD_UTILITY_PGSQL2SQLITE + "utility-shapeindex" BUILD_UTILITY_SHAPEINDEX + "utility-svg2png" BUILD_UTILITY_SVG2PNG +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + ${FEATURE_OPTIONS} + -DCOPY_LIBRARIES_FOR_EXECUTABLES=OFF + -DCOPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES=OFF + -DINSTALL_DEPENDENCIES=OFF + -DBUILD_SHARED_LIBS=ON + -DBUILD_TEST=OFF + -DBUILD_BENCHMARK=OFF + -DUSE_EXTERNAL_MAPBOX_GEOMETRY=ON + -DUSE_EXTERNAL_MAPBOX_POLYLABEL=ON + -DUSE_EXTERNAL_MAPBOX_PROTOZERO=ON + -DUSE_EXTERNAL_MAPBOX_VARIANT=ON + -DINSTALL_CMAKE_DIR=share/${PORT}/cmake + -DFONTS_INSTALL_DIR=share/${PORT}/fonts +) + +vcpkg_install_cmake() + +# copy plugins into tool path, if any plugin is installed +if(IS_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin/plugins) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/plugins DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) +endif() +vcpkg_copy_pdbs() + +if("demo" IN_LIST FEATURES) + file(COPY ${SOURCE_PATH}/demo/data DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}/demo) + vcpkg_copy_tools(TOOL_NAMES mapnik-demo AUTO_CLEAN) +endif() + +if("viewer" IN_LIST FEATURES) + # copy the ini file to reference the plugins correctly + file(COPY ${CURRENT_PACKAGES_DIR}/bin/viewer.ini DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) + vcpkg_copy_tools(TOOL_NAMES mapnik-viewer AUTO_CLEAN) +endif() + +if("utility-geometry-to-wkb" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES geometry_to_wkb AUTO_CLEAN) +endif() + +if("utility-mapnik-index" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES mapnik-index AUTO_CLEAN) +endif() +if("utility-mapnik-render" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES mapnik-render AUTO_CLEAN) +endif() +if("utility-ogrindex" IN_LIST FEATURES) + # build is currently not supported + # vcpkg_copy_tools(TOOL_NAMES ogrindex AUTO_CLEAN) +endif() +if("utility-pgsql2sqlite" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES pgsql2sqlite AUTO_CLEAN) +endif() +if("utility-shapeindex" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES shapeindex AUTO_CLEAN) +endif() +if("utility-svg2png" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES svg2png AUTO_CLEAN) +endif() + +vcpkg_fixup_cmake_targets(CONFIG_PATH share/${PORT}/cmake) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(INSTALL ${SOURCE_PATH}/fonts/unifont_license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME fonts_copyright) +file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) diff --git a/ports/mapnik/usage b/ports/mapnik/usage new file mode 100644 index 00000000000000..e89d8a415b3e8a --- /dev/null +++ b/ports/mapnik/usage @@ -0,0 +1,7 @@ +The package mapnik provides CMake targets: + + find_package(mapnik CONFIG REQUIRED) + target_link_libraries(main PRIVATE mapnik::core mapnik::mapnik mapnik::json mapnik::wkt) + +If any plugins were installed, the variable ${MAPNIK_PLUGINS_DIR} contains the plugin directory +Fonts are available with the variable ${MAPNIK_FONTS_DIR} diff --git a/ports/mapnik/use-proj4.patch b/ports/mapnik/use-proj4.patch new file mode 100644 index 00000000000000..4c4df7522bb2b0 --- /dev/null +++ b/ports/mapnik/use-proj4.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 981eb75..279df6a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -231,12 +231,12 @@ endif() + + if(USE_PROJ) + #https://proj.org/development/cmake.html +- mapnik_find_package(PROJ REQUIRED) +- math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) ++ mapnik_find_package(PROJ4 REQUIRED) ++ math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) +- list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) +- list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) ++ list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) ++ # list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) # this adds some non existent directory when building with vcpgk -> commented out + endif() + + if(USE_GRID_RENDERER) diff --git a/ports/mapnik/vcpkg.json b/ports/mapnik/vcpkg.json new file mode 100644 index 00000000000000..665843395b0873 --- /dev/null +++ b/ports/mapnik/vcpkg.json @@ -0,0 +1,210 @@ +{ + "name": "mapnik", + "version-semver": "4.0.0", + "description": "Mapnik is an open source toolkit for developing mapping applications.", + "homepage": "https://github.com/mapnik/mapnik", + "supports": "!(static & windows)", + "dependencies": [ + "boost-assign", + "boost-bimap", + "boost-filesystem", + "boost-geometry", + "boost-gil", + "boost-interprocess", + { + "name": "boost-locale", + "features": [ + "icu" + ] + }, + "boost-msm", + "boost-property-tree", + { + "name": "boost-regex", + "features": [ + "icu" + ] + }, + "boost-spirit", + "boost-system", + { + "name": "freetype", + "features": [ + "bzip2", + "png" + ] + }, + { + "name": "harfbuzz", + "features": [ + "icu" + ] + }, + "icu", + "mapbox-geometry", + "mapbox-polylabel", + "mapbox-variant", + "protozero", + "zlib" + ], + "features": { + "cairo": { + "description": "Cairo renderer", + "dependencies": [ + "cairo", + "cairomm" + ] + }, + "demo": { + "description": "Make demo application" + }, + "grid-renderer": { + "description": "Grid renderer" + }, + "input-csv": { + "description": "CSV input plugin" + }, + "input-gdal": { + "description": "GDAL input plugin", + "dependencies": [ + "gdal" + ] + }, + "input-geobuf": { + "description": "GEOBUF input plugin", + "dependencies": [ + "protozero" + ] + }, + "input-geojson": { + "description": "GEOJSON input plugin" + }, + "input-ogr": { + "description": "OGR input plugin", + "dependencies": [ + "gdal" + ] + }, + "input-pgraster": { + "description": "PGRASTER input plugin", + "dependencies": [ + "libodb-pgsql", + "libpq" + ] + }, + "input-postgis": { + "description": "POSTGIS input plugin", + "dependencies": [ + "libodb-pgsql", + "libpq" + ] + }, + "input-raster": { + "description": "RASTER input plugin" + }, + "input-shape": { + "description": "SHAPE input plugin" + }, + "input-sqlite": { + "description": "SQLITE input plugin", + "dependencies": [ + "sqlite3" + ] + }, + "input-topojson": { + "description": "TOPOJSON input plugin" + }, + "jpeg": { + "description": "add jpeg support", + "dependencies": [ + "libjpeg-turbo" + ] + }, + "libxml2": { + "description": "use libxml2 instead of rapidxml", + "dependencies": [ + "libxml2" + ] + }, + "png": { + "description": "add png support", + "dependencies": [ + "libpng" + ] + }, + "proj": { + "description": "PROJ Functionalities", + "dependencies": [ + { + "name": "proj4", + "features": [ + "database" + ] + } + ] + }, + "svg-renderer": { + "description": "SVG renderer" + }, + "tiff": { + "description": "add tiff support", + "dependencies": [ + "tiff" + ] + }, + "utility-geometry-to-wkb": { + "description": "utility application geometry-to-wkb", + "dependencies": [ + "boost-program-options" + ] + }, + "utility-mapnik-index": { + "description": "utility application mapnik-index", + "dependencies": [ + "boost-program-options" + ] + }, + "utility-mapnik-render": { + "description": "utility application mapnik-render", + "dependencies": [ + "boost-program-options" + ] + }, + "utility-ogrindex": { + "description": "utility application ogrindex" + }, + "utility-pgsql2sqlite": { + "description": "utility application pgsql2sqlite", + "dependencies": [ + "boost-program-options", + "libodb-pgsql", + "libpq", + "sqlite3" + ] + }, + "utility-shapeindex": { + "description": "utility application shapeindex", + "dependencies": [ + "boost-program-options" + ] + }, + "utility-svg2png": { + "description": "utility application svg2png", + "dependencies": [ + "boost-program-options" + ] + }, + "viewer": { + "description": "Make demo viewer application", + "dependencies": [ + "qt5-base" + ] + }, + "webp": { + "description": "add webp support", + "dependencies": [ + "libwebp" + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index a4360fc3e0a0a4..34216c316f0801 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3916,6 +3916,10 @@ "baseline": "0.5.0", "port-version": 0 }, + "mapnik": { + "baseline": "4.0.0", + "port-version": 0 + }, "marble": { "baseline": "19.08.2", "port-version": 2 diff --git a/versions/m-/mapnik.json b/versions/m-/mapnik.json new file mode 100644 index 00000000000000..2a91c0af0b361b --- /dev/null +++ b/versions/m-/mapnik.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "89db548e3580b40d408048956eb178fab6981c10", + "version-semver": "4.0.0", + "port-version": 0 + } + ] +}