]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - debian/rules
Harden smartmontools binaries
[mirror_smartmontools-debian.git] / debian / rules
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_HARDENING=1
9
10 DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
11 DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
12
13 ifeq ($(DEB_HOST_ARCH_OS),linux)
14 CONFIGURE_ARGS += --with-selinux
15 endif
16
17 CFLAGS += -fsigned-char -Wall
18 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
19 CFLAGS += -O0
20 else
21 CFLAGS += -O2
22 endif
23 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
24 INSTALL_PROGRAM = install -s
25 else
26 INSTALL_PROGRAM = install
27 endif
28
29 PACKAGE = smartmontools
30 SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p'| cut -d':' -f2)
31 SVN_REVISION := $(shell echo $(SRC_VERSION) | awk -F"+" '{ print $$2 }' | sed 's/svn//' )
32 TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.gz
33
34 get-orig-source:
35 rm -rf get-orig-source $(TARBALL)
36 mkdir get-orig-source
37 svn export -r $(SVN_REVISION) https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk/smartmontools/ \
38 get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig
39 GZIP=--best tar czf $(TARBALL) -C get-orig-source $(PACKAGE)-$(SRC_VERSION).orig
40 rm -rf get-orig-source
41 echo " "$(TARBALL)" created; move it to the right destination to build the package"
42
43 configure: configure-stamp
44 configure-stamp:
45 dh_testdir
46 ./autogen.sh
47 CFLAGS="${CFLAGS}" ./configure --prefix=/usr \
48 --sysconfdir=/etc \
49 --mandir=/usr/share/man \
50 --with-initscriptdir=no \
51 --with-docdir=/usr/share/doc/smartmontools \
52 --enable-drivedb \
53 --enable-savestates \
54 --enable-attributelog \
55 --with-savestates=/var/lib/smartmontools/smartd. \
56 --with-attributelog=/var/lib/smartmontools/attrlog. \
57 --with-exampledir=/usr/share/doc/smartmontools/examples/ \
58 ${CONFIGURE_ARGS}
59 touch configure-stamp
60
61 build: build-arch build-indep
62 build-arch: build-stamp
63 build-indep: build-stamp
64 build-stamp: configure-stamp
65 dh_testdir
66 # Add here commands to compile the package.
67 $(MAKE)
68 touch build-stamp
69
70 clean:
71 dh_testdir
72 dh_testroot
73 # rm -f debian/logcheck.logcheck.ignore.*
74 # Add here commands to clean up after the build process.
75 [ ! -f Makefile ] || $(MAKE) distclean
76 rm -f build-stamp configure-stamp \
77 Makefile.in examplescripts/Makefile.in aclocal.m4 configure
78 dh_clean
79
80 install: build
81 dh_testdir
82 dh_testroot
83 dh_prep
84 dh_installdirs
85 $(MAKE) DESTDIR=$(CURDIR)/debian/smartmontools install
86 install -D -m 755 debian/smartmontools-bug \
87 $(CURDIR)/debian/smartmontools/usr/share/bug/smartmontools
88
89 # Build architecture-independent files here.
90 binary-indep:
91 # We have nothing to do by default.
92
93 # Build architecture-dependent files here.
94 binary-arch: build install
95 dh_testdir
96 dh_testroot
97 dh_installdocs
98 dh_installexamples
99 dh_installmenu
100 dh_installlogrotate
101 dh_install
102 dh_installinit -- start 20 2 3 4 5 . stop 20 1 .
103 dh_installcron
104 dh_installman
105 dh_installinfo
106 dh_lintian
107 dh_installchangelogs ChangeLog
108 dh_link
109 dh_strip
110 dh_compress
111 dh_fixperms
112 chmod 755 $(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10mail \
113 $(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10powersave-notify \
114 $(CURDIR)/debian/smartmontools/usr/share/smartmontools/smartd-runner
115 dh_makeshlibs
116 dh_installdeb
117 dh_shlibdeps
118 dh_gencontrol
119 dh_md5sums
120 dh_builddeb
121
122 binary: binary-indep binary-arch
123 .PHONY: build clean binary-indep binary-arch binary install configure get-orig-source