Imported Debian patch 0.1.0+git20131207+e452e83-0ubuntu12
[deb_libhybris.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 # Package names
7 PKG_driver := libhybris
8 PKG_driver_dev := libhybris-dev
9 PKG_driver_dbg := libhybris-dbg
10 PKG_version := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
11 PKG_source := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
12 UPS_version := $(shell echo '$(PKG_version)' | sed 's/.*://; s/-[^-]*$$//')
13 GIT_rev := $(shell echo '$(UPS_version)' | sed 's/.*+//')
14
15 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
16 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
17 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
18 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
19
20 # Compiler
21 export CC=gcc-4.7
22 export CXX=g++-4.7
23
24 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
25 CC :=$(DEB_HOST_GNU_TYPE)-$(CC)
26 CXX :=$(DEB_HOST_GNU_TYPE)-$(CXX)
27 endif
28
29 # Priority of the alternatives
30 alt_priority := 400
31
32 # Directory naming schemes
33 PKG_dirname := $(PKG_driver)-egl
34 bindir := usr/bin
35 datadir := usr/share
36 libdir := usr/lib/$(DEB_HOST_MULTIARCH)
37 includedir := usr/include
38 sysconfdir := etc
39 PKG_libdir := $(libdir)/$(PKG_dirname)
40 PKG_configdir := $(PKG_libdir)
41 ld_so_conf_dir := $(PKG_configdir)
42 ld_so_conf_file := ld.so.conf
43 alt_ld_so_conf_file := alt_ld.so.conf
44 ld_so_conf_path := $(ld_so_conf_dir)/$(ld_so_conf_file)
45 alt_ld_so_conf_path := $(ld_so_conf_dir)/$(alt_ld_so_conf_file)
46
47 # --remote doesn't work with github so this needs to be run from a local checkout
48 get-packaged-orig-source:
49 rm -rf $(PKG_source)-$(UPS_version)
50 rm -f $(PKG_source)-$(UPS_version).orig.tar.gz
51 git clone https://github.com/libhybris/libhybris.git $(PKG_source)-$(UPS_version)
52 cd $(PKG_source)-$(UPS_version) && git archive \
53 --format tar \
54 --prefix $(PKG_source)-$(UPS_version)/ \
55 $(GIT_rev) \
56 | gzip >../$(PKG_source)_$(UPS_version).orig.tar.gz
57 rm -rf $(PKG_source)-$(UPS_version)
58
59 override_dh_auto_configure:
60 ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), armhf))
61 dh_auto_configure --sourcedirectory=hybris -- --enable-wayland --enable-arch=arm --with-android-headers=/usr/include/android
62 else
63 dh_auto_configure --sourcedirectory=hybris -- --enable-wayland --enable-arch=x86 --with-android-headers=/usr/include/android
64 endif
65
66 override_dh_install:
67 # Fill in important variables
68 for i in $(PKG_driver).dirs \
69 $(PKG_driver).install \
70 $(PKG_driver).links \
71 $(PKG_driver).postinst \
72 $(PKG_driver).postrm \
73 $(PKG_driver).prerm; do \
74 sed -e "s|#LIBDIR#|$(libdir)|g" \
75 -e "s|#BINDIR#|$(bindir)|g" \
76 -e "s|#SYSCONFDIR#|$(sysconfdir)|g" \
77 -e "s|#LDSOCONF#|$(ld_so_conf_path)|g" \
78 -e "s|#ALTLDSOCONF#|$(alt_ld_so_conf_path)|g" \
79 -e "s|#ALTPRIORITY#|$(alt_priority)|g" \
80 -e "s|#DATADIR#|$(datadir)|g" \
81 -e "s|#PKGCONFIGDIR#|$(PKG_configdir)|g" \
82 -e "s|#PKGLIBDIR#|$(PKG_libdir)|g" \
83 -e "s|#DRIVERNAME#|$(PKG_driver)|g" \
84 -e "s|#DRIVERSRCNAME#|$(PKG_source)|g" \
85 -e "s|#VERSION#|$(PKG_version)|g" \
86 -e "s|#INCLUDEDIR#|$(includedir)|g" \
87 -e "s|#DEB_HOST_MULTIARCH#|$(DEB_HOST_MULTIARCH)|g" \
88 debian/$$i.in > debian/$$i; \
89 done
90
91 dh_install
92
93 # ld.so.conf
94 echo "/$(PKG_libdir)" > "$(CURDIR)/debian/$(PKG_driver)/$(ld_so_conf_path)"
95
96 # empty ld.so.conf for the fake multi-arch alternative
97 echo "" > "$(CURDIR)/debian/$(PKG_driver)/$(alt_ld_so_conf_path)"
98
99 override_dh_autoreconf:
100 NOCONFIGURE=1 dh_autoreconf ./hybris/autogen.sh
101
102 %:
103 dh $@ --with quilt,autoreconf --sourcedirectory=hybris