Rather have a badly worded FAQ than a wrong one
[tor.git] / debian / rules
blobc248290929781b9b02e0a4c98d68279125009eea
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # GNU copyright 1997 to 1999 by Joey Hess.
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14 CFLAGS = -Wall -g
16 export PACKAGE=tor
17 include /usr/share/dpatch/dpatch.make
19 # Do not optimize the build with "noopt"
20 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
21 CFLAGS += -O0
22 else
23 CFLAGS += -O2
24 endif
26 # Do not strip the binary with "nostrip"
27 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
28 # INSTALL_PROGRAM += -s
29 #endif
31 # Prevent the design paper from being built with "nodoc"
32 ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
33 BUILD_DOC = no
34 endif
36 # Prevent the unit tests from being run with "nocheck"
37 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
38 RUN_TEST = no
39 endif
40 ifneq (,$(findstring notest,$(DEB_BUILD_OPTIONS)))
41 RUN_TEST = no
42 endif
44 configure: patch-stamp
45 config.status: configure
46 dh_testdir
47 CFLAGS="$(CFLAGS)" ./configure \
48 --host=$(DEB_HOST_GNU_TYPE) \
49 --build=$(DEB_BUILD_GNU_TYPE) \
50 --prefix=/usr \
51 --mandir=\$${prefix}/share/man \
52 --infodir=\$${prefix}/share/info \
53 --localstatedir=/var \
54 --sysconfdir=/etc
57 build: build-stamp
59 build-stamp: config.status
60 dh_testdir
62 $(MAKE)
63 @echo
64 @echo
65 # Running unit tests
66 if [ "$(RUN_TEST)" != "no" ]; then \
67 src/or/test; \
68 else \
69 echo -e "\n\nSkipping unittests\n\n"; \
71 @echo
73 # make design paper
74 if [ "$(BUILD_DOC)" != "no" ]; then \
75 make -C doc/design-paper tor-design.ps tor-design.pdf || \
76 ( echo -e "*\n*\n*\n*"; \
77 echo "* Building some docs failed, perhaps because you did not install the"; \
78 echo "* declared build dependencies and then used -o with dpkg-buildpackage."; \
79 echo "*"; \
80 echo "* If you want to skip this part, you can set nodoc in DEB_BUILD_OPTIONS" ; \
81 echo "* and start the build again. DEB_BUILD_OPTIONS=nodoc dpkg-buildpackage.."; \
82 echo -e "*\n*\n*\n*"; \
83 false ); \
84 else \
85 echo -e "\n\nSkipping tor-design.{ps,pdf}\n\n"; \
88 touch build-stamp
90 clean: unpatch
91 dh_testdir
92 dh_testroot
93 rm -f build-stamp
95 -$(MAKE) distclean
97 dh_clean
99 install: build
100 dh_testdir
101 dh_testroot
102 dh_clean -k
103 dh_installdirs
105 $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
106 # move tor to where it belongs
107 mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
108 mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
109 install -d $(CURDIR)/debian/tor/usr/share/man/man8
110 mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
112 install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
113 install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
114 install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
116 install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
118 dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
120 rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
123 # Build architecture-independent files here.
124 binary-indep: build install
125 # We have nothing to do by default.
127 # Build architecture-dependent files here.
128 binary-arch: build install
129 dh_testdir
130 dh_testroot
131 dh_installchangelogs ChangeLog
132 dh_installdocs
133 if [ "$(BUILD_DOC)" != "no" ]; then \
134 install -m 644 doc/design-paper/tor-design.ps $(CURDIR)/debian/tor/usr/share/doc/tor/; \
135 install -m 644 doc/design-paper/tor-design.pdf $(CURDIR)/debian/tor/usr/share/doc/tor/; \
137 dh_installexamples
138 # dh_install
139 # dh_installdebconf
140 dh_installlogrotate
141 # dh_installemacsen
142 # dh_installmime
143 dh_installinit
144 # dh_installcron
145 dh_installman
146 dh_link
147 #dh_strip
148 dh_compress
149 dh_fixperms
150 dh_installdeb
151 dh_shlibdeps
152 dh_gencontrol
153 dh_md5sums
154 dh_builddeb
156 binary: binary-indep binary-arch
157 .PHONY: build clean binary-indep binary-arch binary install