rules 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. #!/usr/bin/make -f
  2. # Sample debian/rules that uses debhelper.
  3. # GNU copyright 1997 to 1999 by Joey Hess.
  4. #
  5. # $Id$
  6. #
  7. # History:
  8. # --------
  9. # 2003-05-30 updated for the 0.8.11 release, changed modules list and
  10. # some ser make options (andrei)
  11. # 2003-06-27 changed to DH_COMPAT 4 (debian/compat) + other filenames
  12. # & small fixes (andrei)
  13. # 2003-08-29 replaced modules-install with modules-install-all, to
  14. # install also the modules doc (andrei)
  15. # 2004-07-23 added ext and commented out the radius modules
  16. # (the current radius modules depend on radiusclient-ng which
  17. # is not yet part of debian) (andrei)
  18. # 2005-06-23 added cpl-c, pa & re-enabled radius (with libradiusclient-ng)
  19. # (andrei)
  20. # 2007-09-11 updated for ser 2.0.0 and Debian Etch
  21. # presence modules commented out (can't be compiled due to some bug in Makefile)
  22. # added /etc/defaults/ser file installation
  23. # added ser-oob package
  24. # (pavel)
  25. # 2007-10-31 updated for cvs head (pavel)
  26. # 2009-07-08 updated for sip-router (andrei)
  27. # Uncomment this to turn on verbose mode.
  28. #export DH_VERBOSE=1
  29. # This is the debhelper compatibility version to use.
  30. # export DH_COMPAT=4
  31. # -- already set in compat
  32. # force no striping (always include debug symbols for now)
  33. export DEB_BUILD_OPTIONS:="$(DEB_BUILD_OPTIONS) nostrip"
  34. # modules not in the "main" ser package
  35. EXCLUDED_MODULES=jabber xmlrpc cpl-c
  36. # extra modules to skip, because they are not compilable now
  37. # - regardless if they go to the main ser package or to some module package,
  38. # they will be excluded from compile and install of all
  39. EXTRA_EXCLUDED_MODULES=seas bdb dbtext oracle pa rls iptrtpproxy
  40. #EXTRA_EXCLUDED_MODULES=
  41. # possible module directories that can appear in MODULES_SP
  42. # (only used for deducing a module name)
  43. MDIRS=modules modules_s modules_k
  44. # modules packaged in separate packages (complete with full modules_* path)
  45. # with the package name: ser-$(module_name)-module
  46. MODULES_SP=modules/db_mysql modules/db_postgres modules/tls modules/xmlrpc
  47. # module groups that are packaged in seperate packages
  48. # (with the name ser-$(group_name)-modules)
  49. # Note: the order is important (should be in dependency order, the one
  50. # on which other depend first)
  51. PACKAGE_GROUPS=db radius
  52. # directories with possible duplicate libraries (that should be deleted
  53. # from current module* packages)
  54. DUP_LIBS_DIRS=$(CURDIR)/debian/ser/usr/lib/ser \
  55. $(CURDIR)/debian/ser-db-modules/usr/lib/ser
  56. # modules names out of modules sp
  57. MODULES_SP_NAMES=$(filter-out $(MDIRS),$(subst /, ,$(MODULES_SP)))
  58. # "function" to get package short name out of a dir/module_name
  59. # it also transforms db_foo into foo
  60. mod_name=$(subst db_,,$(lastword $(subst /, ,$(1))))
  61. define PACKAGE_GRP_BUILD_template
  62. # package all the modules in PACKAGE_GROUPS in separate packages
  63. $(foreach grp,$(PACKAGE_GROUPS),\
  64. $(MAKE) every-module group_include="$(grp)"
  65. )
  66. endef
  67. define PACKAGE_MODULE_BUILD_template
  68. # package all the modules MODULES_SP in separate packages
  69. $(foreach mod,$(MODULES_SP),\
  70. $(MAKE) modules modules="$(mod)"
  71. )
  72. endef
  73. define PACKAGE_GRP_INSTALL_template
  74. $(foreach grp,$(PACKAGE_GROUPS),\
  75. $(MAKE) install-modules-all group_include="$(grp)" \
  76. basedir=$(CURDIR)/debian/ser-$(grp)-modules \
  77. cfg_prefix=$(CURDIR)/debian/ser-$(grp)-modules \
  78. doc-dir=share/doc/ser-$(grp)-modules
  79. # eliminate duplicate libs
  80. -for d in $(DUP_LIBS_DIRS); do \
  81. test "$$d" != "$(CURDIR)/debian/ser-$(grp)-modules/usr/lib/ser" &&\
  82. for r in $$d/lib*; do \
  83. echo "removing $(grp) lib `basename $$r` present also in $$d";\
  84. rm -f $(CURDIR)/debian/ser-$(grp)-modules/usr/lib/ser/`basename "$$r"` ; \
  85. done ; \
  86. done
  87. )
  88. endef
  89. define PACKAGE_MODULE_INSTALL_template
  90. $(foreach mod,$(MODULES_SP),
  91. $(MAKE) install-modules-all modules="$(mod)" \
  92. modules_s="" modules_k="" \
  93. basedir=$(CURDIR)/debian/ser-$(call mod_name,$(mod))-module \
  94. doc-dir=share/doc/ser-$(call mod_name,$(mod))-module
  95. # eliminate duplicate libs
  96. -for d in $(DUP_LIBS_DIRS); do \
  97. test "$$d" != "$(CURDIR)/debian/ser-$(call mod_name,$(mod))-module/usr/lib/ser" &&\
  98. for r in $$d/lib*; do \
  99. echo "removing $(call mod_name, $(mod)) lib `basename $$r` present also in $$d";\
  100. rm -f $(CURDIR)/debian/ser-$(call mod_name,$(mod))-module/usr/lib/ser/`basename "$$r"` ; \
  101. done ; \
  102. done
  103. )
  104. endef
  105. ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  106. CFLAGS += -g
  107. endif
  108. ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  109. INSTALL_PROGRAM += -s
  110. endif
  111. configure: configure-stamp
  112. configure-stamp:
  113. dh_testdir
  114. # Add here commands to configure the package.
  115. $(MAKE) cfg prefix=/usr cfg_prefix=$(CURDIR)/debian/ser \
  116. cfg_target=/etc/ser/ \
  117. basedir=$(CURDIR)/debian/ser \
  118. skip_modules="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \
  119. group_include="standard"
  120. touch configure-stamp
  121. build: build-stamp
  122. build-stamp: configure-stamp
  123. dh_testdir
  124. # Add here commands to compile the package.
  125. $(MAKE) all
  126. # make groups
  127. $(call PACKAGE_GRP_BUILD_template)
  128. # make single-module packages
  129. $(call PACKAGE_MODULE_BUILD_template)
  130. #/usr/bin/docbook-to-man debian/ser.sgml > ser.1
  131. touch build-stamp
  132. clean:
  133. dh_testdir
  134. dh_testroot
  135. rm -f build-stamp configure-stamp
  136. # Add here commands to clean up after the build process.
  137. -$(MAKE) maintainer-clean
  138. dh_clean
  139. install: build
  140. dh_testdir
  141. dh_testroot
  142. dh_clean -k
  143. dh_installdirs
  144. # Add here commands to install the package into debian/ser
  145. $(MAKE) install group_include="standard"
  146. # fix etc/ser dir location -- not needed -- andrei
  147. # mv -f $(CURDIR)/debian/ser/usr/etc $(CURDIR)/debian/ser
  148. # make group packages
  149. $(call PACKAGE_GRP_INSTALL_template)
  150. # make single module packages
  151. $(call PACKAGE_MODULE_INSTALL_template)
  152. # install /etc/default/ser file
  153. mkdir -p $(CURDIR)/debian/ser/etc/default
  154. cp -f debian/ser.default $(CURDIR)/debian/ser/etc/default/ser
  155. # install the *.sql files for ser_mysql.sh script
  156. cp -f scripts/mysql/*.sql $(CURDIR)/debian/ser-mysql-module/usr/lib/ser/
  157. # and fix path to the *.sql files in ser_mysql.sh script
  158. sed -i 's#DEFAULT_SCRIPT_DIR=.*#DEFAULT_SCRIPT_DIR="/usr/lib/ser/"#' \
  159. $(CURDIR)/debian/ser-mysql-module/usr/sbin/ser_mysql.sh
  160. # install advanced ser config file for ser-oob package
  161. mkdir -p $(CURDIR)/debian/ser-oob/etc/ser
  162. cp -f etc/sip-router-oob.cfg $(CURDIR)/debian/ser-oob/etc/ser/ser-oob.cfg
  163. #dh_movefiles
  164. # This single target is used to build all the packages, all at once, or
  165. # one at a time. So keep in mind: any options passed to commands here will
  166. # affect _all_ packages. Anything you want to only affect one package
  167. # should be put in another target, such as the install target.
  168. binary-common:
  169. dh_testdir
  170. dh_testroot
  171. dh_installdebconf
  172. dh_installdocs
  173. dh_installexamples
  174. dh_installmenu
  175. # dh_installlogrotate
  176. # dh_installemacsen
  177. # dh_installpam
  178. # dh_installmime
  179. dh_installinit -- defaults 23
  180. dh_installcron
  181. dh_installman
  182. dh_installinfo
  183. # dh_undocumented
  184. dh_installchangelogs
  185. dh_link
  186. dh_strip
  187. dh_compress
  188. dh_fixperms
  189. dh_makeshlibs
  190. dh_installdeb
  191. # dh_perl
  192. dh_shlibdeps
  193. dh_gencontrol
  194. dh_md5sums
  195. dh_builddeb
  196. # Build architecture-independent packages using the common target
  197. binary-indep: build install
  198. # (Uncomment this next line if you have such packages.)
  199. # $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
  200. # We have nothing to do by default.
  201. # Build architecture-dependent packages using the common target
  202. binary-arch: build install
  203. $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
  204. # Any other binary targets build just one binary package at a time.
  205. binary-%: build install
  206. $(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$*
  207. binary: binary-indep binary-arch
  208. .PHONY: build clean binary-indep binary-arch binary install configure