PROJECT: Add rules for building Debian packages. Patch contributed by roubert
authorjia.shao.peng <jia.shao.peng@ee073f10-1060-11df-b6a4-87a95322a99c>
Fri, 19 Aug 2011 13:40:10 +0000 (13:40 +0000)
committerjia.shao.peng <jia.shao.peng@ee073f10-1060-11df-b6a4-87a95322a99c>
Fri, 19 Aug 2011 13:40:10 +0000 (13:40 +0000)
git-svn-id: http://libphonenumber.googlecode.com/svn/trunk@340 ee073f10-1060-11df-b6a4-87a95322a99c

cpp/CMakeLists.txt
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/libphonenumber-dev.install [new file with mode: 0644]
debian/libphonenumber-java.jlibs [new file with mode: 0644]
debian/libphonenumber3.install [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]

index 637cf5e..0e90b02 100644 (file)
@@ -17,6 +17,8 @@
 cmake_minimum_required (VERSION 2.8)
 
 project (libphonenumber)
+set (libphonenumber_VERSION_MAJOR 3)
+set (libphonenumber_VERSION_MINOR 8)
 
 # Helper functions dealing with finding libraries and programs this library
 # depends on.
@@ -260,8 +262,11 @@ if (BUILD_SHARED_LIB)
   add_library (phonenumber-shared SHARED ${SOURCES})
   add_dependencies (phonenumber-shared generate-sources ${METADATA_TARGET})
   set_target_properties (phonenumber-shared
-                         PROPERTIES OUTPUT_NAME "phonenumber")
-  set_target_properties (phonenumber-shared PROPERTIES PREFIX "lib")
+    PROPERTIES
+      OUTPUT_NAME "phonenumber"
+      PREFIX "lib"
+      SOVERSION ${libphonenumber_VERSION_MAJOR}
+      VERSION ${libphonenumber_VERSION_MAJOR}.${libphonenumber_VERSION_MINOR})
 endif ()
 
 set (LIBRARY_DEPS ${PROTOBUF_LIB} ${ICU_LIB} ${Boost_LIBRARIES})
@@ -302,6 +307,7 @@ target_link_libraries (
   libphonenumber_test
   phonenumber_testing ${GTEST_LIB} pthread
 )
