4 # Copyright (C) 2011 The Libphonenumber Authors
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # Uncomment this to turn on verbose mode.
21 include /usr/share/cdbs/1/rules/debhelper.mk
22 include /usr/share/cdbs/1/class/maven.mk
24 JAVA_HOME := /usr/lib/jvm/default-java
25 DEB_MAVEN_DOC_TARGET := javadoc:jar javadoc:aggregate
29 CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/usr
30 CPP_BUILD := cpp/build
31 JAVA_BUILD := java/build
33 # CMake doesn't read CPPFLAGS and dh_auto commands are not used in this rules
34 # file so we have to manually set the flags here to ensure that hardening flags
37 CXXFLAGS += $(CPPFLAGS)
39 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
44 ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
47 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
48 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
49 MAKEFLAGS += -j$(NUMJOBS)
53 # dh $@ --with javahelper
55 #override_dh_auto_configure:
56 configure/libphonenumber6::
57 mkdir -p $(CPP_BUILD) && cd $(CPP_BUILD) && $(CMAKE) $(CMAKE_FLAGS) ..
59 #override_dh_auto_build:
60 # ( cd tools/java && $(MVN) package )
62 # ln -s /usr/share/java/junit4.jar java/lib/junit-4.8.1.jar
63 # $(ANT) -f $(JAVA_BUILD).xml jar
64 build/libphonenumber6::
65 ln -sf cpp-build-1.0-SNAPSHOT.jar tools/java/cpp-build/target/cpp-build-1.0-SNAPSHOT-jar-with-dependencies.jar
66 ln -sf /usr/share/java/protobuf.jar tools/java/cpp-build/target/protobuf-java-debian.jar
67 $(MAKE) -C $(CPP_BUILD) phonenumber phonenumber-shared
69 #override_dh_auto_test:
70 #ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
71 # $(MAKE) -C $(CPP_BUILD) test
72 # $(ANT) -f $(JAVA_BUILD).xml junit
75 # Hack for multiarch: CMake doesn't really support libdir so we just manually
76 # move /usr/lib/* to a proper multiarch location.
77 #override_dh_auto_install:
79 dh_auto_install --builddirectory=$(CPP_BUILD)
80 mkdir -p debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH)
81 mv debian/tmp/usr/lib/* debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH)
82 mv debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH) \
83 debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
85 #override_dh_auto_clean:
87 -test -d $(CPP_BUILD) && $(MAKE) -C $(CPP_BUILD) clean
88 #-$(ANT) -f $(JAVA_BUILD).xml clean
89 #-( cd tools/java && $(MVN) clean )