~ubuntu-branches/ubuntu/hardy/pacman/hardy

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Bazaar Package Importer
  • Author(s): Peter Joseph
  • Date: 2001-07-16 00:40:44 UTC
  • Revision ID: james.westby@ubuntu.com-20010716004044-faape96k5f658yxa
Tags: 10-13
Fixed HPPA build problems thanks to Snowman (closes: #104861)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/make -f
 
2
##############################################################################
 
3
# Generic debian/rules file. Based on:
 
4
#
 
5
#> Sample debian.rules file - for GNU Hello (1.3).
 
6
#> Copyright 1994,1995 by Ian Jackson.
 
7
#> I hereby give you perpetual unlimited permission to copy,
 
8
#> modify and relicense this file, provided that you do not remove
 
9
#> my name from the file itself.  (I assert my moral right of
 
10
#> paternity under the Copyright, Designs and Patents Act 1988.)
 
11
#
 
12
# Heavily modified by Joey Hess <jeh22@cornell.edu>
 
13
#
 
14
##############################################################################
 
15
#
 
16
# NOTE: You shouldn't have to edit this file. Edit debian/config instead.
 
17
# If you must edit this file to get your package to build properly, then
 
18
# I have failed. Let me know; mail jeh22@cornell.edu.
 
19
#
 
20
# (Currently not handled: multiple binary packages from 1 source package,
 
21
# and binary-indep rule.)
 
22
#
 
23
# NOTE: This file is designed so it doesn't need to be run as root. For
 
24
# actions that require that the user be root, the root password will be
 
25
# prompted for, if you're not already root.
 
26
#
 
27
##############################################################################
 
28
 
 
29
# Include config file.
 
30
include debian/config
 
31
 
 
32
# Generate a makefile (via configure scriopt or xmkmf).
 
33
makefile-stamp:
 
34
  ifeq ($(strip $(use_imakefile)),y)
 
35
        xmkmf -a
 
36
  endif 
 
37
        $(use_configure)
 
38
        touch makefile-stamp
 
39
 
 
40
# Preserve some files that may get deleted/overwritten/modified otherwise.
 
41
preserve-stamp:
 
42
  ifneq ($(strip $(preserve_files)),)
 
43
        $(foreach file,$(preserve_files),-cp $(file) $(file).preserved)
 
44
  endif
 
45
        touch preserve-stamp
 
46
 
 
47
build: preserve-stamp makefile-stamp
 
48
        $(checkdir)
 
49
        $(build_command)
 
50
        touch build
 
51
 
 
52
clean: preserve-stamp makefile-stamp
 
53
        $(checkdir)
 
54
  # Do actual cleaning up here.
 
55
        -rm -f build
 
56
        $(clean_command)
 
57
        -rm -rf *~ debian/*~ debian/files* $(clean_files)
 
58
        $(clean_tmp)
 
59
  # Remove Makefile that xmkmf creates.
 
60
  ifeq ($(strip $(use_imakefile)),y)
 
61
        -rm -f Makefile
 
62
  endif
 
63
  # If we preserved some files, we need to restore them now.
 
64
  ifneq ($(strip $(preserve_files)),)
 
65
        $(foreach file,$(preserve_files),-mv -f $(file).preserved $(file))
 
66
  endif
 
67
        -rm -f preserve-stamp makefile-stamp
 
68
 
 
69
# Build architecture-independent files here.
 
70
# (not yet set up to be used)
 
71
binary-indep: build
 
72
        $(checkdir)
 
73
 
 
74
# Build architecture-dependent files here.
 
75
binary-arch: build
 
76
        $(checkdir)
 
77
        $(clean_tmp)
 
78
        install -d debian/tmp debian/tmp/DEBIAN debian/tmp/usr/share/doc/$(package)
 
79
        $(install_command)
 
80
  # Compress manpages
 
81
        -gzip -9v -r debian/tmp/usr/share/man/ debian/tmp/usr/X11R6/man/
 
82
  # Install documentation files, compressed.
 
83
  ifneq ($(strip $(docs)),)
 
84
        cp $(docs) debian/tmp/usr/share/doc/$(package)
 
85
        gzip -9v debian/tmp/usr/share/doc/$(package)/*
 
86
  endif
 
87
  # Install copyright file, don't compress.
 
88
  ifneq ($(strip $(copyright)),)
 
89
        cp $(copyright) debian/tmp/usr/share/doc/$(package)/copyright
 
90
  endif
 
91
  # Install examples, compressed.
 
92
  ifneq ($(strip $(examples)),)
 
93
        install -d debian/tmp/usr/sharedoc/examples/$(package)
 
94
        cp $(examples) debian/tmp/usr/share/doc/examples/$(package)
 
95
        gzip -9v debian/tmp/usr/share/doc/examples/$(package)/*
 
96
  endif
 
97
  # Install other debian files if they exist.
 
98
        -install -m 644 debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
 
99
        -gzip -9v debian/tmp/usr/share/doc/$(package)/changelog.Debian
 
100
        -install -m 644 debian/conffiles debian/tmp/DEBIAN/conffiles
 
101
        -install -m 755 debian/preinst debian/tmp/DEBIAN/preinst
 
102
        -install -m 755 debian/postinst debian/tmp/DEBIAN/postinst
 
103
        -install -m 755 debian/prerm debian/tmp/DEBIAN/prerm
 
104
        -install -m 755 debian/postrm debian/tmp/DEBIAN/postrm
 
105
  # Generate control file.
 
106
        dpkg-shlibdeps $(binfiles)
 
107
        dpkg-gencontrol -isp
 
108
  # Set permissions.
 
109
        @[ "`whoami`" != root ] && \
 
110
                echo -e "\n ** Enter root password to set file permissions."; \
 
111
        debian/rules setperms
 
112
  # Actually build the .deb file.
 
113
        dpkg --build debian/tmp ..
 
114
 
 
115
# This must be run suid root, it sets the file permissions in debian/tmp
 
116
setperms:
 
117
        chown -R root.root debian/tmp
 
118
        chmod -R g-ws debian/tmp
 
119
        $(ch_commands)
 
120
 
 
121
define checkdir
 
122
        @test -f $(test_file) -a -f debian/rules || (echo -e "\n\
 
123
        ** \"$(test_file)\" or \"debian/rules\" does not exist.\n\
 
124
        ** Either \"$(package)\" is not unpacked in this directory, or\n\
 
125
        ** an incorrect test_file is specified in debian/config.\n" && false)
 
126
endef
 
127
 
 
128
# This rm's the debian/tmp directory.
 
129
define clean_tmp
 
130
        -rm -rf debian/tmp >/dev/null 2>&1
 
131
        @if [ -d debian/tmp ]; then \
 
132
                if  [ "`whoami`" != root ]; then \
 
133
                        echo -e "\n ** Enter root password to remove debian/tmp."; \
 
134
                fi; \
 
135
                rm -rf debian/tmp; \
 
136
        fi
 
137
endef
 
138
 
 
139
binary: binary-indep binary-arch
 
140
.PHONY: clean setperms binary