view debian/rules @ 524:3c3cef8a32e6 maemo

- Make it do the postinst files etc for dropbear-server - Improve the NO_START message
author Matt Johnston <matt@ucc.asn.au>
date Tue, 18 Nov 2008 23:15:24 +0000
parents 4ff1bf0345c9
children 9f5e2616c064
line wrap: on
line source

#!/usr/bin/make -f

#export DH_OPTIONS
DEB_HOST_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

STRIP =strip
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  STRIP =: nostrip
endif

CFLAGS =-Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  CFLAGS +=-O0
else
  CFLAGS +=-Os
endif

CONFFLAGS =
CC =gcc
ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS)))
  CONFFLAGS =--disable-zlib
  CC =diet -v -Os gcc -nostdinc
endif

patch: deb-checkdir patch-stamp
patch-stamp:
	for i in `ls -1 debian/diff/*.diff || :`; do \
	  patch -p1 <$$i || exit 1; \
	done
	touch patch-stamp

config.status: patch-stamp configure
	CC='$(CC)' \
	CFLAGS='$(CFLAGS)'' -DSFTPSERVER_PATH="\"/usr/lib/sftp-server\""' \
	  ./configure --host='$(DEB_HOST_GNU_TYPE)' \
	    --build='$(DEB_BUILD_GNU_TYPE)' --prefix=/usr \
	    --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
	    $(CONFFLAGS)

build: deb-checkdir build-stamp
build-stamp: config.status
	$(MAKE) CC='$(CC)' LD='$(CC)'
	touch build-stamp

clean: DIR=$(shell pwd)/debian/dropbear
clean: deb-checkdir deb-checkuid 
	test ! -r Makefile || $(MAKE) distclean
	rm -f libtomcrypt/Makefile libtommath/Makefile
	test ! -e patch-stamp || \
	  for i in `ls -1r debian/diff/*.diff || :`; do \
	    patch -p1 -R <$$i; \
	  done
	rm -f patch-stamp build-stamp config.log config.status
	rm -rf '$(DIR)'
	rm -rf '$(DIR)'-client
	rm -rf '$(DIR)'-server
	rm -rf '$(DIR)'-common
	rm -rf '$(DIR)'-scp
	rm -f debian/files debian/substvars debian/copyright changelog

