summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 9b38739b77e13b5481c4c88b6704688307c61fd7 (plain)
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
#!/usr/bin/make -f

export DH_VERBOSE=1

package = attr
develop = lib$(package)1-dev
library = lib$(package)1

dirme  = debian/$(package)
dirdev = debian/$(develop)
dirlib = debian/$(library)
pkgme  = DIST_ROOT=`pwd`/$(dirme);  export DIST_ROOT;
pkgdev = DIST_ROOT=`pwd`/$(dirdev); export DIST_ROOT;
pkglib = DIST_ROOT=`pwd`/$(dirlib); export DIST_ROOT;
stdenv = @GZIP=-q; export GZIP;

options = export DEBUG=-DNDEBUG DISTRIBUTION=debian \
	  INSTALL_USER=root INSTALL_GROUP=root \
	  CONFIG_SHELL=/bin/bash ;
checkdir = test -f debian/rules

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

ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
        LOCAL_CONFIGURE_OPTIONS += --host $(DEB_HOST_GNU_TYPE) --build $(DEB_BUILD_GNU_TYPE)
endif

LOCAL_CONFIGURE_OPTIONS += \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH)

build-arch: build
build-indep: build
build: built
built: config
	@echo "== dpkg-buildpackage: build" 1>&2
	$(MAKE) default
	rm -f po/attr.pot
	$(MAKE) -C po attr.pot
	touch built

config: .census
.census:
	@echo "== dpkg-buildpackage: configure" 1>&2
	$(checkdir)
	$(options) $(MAKE) configure LOCAL_CONFIGURE_OPTIONS="$(LOCAL_CONFIGURE_OPTIONS)"
	touch .census

clean:
	@echo "== dpkg-buildpackage: clean" 1>&2
	$(checkdir)
	-rm -f built .census
	$(MAKE) distclean
	-rm -rf $(dirme) $(dirdev) $(dirlib) debian/tmp
	-rm -f debian/*substvars debian/files* debian/*.debhelper
	-rm -rf debian/*.debhelper.log
	-rm -rf configure.lineno

binary-indep:

binary-arch: checkroot built
	@echo "== dpkg-buildpackage: binary-arch" 1>&2
	$(checkdir)
	-rm -rf $(dirme) $(dirdev) $(dirlib)
	$(pkgme)  $(MAKE) -C . install
	$(pkgdev) $(MAKE) -C . install-dev
	$(pkglib) $(MAKE) -C . install-lib
	$(pkgme)  $(MAKE) -C build src-manifest

	rm -f $(dirdev)/usr/lib/$(DEB_HOST_MULTIARCH)/libattr.la
	rm -f $(dirdev)/lib/$(DEB_HOST_MULTIARCH)/libattr.la

	-rm -rf $(dirdev)/usr/share/doc/attr
	-rm -rf $(dirlib)/usr/share/doc/attr
	-rm -rf $(dirlib)/usr/share/locale
	-rm -rf $(dirlib)/usr/share/man
	-rm -rf $(dirlib)/usr/bin

	dh_installdocs
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs -N $(library)
	dh_makeshlibs -p $(library) -V 'libattr1 (>= 1:2.4.46-5)'
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol

	dh_md5sums
	dh_builddeb -p$(package) -- -Zbzip2 -z9
	dh_builddeb -p$(develop) -- -Zbzip2 -z9
	dh_builddeb -p$(library)

binary: binary-indep binary-arch

checkroot:
	test 0 -eq `id -u`

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