Home | History | Annotate | Line # | Download | only in debian
rules revision 1.1
      1 #!/usr/bin/make -f
      2 # Made with the aid of dh_make, by Craig Small
      3 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
      4 # Some lines taken from debmake, by Cristoph Lameter.
      5 
      6 # Uncomment this to turn on verbose mode.
      7 #export DH_VERBOSE=1
      8 
      9 # These are used for cross-compiling and for saving the configure script
     10 # from having to guess our platform (since we know it already)
     11 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
     12 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
     13 
     14 DESKTOP_VENDOR  = dickey
     15 
     16 PKG_SUFFIX	= -dev
     17 
     18 PACKAGE		:= $(shell dpkg-parsechangelog| \
     19 			sed -n 's/^Source: \(.*\)$$/\1/p')
     20 
     21 PKG_APPDEFAULTS	:= /etc/X11/app-defaults
     22 PKG_DESKTOP	:= /usr/share/applications
     23 
     24 DSTDIR		:= $(CURDIR)/debian/$(PACKAGE)
     25 MY_DESKTOP	:= $(DSTDIR)/usr/share/applications
     26 
     27 CFLAGS =
     28 
     29 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
     30 DEBOP=--enable-debug
     31 else
     32 DEBOP=
     33 endif
     34 
     35 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
     36         CFLAGS += -O0
     37 else
     38         CFLAGS += -O2
     39 endif
     40 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
     41         INSTALL_PROGRAM += -s
     42 endif
     43 
     44 configure: configure-stamp
     45 configure-stamp:
     46 	dh_testdir
     47 
     48 	./configure \
     49 		--host=$(DEB_HOST_GNU_TYPE) \
     50 		--build=$(DEB_BUILD_GNU_TYPE) \
     51 		--program-suffix=$(PKG_SUFFIX) \
     52 		--prefix=/usr \
     53 		--libexecdir=\$${prefix}/lib \
     54 		--mandir=\$${prefix}/share/man \
     55 		--sysconfdir=/etc/$(PACKAGE) \
     56 		--localstatedir=/var \
     57 		--libdir=/etc/$(PACKAGE) \
     58 		--without-xterm-symlink \
     59 		--enable-256-color \
     60 		--enable-88-color \
     61 		--enable-dabbrev \
     62 		--enable-dec-locator \
     63 		--enable-exec-xterm \
     64 		--enable-hp-fkeys \
     65 		--enable-load-vt-fonts \
     66 		--enable-logfile-exec \
     67 		--enable-logging \
     68 		--enable-mini-luit \
     69 		--enable-paste64 \
     70 		--enable-rectangles \
     71 		--enable-sco-fkeys \
     72 		--enable-tcap-fkeys \
     73 		--enable-tcap-query \
     74 		--enable-toolbar \
     75 		--enable-wide-chars \
     76 		--enable-xmc-glitch \
     77 		--with-app-defaults=$(PKG_APPDEFAULTS) \
     78 		--with-icondir=\$${prefix}/share/pixmaps \
     79 		--with-own-terminfo=\$${prefix}/share/terminfo \
     80 		--with-terminal-type=xterm-new \
     81 		--with-utempter \
     82 		${DEBOP}
     83 
     84 	touch configure-stamp
     85 
     86 build: build-stamp
     87 build-stamp: configure-stamp
     88 	dh_testdir
     89 
     90 	$(MAKE)
     91 
     92 	touch build-stamp
     93 
     94 clean:
     95 	dh_testdir
     96 	dh_testroot
     97 
     98 	[ ! -f Makefile ] || $(MAKE) distclean
     99 
    100 	dh_clean
    101 
    102 install: install-stamp
    103 install-stamp: build-stamp
    104 	dh_testdir
    105 	dh_testroot
    106 	dh_clean -k
    107 	dh_installdirs
    108 
    109 	$(MAKE) install \
    110 		DESTDIR=$(CURDIR)/debian/$(PACKAGE)
    111 
    112 	touch install-stamp
    113 
    114 install: install-indep install-arch
    115 install-indep:
    116 
    117 install-arch:
    118 	dh_testdir
    119 	dh_testroot
    120 	dh_prep -s 
    121 	dh_installdirs -s
    122 
    123 	$(MAKE) install-bin \
    124 		DESTDIR=$(DSTDIR)
    125 
    126 # Build architecture-independent files here.
    127 binary-indep: build install
    128 	dh_testdir
    129 	dh_testroot
    130 
    131 	# This overwrites the Debian package's copy of app-defaults and icons.
    132 	# But the resources are not the same; they are patched.
    133 	sed -i -f package/debian/color.sed XTerm-col.ad
    134 	sed -i -f package/debian/xterm-xres.sed XTerm.ad
    135 
    136 	$(MAKE) install-app \
    137 		install-icon \
    138 		install-man \
    139 		DESTDIR=$(DSTDIR)
    140 
    141 	# Follow-up with a check against the installed resource files.
    142 	( cd $(DSTDIR)$(PKG_APPDEFAULTS) && $(SHELL) -c 'for p in *;do diff -u $$p $(PKG_APPDEFAULTS)/; done' ; exit 0 )
    143 
    144 	# The Debian package does not install desktop files.
    145 	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486317
    146 	$(SHELL) -c 'for p in *.desktop;do \
    147 		sed -i \
    148 			-e "s/Categories=System;/Categories=Application;Utility;/" \
    149 			-e "s/^\\(Name=.*\\)/\\1$(PKG_SUFFIX)/" \
    150 			-e "s/^\\(Exec=.*\\)/\\1$(PKG_SUFFIX)/" \
    151 		$$p; done'
    152 
    153 	$(MAKE) install-desktop \
    154 		DESKTOP_FLAGS="--vendor='$(DESKTOP_VENDOR)' --dir $(MY_DESKTOP)"
    155 
    156 	( cd $(DSTDIR)$(PKG_DESKTOP) \
    157 	  && $(SHELL) -c 'for p in *;do \
    158 	  	test -n "$(PKG_SUFFIX)" && mv $$p `basename $$p .desktop`$(PKG_SUFFIX).desktop; \
    159 	  	diff -u $$p $(PKG_DESKTOP)/; \
    160 		done' ; \
    161 	  exit 0 )
    162 
    163 # Build architecture-dependent files here.
    164 binary-arch: build install
    165 	dh_testdir
    166 	dh_testroot
    167 	dh_installdebconf
    168 	dh_installdocs
    169 	dh_installmenu
    170 	dh_installmime
    171 	dh_installexamples tektests vttests
    172 	dh_installchangelogs
    173 	dh_install
    174 	dh_link
    175 	dh_strip
    176 	dh_compress
    177 	dh_fixperms
    178 	dh_installdeb
    179 	dh_shlibdeps
    180 	dh_gencontrol
    181 	dh_md5sums
    182 	dh_builddeb
    183 
    184 binary: binary-indep binary-arch
    185 .PHONY: build clean binary-indep binary-arch binary install install-stamp
    186