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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
#!/usr/bin/make -f
##############################################################################
# Generic debian/rules file. Based on:
#
#> Sample debian.rules file - for GNU Hello (1.3).
#> Copyright 1994,1995 by Ian Jackson.
#> I hereby give you perpetual unlimited permission to copy,
#> modify and relicense this file, provided that you do not remove
#> my name from the file itself. (I assert my moral right of
#> paternity under the Copyright, Designs and Patents Act 1988.)
#
# Heavily modified by Joey Hess <joeyh@master.debian.org>
#
##############################################################################
#
# NOTE: You shouldn't have to edit this file. Edit debian/config instead.
# If you must edit this file to get your package to build properly, then
# I have failed. Let me know; mail me.
#
# NOTE: This file is designed so it doesn't need to be run as root. For
# actions that require that the user be root, the root password will be
# prompted for, if you're not already root. However, nowadays you're better
# off using fakeroot anyway.
#
##############################################################################
#
# Changelog:
# * Added build to .PHONY
# * Fixed binary-indep target.
# * Fakeroot and sudo fixes.
# * Run dpkg-gencontrol after debstd, and delete substvars during clean.
# * Clean up junk files in subdirs.
# * Modifications for multiple binary package support.
# * Call debstd after fixing file perms.
# * Don't pass package name to debstd + fixes for multi binary packages.
# * Use build-stamp instead of build.
# * New email address.
# * Added changelog.
#
# stevem 10/01/98
# * Removed debstd calls - do it ourselves...
##############################################################################
# Include config file.
include debian/config
# Generate a makefile (via configure script or xmkmf).
makefile-stamp:
ifeq ($(strip $(use_imakefile)),y)
xmkmf -a
endif
$(use_configure)
touch makefile-stamp
# Preserve some files that may get deleted/overwritten/modified otherwise.
preserve-stamp:
ifneq ($(strip $(preserve_files)),)
$(foreach file,$(preserve_files),cp $(file) $(file).preserved ;)
endif
touch preserve-stamp
build-stamp: preserve-stamp makefile-stamp
$(checkdir)
$(build_command)
touch build-stamp
build: build-stamp
clean: preserve-stamp makefile-stamp
$(checkdir)
# Do actual cleaning up here.
-rm -f build-stamp
$(clean_command)
-find . -name '\#*\#' -o -name '*~' -o -name 'DEADJOE' -exec rm -f {} \;
-rm -f debian/files* debian/substvars debian/*.substvars $(clean_files)
$(clean_tmp)
# Remove Makefile that xmkmf creates.
ifeq ($(strip $(use_imakefile)),y)
-rm -f Makefile
endif
# If we preserved some files, we need to restore them now.
ifneq ($(strip $(preserve_files)),)
$(foreach file,$(preserve_files),mv -f $(file).preserved $(file); )
endif
-rm -f preserve-stamp makefile-stamp
# This isn't going to work when I have a source package that makes
# binary-indep and binary packages. Luckily, I don't have one yet.
# Build architecture-independent files here.
binary-indep: build
$(checkdir)
if grep -q 'Architecture: all' debian/control; then \
$(MAKE) -f debian/rules dobuild; \
else \
echo "Nothing to do for binary-indep."; \
fi
# Build architecture-dependent files here.
binary-arch: build
$(checkdir)
if grep -q 'Architecture: all' debian/control; then \
echo "Nothing to do for binary-arch."; \
else \
$(MAKE) -f debian/rules dobuild; \
fi
# Actually build the binary packages here, no matter what type they are.
dobuild:
$(clean_tmp)
install -d debian/tmp debian/tmp/DEBIAN debian/tmp/usr/share/doc/$(package)
$(install_command)
# Compress manpages
-gzip -9v -r debian/tmp/usr/share/man/ debian/tmp/usr/X11R6/man/
# Install documentation files, compressed.
ifneq ($(strip $(docs)),)
cp $(docs) debian/tmp/usr/share/doc/$(package)
gzip -9v debian/tmp/usr/share/doc/$(package)/*
endif
# Install copyright file, don't compress.
ifneq ($(strip $(copyright)),)
cp $(copyright) debian/tmp/usr/share/doc/$(package)/copyright
endif
# Install examples, compressed.
ifneq ($(strip $(examples)),)
install -d debian/tmp/usr/share/doc/$(package)/examples
cp $(examples) debian/tmp/usr/share/doc/$(package)/examples
gzip -9v debian/tmp/usr/share/doc/$(package)/examples/*
endif
# Install other debian files if they exist.
-install -m 644 debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
-gzip -9v debian/tmp/usr/share/doc/$(package)/changelog.Debian
-install -m 644 debian/conffiles debian/tmp/DEBIAN/conffiles
-install -m 755 debian/preinst debian/tmp/DEBIAN/preinst
-install -m 755 debian/postinst debian/tmp/DEBIAN/postinst
-install -m 755 debian/prerm debian/tmp/DEBIAN/prerm
-install -m 755 debian/postrm debian/tmp/DEBIAN/postrm
# Generate control file.
dpkg-shlibdeps $(binfiles)
dpkg-gencontrol
# Set permissions.
@[ "`whoami`" != root ] && \
echo -e "\n ** Enter root password to set file permissions."; \
$(MAKE) -f debian/rules setperms; \
# Actually build the .deb file.
dpkg --build debian/tmp ..
# This must be run suid root, it sets the file permissions in debian/tmp
setperms:
chown -R root.root debian/tmp
chmod -R g-ws debian/tmp
$(ch_commands)
define checkdir
@test -e $(test_file) -a -f debian/rules || (echo -e "\n\
** \"$(test_file)\" or \"debian/rules\" does not exist.\n\
** Either the package is not unpacked in this directory, or\n\
** an incorrect test_file is specified in debian/config.\n" && false)
endef
# This rm's the debian/tmp directory, and any other directories specified in
# tmpdirs
define clean_tmp
-rm -rf debian/tmp >/dev/null 2>&1
@if [ -d debian/tmp -o -n "$(tmp_dirs)" ]; then \
if [ "`whoami`" != root ]; then \
echo -e "\n ** Enter root password to remove temporary directories $(tmp_dirs)"; \
fi; \
su -c "rm -rf debian/tmp"; \
fi
endef
binary: binary-indep binary-arch
.PHONY: clean setperms binary build binary-indep binary-arch dobuild setperms
|