File: rules

package info (click to toggle)
dsc 1.0-5
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,212 kB
  • ctags: 587
  • sloc: lisp: 3,006; sh: 1,373; ansic: 862; cpp: 835; makefile: 229
file content (144 lines) | stat: -rwxr-xr-x 3,738 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/usr/bin/make -f
# rules file for dsc

package		:= dsc
pkg-dsc		:= $(package)

# directory abstraction
prefix-dsc	:= debian/tmp
bindir-dsc	:= $(prefix-dsc)/usr/bin
docdir-dsc	:= $(prefix-dsc)/usr/doc/$(package)
mandir-dsc	:= $(prefix-dsc)/usr/man/man1
schemedir	:= $(prefix-dsc)/usr/lib/elk/scm

# build abstraction
install_file	:= install -o root -g root -m 644 -p
install_script	:= install -o root -g root -m 755 -p
install_program	:= install -o root -g root -m 755 -p
make_directory	:= install -d -o root -g root -m 755
compress	:= gzip -9f

# source depends -- check if these packages are installed
SRC_DEPENDS	:= libsp1-dev

.PHONY: source-depends
source-depends:
	@set -e								;\
	for dep in $(SRC_DEPENDS); do					\
	    echo "checking if package \`$$dep' is installed..."		;\
	    dpkg --get-selections | grep "$$dep\W\+install" ||	\
		exit 1							;\
	done
	@echo "all source-depends seem to be installed, good"

build:
	$(checkdir)
	debian/rules source-depends
	set -e								;\
	if [ ! -f /usr/lib/elk/ldflags ]				;\
	then								\
		echo "elk 3.0-5 or newer required to build dsc"		;\
		exit 1							;\
	fi
	SPLIBDIR=/usr/lib ./configure					\
		--enable-http --with-sp=sp --with-elk=elk		\
		--enable-grove --prefix=/usr
	@echo
	@echo "** building"
	make
	if test -d sp-1.1.1/grove; then					\
		echo							;\
		echo "ERROR: dsc built from its own version of sp"	;\
		exit 1							;\
	fi
	touch build


clean:
	$(checkdir)
	rm -f build
	-make distclean
	rm -f config.log config.cache config.status
	rm -f .elk-3.0-built .sp-1.1.1-built
	rm -rf sp-1.1.1/lib/
	rm -f debian/substvars
	rm -rf $(prefix-dsc)
	find . -name '*.rej' -o -name '*.orig' -o -name '*~' | xargs rm -f


binary-indep:	build
# no binary-indep portion


binary-arch:	build
	$(checkdir)
	$(checkroot)
	rm -rf $(prefix-dsc)
	$(make_directory) $(prefix-dsc) $(bindir-dsc) $(docdir-dsc)	\
		$(mandir-dsc) $(schemedir)

#	 lets create our debian-std copyright file; I like to ensure
#	 I have a verbatim copy of the upstream copyright with 'cat'
	$(install_file) /dev/null $(docdir-dsc)/copyright
	echo -e "DSC COPYRIGHT\n-------------"	>> $(docdir-dsc)/copyright
	cat COPYRIGHT				>> $(docdir-dsc)/copyright
	cat debian/copyright.Debian		>> $(docdir-dsc)/copyright

	make install prefix=`pwd`/$(prefix-dsc)/usr		 	\
		INSTALL="$(install_program)"
#	 upstream doesn't properly install scheme files ...
	$(install_file) scm/* $(schemedir)/
	rm -f $(schemedir)/toplevel.scm

#	 install undocumented links
	ln -s ../man7/undocumented.7.gz $(mandir-dsc)/dsc.1.gz

#	 docs
	$(install_file) README $(docdir-dsc)/
	$(install_file) debian/changelog $(docdir-dsc)/changelog.Debian
	$(make_directory) $(docdir-dsc)/examples
	$(install_file) data/* $(docdir-dsc)/examples/

#	 install control files
	$(make_directory) $(prefix-dsc)/DEBIAN
	@# none...

#	 use debhelper to perform maximum strippage
	dh_strip -v

#	 compress docs (policy)	
	find $(mandir-dsc) -type f | xargs $(compress)
	find $(docdir-dsc) 						\
	    -type f \( -size +4k -or -name "changelog*" \)		\
            ! -name "*.htm" ! -name "*.html" ! -name "*.gif"		\
            ! -name "copyright" | xargs $(compress)

#	 check for bad links
	if [ `symlinks -r debian/ | grep dangling |			\
	      grep -v '\(undocumented\|libsp.so\)' | wc -l` -gt 0 ];	\
	then								\
		echo "bad link detected, aborting"			;\
		exit 1							;\
	fi

#	 put it together
	LD_PRELOAD=  dpkg-shlibdeps $(bindir-dsc)/*
	dpkg-gencontrol -isp -P$(prefix-dsc)
	dpkg --build $(prefix-dsc) ..


define checkdir
	test -f debian/rules
	test -f scm/dsssl.scm
endef

define checkroot
	test `id -u` = 0
endef

binary:	binary-indep binary-arch
.PHONY: binary binary-arch binary-indep clean

#Local variables:
#mode: makefile
#End: