4f334dc6970e056e3d1d7d6faba2629480ecb1b0
[framework/web/wrt-plugins-common.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # This file was originally written by Joey Hess and Craig Small.
5 # As a special exception, when this file is copied by dh-make into a
6 # dh-make output file, you may use that output file without restriction.
7 # This special exception was added by Craig Small in version 0.37 of dh-make.
8
9 # Uncomment this to turn on verbose mode.
10 #export DH_VERBOSE=1
11
12
13 # These are used for cross-compiling and for saving the configure script
14 # from having to guess our platform (since we know it already)
15 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
16 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
17 PACKAGE_VERSION ?= $(shell sed -n "1 p" debian/changelog | sed 's/.*(\(.*\)).*/\1/')
18 PACKAGE_API_VERSION ?= $(shell sed -n "1 p" debian/changelog | sed 's/.*([0-9]*.\([0-9]*\).*).*/\1/')
19 PROJECT_NAME ?= wrt-plugins-common
20
21 CFLAGS ?= -Wall -g -fvisibility=default -fPIC
22 CXXFLAGS ?=  -Wall -g -fPIC
23 PREFIX ?= /usr
24
25 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
26         CFLAGS += -O0
27         CXXFLAGS += -O0
28 else
29         CFLAGS += -O2
30         CXXFLAGS += -O2
31 endif
32
33 ifeq (,$(findstring no,$(DPL_LOG)))
34         DPL_LOGS_STATUS = "ON"
35 else
36         DPL_LOGS_STATUS = "OFF"
37 endif
38
39 LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--hash-style=both -Wl,--version-script=$(CURDIR)/wrt-plugins-common.map
40
41 ifdef DEVPKG
42         CMAKEFLAGS += -DDEVPKG="$(DEVPKG)"
43 endif
44
45
46 CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build
47
48 #configure: configure-stamp
49 configure-stamp:
50                 dh_testdir
51                 # Add here commands to configure the package.
52                         mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \
53                 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
54                         cmake ${SRCDIR}  \
55                                   ${CMAKEFLAGS}\
56                                                         -DBUILD_TYPE="${TARGET}" \
57                                                         -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
58                                                         -DCMAKE_BUILD_TYPE="$(BUILD_TYPE)" \
59                                                         -DCMAKE_PACKAGE_VERSION="$(PACKAGE_API_VERSION)" \
60                                                         -DCMAKE_PROJECT_NAME="$(PROJECT_NAME)" \
61                                                         -DDPL_LOG=$(DPL_LOGS_STATUS) ..
62
63 build: build-stamp
64
65 build-stamp:  configure-stamp
66         dh_testdir
67
68         # Add here commands to compile the package.
69         cd $(CMAKE_BUILD_DIR) && $(MAKE) -j5
70
71         #docbook-to-man debian/ncurses.sgml > ncurses.1
72
73         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
74                 cat $$f > $${f%.in}; \
75                 sed -i -e "s#@PREFIX@#$(PREFIX)/lib#g" $${f%.in}; \
76                 sed -i -e "s#@PREFIX_INCLUDE@#$(PREFIX)/include#g" $${f%.in}; \
77         done
78
79         for f in `find $(CURDIR)/pkgconfigs/ -name "*.in"`; do \
80                 cat $$f > $${f%.in}; \
81                 sed -i -e "s#@VERSION@#$(PACKAGE_VERSION)#g" $${f%.in}; \
82                 sed -i -e "s#@PROJECT_NAME@#$(PROJECT_NAME)#g" $${f%.in}; \
83         done
84
85
86         touch $@
87
88 clean:
89         dh_testdir
90         dh_testroot
91         rm -f build-stamp configure-stamp
92         rm -rf $(CMAKE_BUILD_DIR)
93 #       -$(MAKE) distclean
94         ./clean.sh
95
96 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
97         cp -f /usr/share/misc/config.sub config.sub
98 endif
99 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
100         cp -f /usr/share/misc/config.guess config.guess
101 endif
102
103         for f in `find $(CURDIR)/ -name "*.pc"`; do \
104                 rm -f $${f%.pc}; \
105         done
106
107         dh_clean
108
109 install: build
110         dh_testdir
111         dh_testroot
112         dh_clean -k
113         dh_installdirs
114
115         # Add here commands to install the package into debian/ncurses.
116         cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
117
118 # Build architecture-independent files here.
119 binary-indep: build install
120 # We have nothing to do by default.
121
122 # Build architecture-dependent files here.
123 binary-arch: build install
124         dh_testdir
125         dh_testroot
126         dh_installchangelogs
127         dh_installdocs
128         dh_installexamples
129         dh_install --sourcedir=debian/tmp
130 #       dh_installmenu
131 #       dh_installdebconf
132 #       dh_installlogrotate
133 #       dh_installemacsen
134 #       dh_installpam
135 #       dh_installmime
136 #       dh_python
137 #       dh_installinit
138 #       dh_installcron
139 #       dh_installinfo
140         dh_installman
141         dh_link
142         dh_strip --dbg-package=wrt-plugins-common-dbg
143         dh_compress
144         dh_fixperms
145 #       dh_perl
146         dh_makeshlibs
147         dh_installdeb
148         dh_shlibdeps
149         dh_gencontrol
150         dh_md5sums
151         dh_builddeb
152
153 binary: binary-indep binary-arch
154 .PHONY: build clean binary-indep binary-arch binary install