~ubuntu-branches/ubuntu/quantal/dh-make/quantal

« back to all changes in this revision

Viewing changes to lib/debiank/rules

  • Committer: Bazaar Package Importer
  • Author(s): Craig Small
  • Date: 2006-11-01 08:30:21 UTC
  • mfrom: (1.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20061101083021-mkdu8suq5t891dh7
* Stopped shiiping the kde examples (Closes: #372287)
* debiank/rules is executable (Closes: #372768)
* de-hypened man page (Closes: #372777)
* templates changed to use compat level 5 (Closes: #370468)
* Default priority extra in templates (Closes: #373603)
* MAKE install var=xx => MAKE var=xx install (Closes: #374175)
* Consitent formatting of maintainer script (Closes: #370488)
* Kernel module name consistent (Closes: #384085)
* bzip2 path was changed (Closes: #377523)
* fixes for cdbs template (Closes: #382042)
* Now supports ~ in upstream version number (Closes: #387465)
* fixed force-reload behaviour of init.d template to follow LSB
  (Closes: #377292)
* README.Debian the same author line as in changelog (Closes: #379773)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
        CFLAGS += -O2
27
27
endif
28
28
 
 
29
# some default definitions, important!
 
30
 
31
# Name of the source package
 
32
psource:=#PACKAGE#-source
 
33
 
 
34
# The short upstream name, used for the module source directory
 
35
sname:=#PACKAGE#
 
36
 
29
37
### KERNEL SETUP
30
38
### Setup the stuff needed for making kernel module packages
31
39
### taken from /usr/share/kernel-package/sample.module.rules
32
40
 
33
 
# Name of package
34
 
package         = #PACKAGE#
35
 
# KSRC is the location of the kernel source. This is the default value,
36
 
# when make-kpkg is used it will supply to real value
37
 
KSRC            = /usr/src/linux
38
 
# KDREV is the package-revision, as given to make-kpkg by the user.
39
 
# Just put a simply default value in here which we use when we test
40
 
# the packagebuilding without make-kpkg
41
 
ifeq ($(strip $(KDREV)),)
42
 
KDREV           = "test1.0"
43
 
endif
44
 
 
45
 
## Now to determine the kernel version, normally supplied by make-kpkg
46
 
ifeq ($(strip $(KVERS)),)
47
 
# Now we need to get the kernel-version somehow (we are not running
48
 
# under make-kpkg?)
49
 
ifeq ($(strip $(KSRC)),)
50
 
$(error Error. I do not know how to determine the kernel version)
51
 
else
52
 
kversion :=$(shell grep -E '^VERSION +=' $(KSRC)/Makefile 2>/dev/null | \
53
 
                 sed -e 's/[^0-9]*\([0-9]*\)/\1/')
54
 
kplevel  :=$(shell grep -E '^PATCHLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \
55
 
                    sed -e 's/[^0-9]*\([0-9]*\)/\1/')
56
 
ksublevel:=$(shell grep -E '^SUBLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \
57
 
                  sed -e 's/[^0-9]*\([0-9]*\)/\1/')
58
 
EXTRA_VERSION:=$(shell grep -E '^EXTRAVERSION +=' $(KSRC)/Makefile 2>/dev/null | \
59
 
                 sed -e 's/EXTRAVERSION[\t ]*=[\t ]*\(.*\)/\1/')
60
 
kextra:=$(strip $(EXTRA_VERSION))
61
 
HAVE_NEW_MODLIB:=$(shell grep -E '\(INSTALL_MOD_PATH\)' \
62
 
                            $(KSRC)/Makefile 2>/dev/null )
63
 
 
64
 
# If you want to have more than one kernel configuration per kernel
65
 
# version, set FLAVOUR in the top level kernel Makefile *before*
66
 
# invoking make-kpkg -- it will be appended to UTS_RELEASE in
67
 
# version.h (separated by a hyphen). This affects everything -- the
68
 
# names and versions of the image, source, headers, and doc packages,
69
 
# and where the modules are searched for in /lib/modules.
70
 
 
71
 
ifdef FLAVOUR
72
 
# uhm - should check if we really have a Makefile capable of Flavours?
73
 
endif
74
 
 
75
 
FLAVOUR:=$(shell grep ^FLAVOUR $(KSRC)/Makefile 2>/dev/null | \
76
 
                  perl -ple 's/FLAVOUR[\s:=]+//g')
77
 
 
78
 
ifneq ($(strip $(FLAVOUR)),)
79
 
INT_FLAV := -$(FLAVOUR)
80
 
FLAV_ARG := FLAVOUR=$(FLAVOUR)
81
 
else
82
 
INT_FLAV :=
83
 
FLAV_ARG :=
84
 
endif
85
 
 
86
 
## This is the replacement for FLAVOUR
87
 
ifneq ($(strip $(APPEND_TO_VERSION)),)
88
 
iatv := $(strip $(APPEND_TO_VERSION))
89
 
EXTRAV_ARG := EXTRAVERSION=${EXTRA_VERSION}${iatv}
90
 
else
91
 
iatv :=
92
 
EXTRAV_ARG :=
93
 
endif
94
 
 
95
 
KVERS = $(kversion).$(kplevel).$(ksublevel)$(kextra)$(iatv)$(INT_FLAV)
96
 
 
97
 
endif
98
 
endif
99
 
 
100
 
non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
101
 
epoch=$(shell echo $(KVERS) | perl -ne 'm/^(\d+:)/ && print $$1')
102
 
 
103
 
# We also need the package version
104
 
pversion        = $(shell sed -ne '1s/.*\((.*)\).*/\1/' debian/changelog)
105
 
pversion        = $(shell sed -ne '1s/.*(\(.*\)).*/\1/p' debian/changelog)
106
 
 
107
 
# MODDIR is the place where the final .deb package should be made. This is the
108
 
# default value, when make-kpkg is used it will supply to real value
109
 
MODDIR          = ..
110
 
 
111
 
pmodules = $(package)-modules-$(non_epoch_version)
112
 
psource = $(package)-source
113
 
 
114
 
# Prepares the package for distribution.  Intended for the kernel
115
 
# maintainer.
116
 
kdist: kdist_clean kdist_config kdist_image
117
 
 
118
 
# The kdist_configure target is called by make-kpkg modules_config. It
119
 
# should configure the module so it is ready for compilation (mostly
120
 
# useful for calling configure)
121
 
kdist_config:
122
 
        @echo Nothing to configure
123
 
 
124
 
# the kdist_image target is called by make-kpkg modules_image. It is
125
 
# responsible for compiling the module and creating the package. It
126
 
# should also clean up after making the module. Please note we use a
127
 
# seperate binary-modules target to make testing the package building
128
 
# easier
129
 
kdist_image:
130
 
        $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-modules
131
 
        $(MAKE) $(MFLAGS) -f debian/rules clean
132
 
 
133
 
# the kdist_clean target is called by make-kpkg modules_clean. It is
134
 
# responsible for cleaning up any changes that have been made by the
135
 
# other kdist_commands (except for the .deb files created).
136
 
kdist_clean:
137
 
        $(MAKE) $(MFLAGS) -f debian/rules clean
138
 
 
 
41
# prefix of the target package name
 
42
PACKAGE=#PACKAGE#-modules
 
43
# modifieable for experiments or debugging m-a
 
44
MA_DIR ?= /usr/share/modass
 
45
# load generic variable handling
 
46
-include $(MA_DIR)/include/generic.make
 
47
# load default rules, including kdist, kdist_image, ...
 
48
-include $(MA_DIR)/include/common-rules.make
 
49
  
 
50
# module assistant calculates all needed things for us and sets
 
51
# following variables:
 
52
# KSRC (kernel source directory), KVERS (kernel version string), KDREV
 
53
# (revision of the Debian kernel-image package), CC (the correct
 
54
# compiler), VERSION (the final package version string), PKGNAME (full
 
55
# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
 
56
  
 
57
# The kdist_configure target is called by make-kpkg modules_config and
 
58
# by kdist* rules by dependency. It should configure the module so it is
 
59
# ready for compilation (mostly useful for calling configure).
 
60
# prep-deb-files from module-assistant creates the neccessary debian/ files 
 
61
kdist_configure: prep-deb-files
 
62
  
 
63
# the kdist_clean target is called by make-kpkg modules_clean and from
 
64
# kdist* rules. It is responsible for cleaning up any changes that have
 
65
# been made by the other kdist_commands (except for the .deb files created)
 
66
kdist_clean: clean
 
67
        $(MAKE) $(MFLAGS) -f debian/rules clean
 
68
#       rm -f driver/*.o driver/*.ko
 
69
#
139
70
### end  KERNEL SETUP
140
71
 
141
72
#CONFIGURE#
147
78
        # Add here command to compile/build the package.
148
79
        $(MAKE)
149
80
 
150
 
        touch build-arch-stamp
151
 
 
152
 
# the binary-modules target prepares the $(pmodules) package.
153
 
# It is called by make-kpkg and *not* during a normal build
 
81
        touch $@
 
82
 
 
83
#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k)
 
84
 
 
85
# the binary-modules rule is invoked by module-assistant while processing the
 
86
# kdist* targets. It is called by module-assistant or make-kpkg and *not*
 
87
# during a normal build
154
88
binary-modules:
155
 
        export DH_OPTIONS='-p$(pmodules)'
156
 
 
157
 
        # Is this needed for setting up a Depends?
158
 
        #echo "kpkg:Package-Version=$(epoch)$(pversion)+$(non_epoch_version)" \
159
 
        #        >> debian/$(package).substvars
160
 
        echo "kpkg:Kernel-Version=$(non_epoch_version)" > \
161
 
                debian/$(pmodules).substvars
162
 
 
163
 
        # The substvars mechanism seems slightly broken, hack to get around it
164
 
        # stolen from the qce-ga package. Yaaaa!
165
 
        sed -e 's/$${kpkg\:Kernel\-Version}/$(non_epoch_version)/' \
166
 
        debian/control.modules.in > debian/control
167
 
 
168
 
        dh_testdir
169
89
        dh_testroot
170
90
        dh_clean -k
 
91
        dh_installdirs lib/modules/$(KVERS)/misc
171
92
 
172
93
        # Build the module
173
 
        $(MAKE)
 
94
        $(MAKE) -C drivers KERNEL_DIR=$(KSRC) KVERS=$(KVERS)
174
95
 
175
96
        # Install the module
176
 
        $(MAKE) install DESTDIR=$(CURDIR)/debian/$(pmodules)
 
97
        cp drivers/slusb.$ko drivers/slamr.$ko debian/$(PKGNAME)/lib/modules/$(KVERS)/misc
177
98
 
178
 
        dh_installdebconf
179
 
        # FIXME dh_installdocs README
 
99
        dh_installdocs
180
100
        dh_installchangelogs
181
 
 
182
 
        # We're not using this yet
183
 
        #dh_installmodules
184
 
 
 
101
        dh_compress
 
102
        dh_fixperms
185
103
        dh_installdeb
186
 
        #dh_gencontrol -- -v$(epoch)$(pversion)+$(non_epoch_version)+$(KDREV)
187
 
        dh_gencontrol -- -v$(epoch)$(pversion)
 
104
        dh_gencontrol -- -v$(VERSION)
188
105
        dh_md5sums
189
 
        #dh_builddeb --destdir=$(KSRC)/..
190
 
        dh_builddeb --destdir=$(MODDIR)
191
 
 
 
106
        dh_builddeb --destdir=$(DEB_DESTDIR)
 
107
        dh_clean -k
192
108
 
193
109
build-indep: #CONFIG_STATUS# #CONFIGURE_STAMP# build-indep-stamp
194
110
build-indep-stamp:
199
115
        #  anything for this package.
200
116
        #docbook-to-man debian/#PACKAGE#.sgml > #PACKAGE#.1
201
117
 
202
 
        touch build-indep-stamp
 
118
        touch $@
203
119
 
204
120
build: build-arch build-indep
205
121
 
221
137
        dh_installdirs
222
138
 
223
139
        # Create the directories to install the source into
224
 
        dh_installdirs -p$(psource)  usr/src/modules/$(package)
225
 
        dh_installdirs -p$(psource)  usr/src/modules/$(package)/debian
 
140
        dh_installdirs -p$(psource)  usr/src/modules/$(sname)/debian
226
141
 
227
142
        # Copy only the driver source to the proper location
228
 
        cp -s driver/*  debian/$(psource)/usr/src/modules/$(package)
 
143
        cp -s driver/*  debian/$(psource)/usr/src/modules/$(sname)
229
144
        # Copy the needed debian/ pieces to the proper location
230
 
        cp debian/*-modules.* \
231
 
                debian/$(psource)/usr/src/modules/$(package)/debian
232
 
        cp debian/control.modules.in \
233
 
                debian/$(psource)/usr/src/modules/$(package)/debian/control.in
234
 
        cp debian/rules \
235
 
                debian/$(psource)/usr/src/modules/$(package)/debian
236
 
        cp debian/changelog \
237
 
                debian/$(psource)/usr/src/modules/$(package)/debian
238
 
        cp debian/copyright \
239
 
                debian/$(psource)/usr/src/modules/$(package)/debian
 
145
        cp debian/*modules.in* \
 
146
                debian/$(psource)/usr/src/modules/$(sname)/debian
 
147
        cp debian/*_KVERS_* debian/rules debian/changelog debian/copyright \
 
148
                debian/compat debian/$(psource)/usr/src/modules/$(sname)/debian/
 
149
        cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
240
150
 
241
151
        # Add here commands to install the package into debian/#PACKAGE#.
242
152
        #INSTALL#
305
215
        dh_builddeb -s
306
216
 
307
217
binary: binary-indep binary-arch
308
 
.PHONY: build clean binary-indep binary-arch binary install #PHONY_CONFIGURE# binary-modules kdist kdist_config kdist_image kdist_clean
 
218
.PHONY: build clean binary-indep binary-arch binary install #PHONY_CONFIGURE# binary-modules kdist kdist_configure kdist_image kdist_clean