From d02e57bbd938f119bb890597bf9a9d84fa3f9312 Mon Sep 17 00:00:00 2001 From: "jia.shao.peng" Date: Fri, 19 Aug 2011 13:40:10 +0000 Subject: [PATCH] PROJECT: Add rules for building Debian packages. Patch contributed by roubert git-svn-id: http://libphonenumber.googlecode.com/svn/trunk@340 ee073f10-1060-11df-b6a4-87a95322a99c --- cpp/CMakeLists.txt | 15 ++++++---- debian/changelog | 5 ++++ debian/compat | 1 + debian/control | 50 +++++++++++++++++++++++++++++++ debian/copyright | 28 +++++++++++++++++ debian/libphonenumber-dev.install | 3 ++ debian/libphonenumber-java.jlibs | 1 + debian/libphonenumber3.install | 1 + debian/rules | 63 +++++++++++++++++++++++++++++++++++++++ debian/source/format | 1 + 10 files changed, 163 insertions(+), 5 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/libphonenumber-dev.install create mode 100644 debian/libphonenumber-java.jlibs create mode 100644 debian/libphonenumber3.install create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 637cf5e..0e90b02 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -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 index 0000000..79c2e0c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +libphonenumber (3.8) unstable; urgency=low + + * Initial Debian Package. + + -- Fredrik Roubert Tue, 16 Aug 2011 16:11:46 +0200 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..db7ab5e --- /dev/null +++ b/debian/control @@ -0,0 +1,50 @@ +Source: libphonenumber +Priority: optional +Maintainer: Fredrik Roubert +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 index 0000000..2238707 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,28 @@ +This work was packaged for Debian by: + + Fredrik Roubert 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 index 0000000..d1bffed --- /dev/null +++ b/debian/libphonenumber-dev.install @@ -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 index 0000000..04e6faa --- /dev/null +++ b/debian/libphonenumber-java.jlibs @@ -0,0 +1 @@ +java/build/jar/libphonenumber.jar diff --git a/debian/libphonenumber3.install b/debian/libphonenumber3.install new file mode 100644 index 0000000..d0dbfd1 --- /dev/null +++ b/debian/libphonenumber3.install @@ -0,0 +1 @@ +usr/lib/lib*.so.* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b067e8e --- /dev/null +++ b/debian/rules @@ -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 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) -- 2.7.4