+add_custom_target(test COMMAND libphonenumber_test DEPENDS libphonenumber_test)
 
 # Install rules.
 install (FILES
@@ -317,10 +323,9 @@ install (FILES
   DESTINATION include/base/
 )
 install (FILES src/base/memory/singleton.h
-         DESTINATION include/base/memory)
-
+         DESTINATION include/base/memory/)
 install (FILES src/base/synchronization/lock.h
-         DESTINATION include/base/synchronization)
+         DESTINATION include/base/synchronization/)
 
 install (TARGETS phonenumber LIBRARY DESTINATION lib/ ARCHIVE DESTINATION lib/)
 
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..79c2e0c
--- /dev/null
@@ -0,0 +1,5 @@
+libphonenumber (3.8) unstable; urgency=low
+
+  * Initial Debian Package.
+
+ -- Fredrik Roubert <roubert@google.com>  Tue, 16 Aug 2011 16:11:46 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..db7ab5e
--- /dev/null
@@ -0,0 +1,50 @@
+Source: libphonenumber
+Priority: optional
+Maintainer: Fredrik Roubert <roubert@google.com>
+Build-Depends: ant,
+               cmake,
+               debhelper (>= 7.0.50~),
+               default-jdk | java-sdk,
+               javahelper (>= 0.34),
+               libboost-dev (>= 1.40),
+               libboost-thread-dev (>= 1.40),
+               libgtest-dev,
+               libicu-dev (>= 4.4),
+               libprotobuf-dev (>= 2.4),
+               libre2-dev,
+               protobuf-compiler
+Standards-Version: 3.9.1
+Section: libs
+Homepage: http://code.google.com/p/libphonenumber/
+Vcs-Browser: http://code.google.com/p/libphonenumber/source/browse/
+Vcs-Svn: http://libphonenumber.googlecode.com/svn/trunk/
+
+Package: libphonenumber-dev
+Section: libdevel
+Architecture: any
+Depends: libphonenumber3 (=${binary:Version}), ${misc:Depends}
+Description: parsing/formatting/validating phone numbers - development
+ Google's common C++ and Java library for parsing, formatting, storing and
+ validating international phone numbers.
+ .
+ This package contains the static libraries and include files.
+
+Package: libphonenumber3
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: parsing/formatting/validating phone numbers - runtime
+ Google's common C++ and Java library for parsing, formatting, storing and
+ validating international phone numbers.
+ .
+ This package contains the runtime libraries.
+
+Package: libphonenumber-java
+Section: java
+Architecture: all
+Depends: ${java:Depends}, ${misc:Depends}
+Description: parsing/formatting/validating phone numbers - java
+ Google's common C++ and Java library for parsing, formatting, storing and
+ validating international phone numbers.
+ .
+ This package contains the JAR files.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..2238707
--- /dev/null
@@ -0,0 +1,28 @@
+This work was packaged for Debian by:
+
+    Fredrik Roubert <roubert@google.com> on Tue, 16 Aug 2011 16:11:46 +0200
+
+It was downloaded from:
+
+    http://code.google.com/p/libphonenumber/
+
+Copyright:
+
+    Copyright (C) 2011 The Libphonenumber Authors
+
+License:
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+On Debian systems, the complete text of the Apache License, Version 2.0
+can be found in `/usr/share/common-licenses/Apache-2.0'.
diff --git a/debian/libphonenumber-dev.install b/debian/libphonenumber-dev.install
new file mode 100644 (file)
index 0000000..d1bffed
--- /dev/null
@@ -0,0 +1,3 @@
+usr/include/*
+usr/lib/lib*.a
+usr/lib/lib*.so
diff --git a/debian/libphonenumber-java.jlibs b/debian/libphonenumber-java.jlibs
new file mode 100644 (file)
index 0000000..04e6faa
--- /dev/null
@@ -0,0 +1 @@
+java/build/jar/libphonenumber.jar
diff --git a/debian/libphonenumber3.install b/debian/libphonenumber3.install
new file mode 100644 (file)
index 0000000..d0dbfd1
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/lib*.so.*
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..b067e8e
--- /dev/null
@@ -0,0 +1,63 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Copyright (C) 2011 The Libphonenumber Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+ANT ?= ant
+CMAKE ?= cmake
+JAVA_HOME ?= /usr/lib/jvm/default-java
+
+CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/usr
+CPP_BUILD := cpp/build
+JAVA_BUILD := java/build
+
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+  CFLAGS += -O0
+else
+  CFLAGS += -O2
+endif
+ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
+  INSTALL_PROGRAM += -s
+endif
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+  MAKEFLAGS += -j$(NUMJOBS)
+endif
+
+%:
+       dh $@ --with javahelper
+
+override_dh_auto_configure:
+       mkdir -p $(CPP_BUILD) && cd $(CPP_BUILD) && $(CMAKE) $(CMAKE_FLAGS) ..
+
+override_dh_auto_build:
+       $(MAKE) -C $(CPP_BUILD) phonenumber phonenumber-shared
+       $(ANT) -f $(JAVA_BUILD).xml jar
+
+override_dh_auto_test:
+ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
+       $(MAKE) -C $(CPP_BUILD) test
+       $(ANT) -f $(JAVA_BUILD).xml junit
+endif
+
+override_dh_auto_install:
+       dh_auto_install --builddirectory=$(CPP_BUILD)
+
+override_dh_auto_clean:
+       -test -d $(CPP_BUILD) && $(MAKE) -C $(CPP_BUILD) clean
+       -$(ANT) -f $(JAVA_BUILD).xml clean
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..89ae9db
--- /dev/null
@@ -0,0 +1 @@
+3.0 (native)