File: rules

package info (click to toggle)
libedit 2.9.cvs.20040827-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 712 kB
  • ctags: 1,791
  • sloc: ansic: 13,101; sh: 355; makefile: 199
file content (151 lines) | stat: -rwxr-xr-x 4,574 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
145
146
147
148
149
150
151
#! /usr/bin/make -f
## debian/rules for libedit, mostly a pmake workaround..
## hacked together by Gergely Nagy <algernon@debian.org>
## $MadHouse: Debian/libedit/debian/rules,v 1.3 2001/11/04 01:57:26 algernon Exp $

# This is the debhelper compatability version to use.
export DH_COMPAT = 2
PACKAGE		 = libedit
PKGDIR		 = ${CURDIR}/debian/tmp
VERSION		 = 20040827
PMAKE_ARGS	 = MKPROFILE=no MKCATPAGES=no MLINKS= MANPAGES= \
		 SHLIB_SHFLAGS="-Wl,-soname,libedit.so.${major}" LDADD="*.so -lcurses"
EDITLINE_3_LINKS = el_init el_end el_reset el_gets el_getc el_push \
		 el_parse el_set el_get el_source el_resize el_line \
		 el_insertstr el_deletestr history_init history_end history

version		 = 2.9
major		 = 2
## For automatic update from CVS
CVSROOT		 = :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
DATE		 = $(shell date +%Y%m%d)
ROOT		 = basesrc
MISC_STUFF	 = lib/libc/include/namespace.h lib/libc/string/strlcat.c \
		 lib/libc/string/strlcpy.c lib/libc/gen/vis.c \
		 lib/libc/gen/unvis.c include/vis.h

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

# Workaround for pmake fussiness
ifeq (mips-linux,$(DEB_HOST_GNU_TYPE))
  PMAKE_ARGS += MACHINE_ARCH=mipseb
endif

build: patch build-stamp
build-stamp:
	dh_testdir
	cd libedit-${VERSION} && pmake ${PMAKE_ARGS}
	touch build-stamp

clean: clean1 unpatch
	rm -rf debian/patched build-stamp
clean1:
	dh_testdir
	dh_testroot
	dh_clean
	-cd libedit-${VERSION} && pmake distclean

install: build
	dh_testdir
	dh_testroot
	dh_clean
	install -d ${PKGDIR}/usr/lib
	install -d ${PKGDIR}/usr/include/readline
	install -d ${PKGDIR}/usr/share/man/man3
	install -d ${PKGDIR}/usr/share/man/man5
	cd libedit-${VERSION} && \
	 pmake install incinstall DESTDIR=${PKGDIR} ${PMAKE_ARGS}
## pmake workaround
	cd libedit-${VERSION}/readline && \
	 pmake incinstall DESTDIR=${PKGDIR} ${PMAKE_ARGS}
	mv ${PKGDIR}/usr/include/readline ${PKGDIR}/usr/include/editline
	ln -sf libedit.so.${version} ${PKGDIR}/usr/lib/libedit.so.${major}
	ln -sf libedit.so.${major} ${PKGDIR}/usr/lib/libedit.so

binary-indep: build install
binary-arch: build install
	dh_testdir
	dh_testroot
## Install manpages
	install -m 0644 libedit-${VERSION}/editline.3 ${PKGDIR}/usr/share/man/man3/editline.3el
	install -m 0644 libedit-${VERSION}/editrc.5 ${PKGDIR}/usr/share/man/man5/editrc.5el
## End
	dh_movefiles
	@list="${EDITLINE_3_LINKS}"; for l in $$list; do \
		echo "ln -sf editline.3el ${CURDIR}/debian/libedit-dev/usr/share/man/man3/$$l.3el"; \
		ln -sf editline.3el ${CURDIR}/debian/libedit-dev/usr/share/man/man3/$$l.3el; \
	done
	dh_installdocs
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

patch: ${CURDIR}/patch-stamp
${CURDIR}/patch-stamp:
	test -d debian/patched || install -d debian/patched
	echo "Patches applied in the Debian version of ${PACKAGE}:" > $@T
	@cd libedit-${VERSION} && \
	for patch in `cat ../debian/patches/00list`; do \
		stamp=../debian/patched/$$patch.dpatch; \
		patch=../debian/patches/$$patch.dpatch; \
		test -x $$patch || chmod +x $$patch; \
		if test -f $$stamp; then \
			echo "$$patch already applied."; \
			echo -e "\n$$patch:" >> $@T; \
			sed -n 's/^## *DP: */  /p' $$patch >> $@T; \
		else \
			echo -n "applying patch $$patch..."; \
			if $$patch -patch >$$stamp.new 2>&1; then \
				mv $$stamp.new $$stamp; \
				touch $$stamp; \
				echo -e "\n$$patch:" >> $@T; \
				sed -n 's/^## *DP: */  /p' $$patch >> $@T; \
				echo " ok."; \
			else \
				echo " failed."; \
				exit 1; \
			fi; \
		fi; \
	done
	mv -f $@T $@

unpatch:
	@cd libedit-${VERSION} && \
	for patch in `sort -r ../debian/patches/00list`; do \
		stamp=../debian/patched/$$patch.dpatch; \
		patch=../debian/patches/$$patch.dpatch; \
		test -x $$patch || chmod +x $$patch; \
		if test -f $$stamp; then \
			echo -n "reverting patch $$patch..."; \
			if $$patch -unpatch 2>&1 >/dev/null; then \
				rm -f $$stamp; \
				echo " ok."; \
			else \
				echo " failed."; \
				exit 1; \
			fi; \
		fi; \
	done
	rm -f patch-stamp

binary: binary-indep binary-arch

cvs-update:
	install -d glibc-compat/tmp
	cd glibc-compat/tmp && \
	 cvs -d ${CVSROOT} export -D now $(patsubst %,${ROOT}/%,${MISC_STUFF})
	find glibc-compat/tmp -type f -exec mv {} glibc-compat/ \;
	rm -rf glibc-compat/tmp
	cvs -d ${CVSROOT} export -D now -d libedit-${DATE} ${ROOT}/lib/libedit

.PHONY: build clean binary-indep binary-arch binary install \
	patch unpatch clean1 cvs-update