[osmpbf] 01/16: Imported Upstream version 1.3.1

Bas Couwenberg sebastic at xs4all.nl
Tue Mar 11 23:42:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch debian
in repository osmpbf.

commit 47e49786e2684e43e17c147a846c8ac15c3c4dfe
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Tue Mar 11 21:12:22 2014 +0100

    Imported Upstream version 1.3.1
---
 CMakeLists.txt                                   |  15 ++++
 README                                           |   2 +
 ReleaseNotes.txt                                 |   7 ++
 debian/changelog                                 |  38 ++++++++++
 debian/compat                                    |   1 +
 debian/control                                   |  14 ++++
 debian/copyright                                 |  18 +++++
 debian/docs                                      |   3 +
 debian/libosmpbf-dev.manpages                    |   1 +
 debian/rules                                     |  89 +++++++++++++++++++++++
 debian/source/format                             |   1 +
 include/osmpbf/osmpbf.h                          |   9 +--
 pom.xml                                          |   4 +-
 resources/sample.pbf                             | Bin 0 -> 9653 bytes
 src.java/crosby/binary/test/ReadFileExample.java |  86 ++++++++++++++++++++++
 src/CMakeLists.txt                               |  19 +++++
 src/Makefile                                     |  23 +++---
 tools/CMakeLists.txt                             |  32 ++++++++
 tools/Makefile                                   |  14 ++--
 tools/osmpbf-outline.cpp                         |  15 +++-
 20 files changed, 367 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..0263928
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,15 @@
+PROJECT(OSMBinary)
+cmake_minimum_required(VERSION 2.8.5)
+
+SET(SEARCH_PREFIX CACHE PATH "Additional prefix to search libraries (Protobuf etc.)" )
+
+SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${SEARCH_PREFIX})
+
+include(FindProtobuf)
+find_package(Protobuf REQUIRED)
+include_directories(${PROTOBUF_INCLUDE_DIR})
+
+add_subdirectory(src)
+if(NOT MSVC)
+add_subdirectory(tools)
+endif()
\ No newline at end of file
diff --git a/README b/README
index 5006cda..2e8517b 100644
--- a/README
+++ b/README
@@ -6,6 +6,8 @@ See http://wiki.openstreetmap.org/wiki/PBF_Format .
 
 There is a Java and a C version of the PBF library code here.
 
+For a Java usage example, see src.java\crosby\binary\test\ReadFileExample.java
+
 C Version
 =========
 
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index 59ae489..20e18e0 100644
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -1,4 +1,11 @@
 ----------------------------------------
+Release notes for 1.3.1  -- 2013-12-11
+----------------------------------------
+
+Several building fixes and enhancements.
+
+
+----------------------------------------
 Release notes for 1.3.0  -- 2012-12-04
 ----------------------------------------
 
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..5f0d629
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,38 @@
+libosmpbf-dev (1.3.1) maverick; urgency=low
+
+  * Several building fixes and enhancements
+
+ -- Jochen Topf <jochen at topf.org>  Wed, 11 Dec 2013 21:46:12 +0100
+
+libosmpbf-dev (1.3.0) maverick; urgency=low
+
+  * Added fields into OSMHeader for OSM replication.
+  * Version number change to reflect official new version
+
+ -- Scott Crosby <scott at sacrosby.com>  Wed, 04 Dec 2012 21:29:37 -0500
+
+libosmpbf-dev (1.2.1) maverick; urgency=low
+
+  * Version number change to reflect official new version
+
+ -- Jochen Topf <jochen at topf.org>  Wed, 19 Oct 2011 09:29:37 +0100
+
+libosmpbf-dev (1.1.1j2) maverick; urgency=low
+
+  * Add manpage for osmpbf-outline tool
+
+ -- Jochen Topf <jochen at topf.org>  Fri, 6 Jun 2011 10:30:12 +0100
+
+libosmpbf-dev (1.1.1j1) maverick; urgency=low
+
+  * Add support for OSM history file
+  * Add some often used constants to OSMPBF namespace
+  * Add osmpbf-outline testing tool
+
+ -- Jochen Topf <jochen at topf.org>  Fri, 3 Jun 2011 11:36:17 +0100
+
+libosmpbf-dev (0.1) maverick; urgency=low
+
+  * Initial debian package
+
+ -- Jochen Topf <jochen at topf.org>  Wed, 13 Apr 2011 21:50:15 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..5452bb4
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,14 @@
+Source: libosmpbf-dev
+Section: libdevel
+Priority: optional
+Maintainer: Jochen Topf <jochen at topf.org>
+Build-Depends: debhelper (>= 7), libprotobuf-dev, protobuf-compiler
+Standards-Version: 3.9.1
+Homepage: http://wiki.openstreetmap.org/wiki/PBF_Format
+
+Package: libosmpbf-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Library for reading OSM PBF files.
+ Interface definition and library for reading binary
+ OpenStreetMap data files.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..7386ce0
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,18 @@
+Copyright (c) 2010 Scott A. Crosby. <scott at sacrosby.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as 
+published by the Free Software Foundation, either version 3 of the 
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+On Debian systems, the license text can usually be found in
+/usr/share/common-licenses.
+
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..fb7cedf
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+src/fileformat.proto
+src/osmformat.proto
+README
diff --git a/debian/libosmpbf-dev.manpages b/debian/libosmpbf-dev.manpages
new file mode 100644
index 0000000..e82c242
--- /dev/null
+++ b/debian/libosmpbf-dev.manpages
@@ -0,0 +1 @@
+tools/osmpbf-outline.1
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..9f5587f
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,89 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+configure: configure-stamp
+configure-stamp: 
+	dh_testdir
+	
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp  
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE) -C src
+	$(MAKE) -C tools
+
+	touch $@
+
+clean: 
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	$(MAKE) -C src clean || /bin/true
+	$(MAKE) -C tools clean || /bin/true
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_prep
+	dh_installdirs
+
+	# Add here commands to install the package into debian/libosmpbf-dev.
+	$(MAKE) -C src DESTDIR=$(CURDIR)/debian/libosmpbf-dev PREFIX=/usr install
+	$(MAKE) -C tools DESTDIR=$(CURDIR)/debian/libosmpbf-dev PREFIX=/usr install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	dh_installexamples
+	dh_install
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_python
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/include/osmpbf/osmpbf.h b/include/osmpbf/osmpbf.h
index e354907..093f4b6 100644
--- a/include/osmpbf/osmpbf.h
+++ b/include/osmpbf/osmpbf.h
@@ -2,15 +2,14 @@
 #define OSMPBF_H
 
 // this describes the low-level blob storage
-#include <osmpbf/fileformat.pb.h>
+#include <osmpbf/fileformat.pb.h> // IWYU pragma: export
 
 // this describes the high-level OSM objects
-#include <osmpbf/osmformat.pb.h>
+#include <osmpbf/osmformat.pb.h> // IWYU pragma: export
 
-namespace OSMPBF {
+#define OSMPBF_VERSION "1.3.1"
 
-    // library version
-    const char *version = "1.3.0";
+namespace OSMPBF {
 
     // the maximum size of a blob header in bytes
     const int max_blob_header_size = 64 * 1024; // 64 kB
diff --git a/pom.xml b/pom.xml
index 63c6330..91eee77 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
   <groupId>crosby.binary</groupId>
   <artifactId>osmpbf</artifactId>
   <packaging>jar</packaging>
-  <version>1.3.0</version>
+  <version>1.3.1</version>
   <name>OSM-Binary</name>
   <description>Library for the OpenStreetMap PBF format</description>
   <url>https://github.com/scrosby/OSM-binary</url>
@@ -26,6 +26,8 @@
 	<sourceDirectory>${basedir}/src.java</sourceDirectory>
     <outputDirectory>${basedir}/build</outputDirectory>
 
+   <resources><resource><directory>${basedir}/resources</directory></resource></resources>
+
     <plugins>
 	  <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/resources/sample.pbf b/resources/sample.pbf
new file mode 100644
index 0000000..8a22edf
Binary files /dev/null and b/resources/sample.pbf differ
diff --git a/src.java/crosby/binary/test/ReadFileExample.java b/src.java/crosby/binary/test/ReadFileExample.java
new file mode 100644
index 0000000..d8ad520
--- /dev/null
+++ b/src.java/crosby/binary/test/ReadFileExample.java
@@ -0,0 +1,86 @@
+package crosby.binary.test;
+
+import crosby.binary.*;
+import crosby.binary.Osmformat.*;
+import crosby.binary.file.*;
+import java.io.*;
+import java.util.List;
+
+/**
+ * Demonstrates how to read a file. Reads sample.pbf from the resources folder
+ * and prints details about it to the standard output.
+ *
+ * @author Michael Tandy
+ */
+public class ReadFileExample {
+
+    public static void main(String[] args) throws Exception {
+        InputStream input = ReadFileExample.class.getResourceAsStream("/sample.pbf");
+        BlockReaderAdapter brad = new TestBinaryParser();
+        new BlockInputStream(input, brad).process();
+    }
+
+    private static class TestBinaryParser extends BinaryParser {
+
+        @Override
+        protected void parseRelations(List<Relation> rels) {
+            if (!rels.isEmpty())
+                System.out.println("Got some relations to parse.");
+            Relation r = null;
+        }
+
+        @Override
+        protected void parseDense(DenseNodes nodes) {
+            long lastId=0;
+            long lastLat=0;
+            long lastLon=0;
+
+            for (int i=0 ; i<nodes.getIdCount() ; i++) {
+                lastId += nodes.getId(i);
+                lastLat += nodes.getLat(i);
+                lastLon += nodes.getLon(i);
+                System.out.printf("Dense node, ID %d @ %.6f,%.6f\n",
+                        lastId,parseLat(lastLat),parseLon(lastLon));
+            }
+        }
+
+        @Override
+        protected void parseNodes(List<Node> nodes) {
+            for (Node n : nodes) {
+                System.out.printf("Regular node, ID %d @ %.6f,%.6f\n",
+                        n.getId(),parseLat(n.getLat()),parseLon(n.getLon()));
+            }
+        }
+
+        @Override
+        protected void parseWays(List<Way> ways) {
+            for (Way w : ways) {
+                System.out.println("Way ID " + w.getId());
+                StringBuilder sb = new StringBuilder();
+                sb.append("  Nodes: ");
+                long lastRef = 0;
+                for (Long ref : w.getRefsList()) {
+                    lastRef+= ref;
+                    sb.append(lastRef).append(" ");
+                }
+                sb.append("\n  Key=value pairs: ");
+                for (int i=0 ; i<w.getKeysCount() ; i++) {
+                    sb.append(getStringById(w.getKeys(i))).append("=")
+                            .append(getStringById(w.getVals(i))).append(" ");
+                }
+                System.out.println(sb.toString());
+            }
+        }
+
+        @Override
+        protected void parse(HeaderBlock header) {
+            System.out.println("Got header block.");
+        }
+
+        public void complete() {
+            System.out.println("Complete!");
+        }
+
+    }
+
+}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..4a2b9ac
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,19 @@
+PROTOBUF_GENERATE_CPP(CPPS HS fileformat.proto osmformat.proto)
+
+if(MSVC)
+    set(CMAKE_CXX_FLAGS "/O3")
+else()
+    set(CMAKE_CXX_FLAGS "-O3")
+endif()
+
+add_library(osmpbf STATIC ${CPPS})
+
+set_target_properties(osmpbf PROPERTIES LINKER_LANGUAGE CXX LANGUAGE CXX)
+
+ADD_CUSTOM_COMMAND(TARGET osmpbf POST_BUILD  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/src/fileformat.pb.h ${CMAKE_SOURCE_DIR}/include/osmpbf)
+ADD_CUSTOM_COMMAND(TARGET osmpbf POST_BUILD  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/src/osmformat.pb.h ${CMAKE_SOURCE_DIR}/include/osmpbf)
+
+SET(INCLUDE_INSTALL "include/osmpbf")
+SET(files ${CMAKE_SOURCE_DIR}/include/osmpbf/osmpbf.h ${CMAKE_BINARY_DIR}/src/osmformat.pb.h ${CMAKE_BINARY_DIR}/src/fileformat.pb.h)
+INSTALL(FILES ${files} DESTINATION ${INCLUDE_INSTALL})
+install(TARGETS osmpbf LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
diff --git a/src/Makefile b/src/Makefile
index 16c3e97..f621b96 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,7 +1,10 @@
 
-CXX = g++
-CXXFLAGS = -O3
-AR = ar
+PREFIX ?= /usr/local
+CXX ?= g++
+CXXFLAGS ?= -O3 -fPIC
+
+AR ?= ar
+PROTOC ?= protoc
 
 all: libosmpbf.a ../include/osmpbf/fileformat.pb.h ../include/osmpbf/osmformat.pb.h
 
@@ -12,16 +15,16 @@ libosmpbf.a: fileformat.pb.o osmformat.pb.o
 	$(CXX) $(CXXFLAGS) -c -o $@ $<
 
 %.pb.cc ../include/osmpbf/%.pb.h: %.proto
-	protoc --proto_path=. --cpp_out=. $<
+	$(PROTOC) --proto_path=. --cpp_out=. $<
 	cp *.pb.h ../include/osmpbf/
 
 install:
-	install -m 755 -g root -o root -d $(DESTDIR)/usr/lib
-	install -m 644 -g root -o root libosmpbf.a $(DESTDIR)/usr/lib
-	install -m 755 -g root -o root -d $(DESTDIR)/usr/include/osmpbf
-	install -m 644 -g root -o root ../include/osmpbf/osmpbf.h $(DESTDIR)/usr/include/osmpbf
-	install -m 644 -g root -o root ../include/osmpbf/fileformat.pb.h $(DESTDIR)/usr/include/osmpbf
-	install -m 644 -g root -o root ../include/osmpbf/osmformat.pb.h $(DESTDIR)/usr/include/osmpbf
+	install -m 755 -d $(DESTDIR)$(PREFIX)/lib
+	install -m 644 libosmpbf.a $(DESTDIR)$(PREFIX)/lib
+	install -m 755 -d $(DESTDIR)$(PREFIX)/include/osmpbf
+	install -m 644 ../include/osmpbf/osmpbf.h $(DESTDIR)$(PREFIX)/include/osmpbf
+	install -m 644 ../include/osmpbf/fileformat.pb.h $(DESTDIR)$(PREFIX)/include/osmpbf
+	install -m 644 ../include/osmpbf/osmformat.pb.h $(DESTDIR)$(PREFIX)/include/osmpbf
 
 clean:
 	rm -f *.pb.h *.pb.cc *.pb.o libosmpbf.a
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
new file mode 100644
index 0000000..91f01eb
--- /dev/null
+++ b/tools/CMakeLists.txt
@@ -0,0 +1,32 @@
+SET(PROJECT osmpbf-outline)
+PROJECT(${PROJECT})
+
+if(MSVC)
+    set(CMAKE_CXX_FLAGS "/O3")
+else()
+    set(CMAKE_CXX_FLAGS "-O3 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64")
+endif()
+
+SET(CPP_SRC osmpbf-outline.cpp)
+SET(HPP_SRC "")
+SET(C_SRC "")
+include_directories("${CMAKE_SOURCE_DIR}/include")
+
+add_executable(${PROJECT} ${HPP_SRC} ${CPP_SRC} ${C_SRC})
+set_target_properties(${PROJECT} PROPERTIES LINKER_LANGUAGE CXX LANGUAGE CXX)
+
+find_package(ZLIB REQUIRED)
+include_directories(${ZLIB_INCLUDE_DIR})
+
+INCLUDE (CheckIncludeFiles)
+CHECK_INCLUDE_FILES(winsock2.h HAVE_WINSOCK)
+if(HAVE_WINSOCK)
+   add_definitions( -DD_HAVE_WINSOCK )
+   SET(WINSOCK_LIB ws2_32)
+endif()
+
+
+find_package(Threads)
+target_link_libraries(${PROJECT} ${WINSOCK_LIB} ${ZLIB_LIBRARY}  osmpbf ${PROTOBUF_LITE_LIBRARIES})
+
+INSTALL(TARGETS ${PROJECT} RUNTIME DESTINATION bin)
diff --git a/tools/Makefile b/tools/Makefile
index b9fc26b..c435845 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,7 +1,11 @@
 
-CXX = g++
-CXXFLAGS = -g -I../include
-LDFLAGS = -L../src -lpthread -lz -lprotobuf-lite -losmpbf
+PREFIX ?= /usr/local
+CXX ?= g++
+CXXFLAGS ?= -g
+CXXFLAGS += -I../include
+LDFLAGS += -L../src -pthread -lz -lprotobuf-lite -losmpbf
+
+
 
 all: osmpbf-outline
 
@@ -9,8 +13,8 @@ osmpbf-outline: osmpbf-outline.cpp
 	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS)
 
 install:
-	install -m 755 -g root -o root -d $(DESTDIR)/usr/bin
-	install -m 644 -g root -o root -s osmpbf-outline $(DESTDIR)/usr/bin
+	install -m 755 -d $(DESTDIR)$(PREFIX)/bin
+	install -m 644 -s osmpbf-outline $(DESTDIR)$(PREFIX)/bin
 
 clean:
 	rm -f osmpbf-outline
diff --git a/tools/osmpbf-outline.cpp b/tools/osmpbf-outline.cpp
index d72bd55..18d5ff9 100644
--- a/tools/osmpbf-outline.cpp
+++ b/tools/osmpbf-outline.cpp
@@ -10,8 +10,12 @@
 // zlib compression is used inside the pbf blobs
 #include <zlib.h>
 
-// netinet provides the network-byte-order conversion function
-#include <netinet/in.h>
+// netinet or winsock2 provides the network-byte-order conversion function
+#ifdef D_HAVE_WINSOCK
+    #include <winsock2.h>
+#else
+    #include <netinet/in.h>
+#endif
 
 // this is the header to pbf format
 #include <osmpbf/osmpbf.h>
@@ -86,7 +90,12 @@ void debug(const char* format, ...) {
 // application main method
 int main(int argc, char *argv[]) {
     // check if the output is a tty so we can use colors
+
+#ifdef WIN32
+    usecolor = 0;
+#else
     usecolor = isatty(1);
+#endif
 
     static struct option long_options[] = {
         {"color",                no_argument, 0, 'c'},
@@ -113,7 +122,7 @@ int main(int argc, char *argv[]) {
         err("usage: %s [--color] file.osm.pbf", argv[0]);
 
     // open specified file
-    FILE *fp = fopen(argv[optind], "r");
+    FILE *fp = fopen(argv[optind], "rb");
 
     // read while the file has not reached its end
     while(!feof(fp)) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmpbf.git



More information about the Pkg-grass-devel mailing list