aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex85k <alex85k@github.com>2017-10-02 23:19:59 +0500
committeralex85k <alex85k@github.com>2017-10-02 23:19:59 +0500
commitc856dc482deb940803378e9a3c98e8ac462a54dc (patch)
treed53fb536f960b53cc8720340927d3ec357d2d9c6
parent0ecd97a1105db5ab5e29ff273c8b2401e71290cf (diff)
downloadvcpkg-c856dc482deb940803378e9a3c98e8ac462a54dc.tar.gz
vcpkg-c856dc482deb940803378e9a3c98e8ac462a54dc.zip
[ReadOSM] initial port
-rw-r--r--ports/readosm/CONTROL4
-rw-r--r--ports/readosm/fix-makefiles.patch49
-rw-r--r--ports/readosm/fix-version-macro.patch13
-rw-r--r--ports/readosm/portfile.cmake78
4 files changed, 144 insertions, 0 deletions
diff --git a/ports/readosm/CONTROL b/ports/readosm/CONTROL
new file mode 100644
index 000000000..bc2853daf
--- /dev/null
+++ b/ports/readosm/CONTROL
@@ -0,0 +1,4 @@
+Source: readosm
+Version: 1.1.0
+Description: ReadOSM is an open source library to extract valid data from within an Open Street Map input file (.osm or .osm.pbf)
+Build-Depends: expat, zlib
diff --git a/ports/readosm/fix-makefiles.patch b/ports/readosm/fix-makefiles.patch
new file mode 100644
index 000000000..3904b5136
--- /dev/null
+++ b/ports/readosm/fix-makefiles.patch
@@ -0,0 +1,49 @@
+diff --git a/makefile.vc b/makefile.vc
+index 791aedf..d294548 100644
+--- a/makefile.vc
++++ b/makefile.vc
+@@ -8,7 +8,7 @@ LIBOBJ = src\readosm.obj src\osmxml.obj \
+ src\protobuf.obj src\osm_objects.obj
+ READOSM_DLL = readosm$(VERSION).dll
+
+-CFLAGS = /nologo -IC:\OSGeo4W\include -Iheaders $(OPTFLAGS)
++CFLAGS = /nologo -I$(INSTALLED_ROOT)\include -Iheaders $(OPTFLAGS)
+
+ default: all
+
+@@ -21,9 +21,9 @@ readosm.lib: $(LIBOBJ)
+ $(READOSM_DLL): readosm_i.lib
+
+ readosm_i.lib: $(LIBOBJ)
+- link /debug /dll /out:$(READOSM_DLL) \
++ link $(LINK_FLAGS) /dll /out:$(READOSM_DLL) \
+ /implib:readosm_i.lib $(LIBOBJ) \
+- C:\OSGeo4w\lib\libexpat.lib C:\OSGeo4w\lib\zlib.lib
++ $(LIBS_ALL)
+ if exist $(READOSM_DLL).manifest mt -manifest \
+ $(READOSM_DLL).manifest -outputresource:$(READOSM_DLL);2
+
+@@ -35,7 +35,7 @@ clean:
+ del *.exp
+ del *.manifest
+ del *.lib
+- del *.obj
++ del src\*.obj
+ del *.pdb
+
+ install: all
+diff --git a/nmake.opt b/nmake.opt
+index 5e45c0e..61c44f9 100644
+--- a/nmake.opt
++++ b/nmake.opt
+@@ -1,8 +1,8 @@
+ # Directory tree where ReadOSM will be installed.
+-INSTDIR=C:\OSGeo4W
++INSTDIR=$(INST_DIR)
+
+ # Uncomment the first for an optimized build, or the second for debug.
+-OPTFLAGS= /nologo /Ox /fp:precise /W3 /MD /D_CRT_SECURE_NO_WARNINGS \
++OPTFLAGS= /nologo /fp:precise /W3 $(CL_FLAGS) /D_CRT_SECURE_NO_WARNINGS \
+ /DDLL_EXPORT
+ #OPTFLAGS= /nologo /Zi /MD /Fdreadosm.pdb /DDLL_EXPORT
+
diff --git a/ports/readosm/fix-version-macro.patch b/ports/readosm/fix-version-macro.patch
new file mode 100644
index 000000000..b091b3359
--- /dev/null
+++ b/ports/readosm/fix-version-macro.patch
@@ -0,0 +1,13 @@
+diff --git a/src/readosm.c b/src/readosm.c
+index e1dda27..7977339 100644
+--- a/src/readosm.c
++++ b/src/readosm.c
+@@ -50,7 +50,7 @@
+
+ #if defined(_WIN32) && !defined(__MINGW32__)
+ /* MSVC: avoiding to include at all config.h */
+-#define VERSION 1.1.0
++#define VERSION "1.1.0"
+ #else
+ #include "config.h"
+ #endif
diff --git a/ports/readosm/portfile.cmake b/ports/readosm/portfile.cmake
new file mode 100644
index 000000000..b3870d80e
--- /dev/null
+++ b/ports/readosm/portfile.cmake
@@ -0,0 +1,78 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/readosm-1.1.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.gaia-gis.it/gaia-sins/readosm-1.1.0.tar.gz"
+ FILENAME "readosm-1.1.0.tar.gz"
+ SHA512 d3581f564c4461c6a1a3d5fd7d18a262c884b2ac935530064bfaebd6c05d692fb92cc600fb40e87e03f7160ebf0eeeb05f51a0e257935d056b233fe28fc01a11
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/fix-makefiles.patch
+ ${CMAKE_CURRENT_LIST_DIR}/fix-version-macro.patch
+)
+
+find_program(NMAKE nmake)
+
+set(LIBS_ALL_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/expat.lib ${CURRENT_INSTALLED_DIR}/debug/lib/zlibd.lib")
+set(LIBS_ALL_REL "${CURRENT_INSTALLED_DIR}/lib/expat.lib ${CURRENT_INSTALLED_DIR}/lib/zlib.lib")
+
+if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ set(CL_FLAGS_DBG "/MDd /Zi")
+ set(CL_FLAGS_REL "/MD /Ox")
+else()
+ set(CL_FLAGS_DBG "/MTd /Zi")
+ set(CL_FLAGS_REL "/MT /Ox")
+endif()
+
+################
+# Debug build
+################
+message(STATUS "Building ${TARGET_TRIPLET}-dbg")
+
+file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" INST_DIR_DBG)
+
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} -f makefile.vc clean install
+ INST_DIR=${INST_DIR_DBG} INSTALLED_ROOT=${CURRENT_INSTALLED_DIR} "LINK_FLAGS=/debug" "CL_FLAGS=${CL_FLAGS_DBG}"
+ "LIBS_ALL=${LIBS_ALL_DBG}"
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME nmake-build-${TARGET_TRIPLET}-debug
+)
+vcpkg_copy_pdbs()
+message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
+
+################
+# Release build
+################
+message(STATUS "Building ${TARGET_TRIPLET}-rel")
+
+file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL)
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} -f makefile.vc clean install
+ INST_DIR=${INST_DIR_REL} INSTALLED_ROOT=${CURRENT_INSTALLED_DIR} "LINK_FLAGS=" "CL_FLAGS=${CL_FLAGS_REL}"
+ "LIBS_ALL=${LIBS_ALL_REL}"
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME nmake-build-${TARGET_TRIPLET}-release
+)
+message(STATUS "Building ${TARGET_TRIPLET}-rel done")
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/readosm RENAME copyright)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/readosm_i.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/readosm_i.lib)
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/readosm.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/readosm.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/readosm_i.lib ${CURRENT_PACKAGES_DIR}/lib/readosm.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/readosm_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/readosm.lib)
+endif()
+
+
+message(STATUS "Packaging ${TARGET_TRIPLET} done")