]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/make -f | |
2 | # Sample debian/rules that uses debhelper. | |
3 | # GNU copyright 1997 to 1999 by Joey Hess. | |
4 | ||
5 | # Uncomment this to turn on verbose mode. | |
6 | #export DH_VERBOSE=1 | |
7 | ||
8 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all | |
9 | DPKG_EXPORT_BUILDFLAGS = 1 | |
10 | include /usr/share/dpkg/buildflags.mk | |
11 | ||
12 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) | |
13 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) | |
14 | ||
15 | ifeq ($(DEB_HOST_ARCH_OS),linux) | |
16 | CONFIGURE_ARGS += --with-selinux | |
17 | endif | |
18 | ||
19 | ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) | |
20 | CFLAGS += -I/usr/include/freebsd | |
21 | endif | |
22 | ||
23 | CFLAGS += -fsigned-char -Wall | |
24 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | |
25 | CFLAGS += -O0 | |
26 | else | |
27 | CFLAGS += -O2 | |
28 | endif | |
29 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) | |
30 | INSTALL_PROGRAM = install -s | |
31 | else | |
32 | INSTALL_PROGRAM = install | |
33 | endif | |
34 | ||
35 | PACKAGE = smartmontools | |
36 | SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p'| cut -d':' -f2) | |
37 | SVN_REVISION := $(shell echo $(SRC_VERSION) | awk -F"+" '{ print $$2 }' | sed 's/svn//' ) | |
38 | TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.xz | |
39 | SVN_ROOT := 'https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools' | |
40 | ||
41 | get-orig-source: | |
42 | rm -rf get-orig-source $(TARBALL) | |
43 | mkdir get-orig-source | |
44 | svn export -r $(SVN_REVISION) $(SVN_ROOT) \ | |
45 | get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig | |
46 | rm -rf get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig/os_solaris_ata.s | |
47 | tar cJf $(TARBALL) -C get-orig-source $(PACKAGE)-$(SRC_VERSION).orig | |
48 | rm -rf get-orig-source | |
49 | echo " "$(TARBALL)" created; move it to the right destination to build the package" | |
50 | ||
51 | configure: configure-stamp | |
52 | configure-stamp: | |
53 | dh_testdir | |
54 | ./autogen.sh | |
55 | CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" ./configure --prefix=/usr \ | |
56 | --build=$(DEB_BUILD_GNU_TYPE) \ | |
57 | --host=$(DEB_HOST_GNU_TYPE) \ | |
58 | --sysconfdir=/etc \ | |
59 | --mandir=/usr/share/man \ | |
60 | --with-initscriptdir=no \ | |
61 | --docdir=/usr/share/doc/smartmontools \ | |
62 | --with-savestates=/var/lib/smartmontools/smartd. \ | |
63 | --with-attributelog=/var/lib/smartmontools/attrlog. \ | |
64 | --with-exampledir=/usr/share/doc/smartmontools/examples/ \ | |
65 | --with-drivedbdir=/var/lib/smartmontools/drivedb \ | |
66 | --with-systemdsystemunitdir=/lib/systemd/system \ | |
67 | --with-smartdscriptdir=/usr/share/smartmontools \ | |
68 | --with-smartdplugindir=/etc/smartmontools/smartd_warning.d \ | |
69 | --with-systemdenvfile=/etc/default/smartmontools \ | |
70 | ${CONFIGURE_ARGS} | |
71 | touch configure-stamp | |
72 | ||
73 | build: build-arch build-indep | |
74 | build-arch: build-stamp | |
75 | build-indep: build-stamp | |
76 | build-stamp: configure-stamp | |
77 | dh_testdir | |
78 | # Add here commands to compile the package. | |
79 | $(MAKE) | |
80 | touch build-stamp | |
81 | ||
82 | clean: | |
83 | dh_testdir | |
84 | dh_testroot | |
85 | # rm -f debian/logcheck.logcheck.ignore.* | |
86 | # Add here commands to clean up after the build process. | |
87 | [ ! -f Makefile ] || $(MAKE) distclean | |
88 | rm -f build-stamp configure-stamp \ | |
89 | Makefile.in examplescripts/Makefile.in aclocal.m4 configure \ | |
90 | config.guess config.h.in config.sub depcomp install-sh \ | |
91 | m4/pkg.m4 missing | |
92 | dh_clean | |
93 | ||
94 | install: build | |
95 | dh_testdir | |
96 | dh_testroot | |
97 | dh_prep | |
98 | dh_installdirs | |
99 | $(MAKE) DESTDIR=$(CURDIR)/debian/smartmontools install | |
100 | rm -f debian/smartmontools/usr/sbin/update-smart-drivedb | |
101 | ||
102 | # Build architecture-independent files here. | |
103 | binary-indep: | |
104 | # We have nothing to do by default. | |
105 | ||
106 | # Build architecture-dependent files here. | |
107 | binary-arch: build install | |
108 | dh_testdir | |
109 | dh_testroot | |
110 | rm -f debian/smartmontools/usr/share/doc/smartmontools/INSTALL \ | |
111 | debian/smartmontools/usr/share/doc/smartmontools/COPYING \ | |
112 | debian/smartmontools/usr/share/doc/smartmontools/ChangeLog | |
113 | dh_installdocs | |
114 | dh_installexamples | |
115 | dh_installmenu | |
116 | dh_installlogrotate | |
117 | dh_install | |
118 | dh_link | |
119 | dh_installsystemd | |
120 | dh_installinit | |
121 | dh_installcron | |
122 | dh_installinfo | |
123 | dh_lintian | |
124 | dh_installchangelogs ChangeLog | |
125 | dh_strip | |
126 | dh_compress | |
127 | dh_fixperms | |
128 | chmod 755 $(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10mail \ | |
129 | $(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10powersave-notify \ | |
130 | $(CURDIR)/debian/smartmontools/usr/share/smartmontools/smartd-runner | |
131 | dh_makeshlibs | |
132 | dh_installdeb | |
133 | dh_shlibdeps | |
134 | dh_gencontrol | |
135 | dh_md5sums | |
136 | dh_builddeb | |
137 | ||
138 | binary: binary-indep binary-arch | |
139 | .PHONY: build clean binary-indep binary-arch binary install configure get-orig-source |