install-server: DIR=$(shell pwd)/debian/dropbear-server
install-server: deb-checkdir deb-checkuid config.status 
	rm -f '$(DIR)'
	$(MAKE) clean
	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS=dropbear dropbear
	install -d -m0755 '$(DIR)'/etc/dropbear
	# programs
	install -d -m0755 '$(DIR)'/usr/sbin
	install -m0755 dropbear '$(DIR)'/usr/sbin/dropbear
	# init and run scripts
	install -d -m0755 '$(DIR)'/etc/init.d
	install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear
	install -m0755 debian/service/run '$(DIR)'/etc/dropbear/run
	install -d -m0755 '$(DIR)'/etc/dropbear/log
	install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run
	ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main
	install -d -m0755 '$(DIR)'/usr/share/man/man8
	for i in dropbear.8 ; do \
	  install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
	done
	gzip -9 '$(DIR)'/usr/share/man/man8/*.8
	# copyright, changelog
	cat debian/copyright.in LICENSE > debian/copyright
	test -r changelog || ln -s CHANGES changelog
	$(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/*

	install -d -m0755 '$(DIR)'/DEBIAN
	test '$(CC)' != 'gcc' || \
	  dpkg-shlibdeps '$(DIR)'/usr/sbin/*

install-client: DIR=$(shell pwd)/debian/dropbear-client
install-client: deb-checkdir deb-checkuid config.status 
	rm -f '$(DIR)'
	$(MAKE) clean
	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS=dbclient dbclient
	install -d -m0755 '$(DIR)'/usr/bin
	install -m0755 dbclient '$(DIR)'/usr/bin/dbclient
	install -d -m0755 '$(DIR)'/usr/share/man/man1
	install -m644 dbclient.1 '$(DIR)'/usr/share/man/man1/
	gzip -9 '$(DIR)'/usr/share/man/man1/*.1
	$(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/* 

	install -d -m0755 '$(DIR)'/DEBIAN
	test '$(CC)' != 'gcc' || \
	  dpkg-shlibdeps  '$(DIR)'/usr/bin/*

install-common: DIR=$(shell pwd)/debian/dropbear-common
install-common: deb-checkdir deb-checkuid config.status 
	rm -f '$(DIR)'
	$(MAKE) clean
	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="dropbearkey dropbearconvert" MULTI=1
	install -d -m0755 '$(DIR)'/usr/bin
	install -d -m0755 '$(DIR)'/usr/lib/dropbear
	install -m0755 dropbearmulti \
	  '$(DIR)'/usr/lib/dropbear/dropbearmulti
	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dropbearkey
	ln -s dropbearmulti '$(DIR)'/usr/lib/dropbear/dropbearconvert
	install -d -m0755 '$(DIR)'/usr/share/man/man8
	for i in dropbearkey.8; do \
	  install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
	done
	gzip -9 '$(DIR)'/usr/share/man/man8/*.8
	$(STRIP) -R .comment -R .note \
	  '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/*

	install -d -m0755 '$(DIR)'/DEBIAN
	test '$(CC)' != 'gcc' || \
	  dpkg-shlibdeps '$(DIR)'/usr/bin/*  '$(DIR)'/usr/lib/dropbear/*

install-scp: DIR=$(shell pwd)/debian/dropbear-scp
install-scp: deb-checkdir deb-checkuid config.status 
	rm -f '$(DIR)'
	$(MAKE) clean
	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="scp" scp 
	install -d -m0755 '$(DIR)'/usr/bin
	install -m0755 scp '$(DIR)'/usr/bin/scp
	$(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/*

	install -d -m0755 '$(DIR)'/DEBIAN
	test '$(CC)' != 'gcc' || \
	  dpkg-shlibdeps '$(DIR)'/usr/bin/* 

install-multi: DIR=$(shell pwd)/debian/dropbear
install-multi: deb-checkdir deb-checkuid config.status 
	rm -f '$(DIR)'
	$(MAKE) clean
	$(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="dropbearkey dropbearconvert scp dropbear dbclient" MULTI=1
	install -d -m0755 '$(DIR)'/etc/dropbear
	# programs
	install -d -m0755 '$(DIR)'/usr/bin
	install -d -m0755 '$(DIR)'/usr/sbin
	install -d -m0755 '$(DIR)'/usr/lib/dropbear
	install -m0755 dropbearmulti \
	  '$(DIR)'/usr/lib/dropbear/dropbearmulti
	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dropbearkey
	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dbclient
	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/scp
	ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/sbin/dropbear
	ln -s dropbearmulti '$(DIR)'/usr/lib/dropbear/dropbearconvert
	# init and run scripts
	install -d -m0755 '$(DIR)'/etc/init.d
	install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear
	install -m0755 debian/service/run '$(DIR)'/etc/dropbear/run
	install -d -m0755 '$(DIR)'/etc/dropbear/log
	install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run
	ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main
	install -d -m0755 '$(DIR)'/usr/share/man/man8
	for i in dropbear.8 dropbearkey.8; do \
	  install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
	done
	gzip -9 '$(DIR)'/usr/share/man/man8/*.8
	install -d -m0755 '$(DIR)'/usr/share/man/man1
	install -m644 dbclient.1 '$(DIR)'/usr/share/man/man1/
	gzip -9 '$(DIR)'/usr/share/man/man1/*.1
	$(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/* \
	  '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/*

	install -d -m0755 '$(DIR)'/DEBIAN
	test '$(CC)' != 'gcc' || \
	  dpkg-shlibdeps '$(DIR)'/usr/sbin/* '$(DIR)'/usr/bin/* \
	    '$(DIR)'/usr/lib/dropbear/*

install: install-client install-server install-common install-multi install-scp
binary-indep:

binary-arch: install dropbear.deb dropbear-server.deb dropbear-common.deb dropbear-scp.deb dropbear-client.deb
	dpkg-gencontrol -isp -pdropbear -P'$(shell pwd)/debian'/dropbear
	dpkg-gencontrol -isp -pdropbear-server -P'$(shell pwd)/debian'/dropbear-server
	dpkg-gencontrol -isp -pdropbear-client -P'$(shell pwd)/debian'/dropbear-client
	dpkg-gencontrol -isp -pdropbear-common -P'$(shell pwd)/debian'/dropbear-common
	dpkg-gencontrol -isp -pdropbear-scp -P'$(shell pwd)/debian'/dropbear-scp
	dpkg -b '$(shell pwd)/debian'/dropbear ..
	dpkg -b '$(shell pwd)/debian'/dropbear-server ..
	dpkg -b '$(shell pwd)/debian'/dropbear-common ..
	dpkg -b '$(shell pwd)/debian'/dropbear-scp ..
	dpkg -b '$(shell pwd)/debian'/dropbear-client ..

binary: binary-arch binary-indep

.PHONY: patch build clean install binary-indep binary-arch binary

include debian/implicit