Rev 42 | Rev 63 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 42 | Rev 43 | ||
---|---|---|---|
1 | #!/usr/bin/make -f |
1 | #!/usr/bin/make -f |
2 | # |
2 | # |
3 | # To build the packages, run `dpkg-buildpackage' or `debuild' from the |
3 | # To build the packages, run `dpkg-buildpackage' or `debuild' from the |
4 | # parent directory of this file. (You may need to specify the `-rfakeroot' |
4 | # parent directory of this file. (You may need to specify the `-rfakeroot' |
5 | # option if you are using dpkg-buildpackage and are not running as root) |
5 | # option if you are using dpkg-buildpackage and are not running as root) |
6 | # |
6 | # |
7 | # Copyright (C) 1999, 2000, 2001, 2002 Timshel Knoll <timshel@debian.org> |
7 | # Copyright © 1999, 2000, 2001, 2002 Timshel Knoll <timshel@debian.org> |
- | 8 | # Copyright © 2008, 2009, 2010, 2012 Magnus Holmgren <holmgren@debian.org> |
|
8 | # Licensed under the terms of the GNU General Public License |
9 | # Licensed under the terms of the GNU General Public License |
9 | # |
10 | # |
10 | # Based originally on Sample debian/rules that uses debhelper, from dh-make, |
11 | # Based originally on Sample debian/rules that uses debhelper, from dh-make, |
11 | # GNU copyright 1997 to 1999 by Joey Hess. |
12 | # GNU copyright 1997 to 1999 by Joey Hess. |
12 | 13 | ||
13 | # Uncomment this to turn on verbose mode. |
14 | # Uncomment this to turn on verbose mode. |
14 | #export DH_VERBOSE=1 |
15 | #export DH_VERBOSE=1 |
15 | 16 | ||
16 | # These are used for cross-compiling and for saving the configure script |
17 | # These are used for cross-compiling and for saving the configure script |
17 | # from having to guess our platform (since we know it already) |
18 | # from having to guess our platform (since we know it already) |
18 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
19 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
19 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
20 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
20 | 21 | ||
21 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
22 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
22 | buildflags := --build=$(DEB_BUILD_GNU_TYPE) |
23 | buildflags := --build=$(DEB_BUILD_GNU_TYPE) |
23 | else |
24 | else |
24 | buildflags := --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
25 | buildflags := --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
25 | endif |
26 | endif |
26 | 27 | ||
27 | buildflags += $(shell dpkg-buildflags --export=configure) |
28 | buildflags += $(shell dpkg-buildflags --export=configure) |
28 | 29 | ||
29 | # The name of the library - this is the base name of the packages that |
- | |
30 | # will be built |
- | |
31 | LIBRARY = liboop |
- | |
32 | - | ||
33 | # This is the soname of the package being built - we have to know this |
- | |
34 | # before the start of the build because changing the control file half |
- | |
35 | # way though the build probably isn't a good idea, and this would also |
- | |
36 | # mean renaming the $(LIBRARY)$(SONAME).{files,docs,...} files |
- | |
37 | SONAME = 4 |
- | |
38 | - | ||
39 | # A list of variables to substitute when generating files from .in files |
- | |
40 | # If you put an 'x' here, then all @x@'s in .in files will be substituted |
- | |
41 | # with the value of $(x) in the output file |
- | |
42 | SUBSTS = SONAME |
- | |
43 | - | ||
44 | GENFILES = debian/control \ |
- | |
45 | debian/$(LIBRARY)$(SONAME).install \ |
- | |
46 | debian/$(LIBRARY)$(SONAME).dirs |
- | |
47 | - | ||
48 | # We can't use these until after the package has been built ... otherwise |
- | |
49 | # they will fail because no .libs/lib*.so.* exists |
- | |
50 | version = $(shell ls .libs/lib*.so.* | \ |
- | |
51 | awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) \ |
- | |
52 | print substr($$0,RSTART)}') |
- | |
53 | major = $(shell ls .libs/lib*.so.* | \ |
- | |
54 | awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}') |
- | |
55 | - | ||
56 | # This builds a substitution list for sed based on the SUBSTS variable |
- | |
57 | # and the variables whose names SUBSTS contains ... |
- | |
58 | SUBSTLIST = $(foreach subst, $(SUBSTS),s/@$(subst)@/$($(subst))/g;) |
- | |
59 | - | ||
60 | # A sane default rule |
- | |
61 | default: |
- | |
62 | @echo "Try: debian/rules [configure|build|clean|install|binary|binary-arch|binary-indep]" |
- | |
63 | @echo "Vars:" |
- | |
64 | @echo " SUBSTLIST: $(SUBSTLIST)" |
- | |
65 | @echo " SONAME: $(SONAME)" |
- | |
66 | - | ||
67 | # Pattern rules: |
- | |
68 | - | ||
69 | # How to generate files from .in's |
- | |
70 | debian/%: debian/%.in debian/rules |
- | |
71 | sed -e '$(SUBSTLIST)' < $< > $@ |
- | |
72 | - | ||
73 | # This puts the $(LIBRARY)* packaging files in their right places |
- | |
74 | # Could I / should I use ln? |
- | |
75 | debian/$(LIBRARY)$(SONAME).%: debian/$(LIBRARY).% |
- | |
76 | cp $< $@ |
- | |
77 | - | ||
78 | # Do the substitution/moving stuff |
- | |
79 | packaging-files: $(GENFILES) |
- | |
80 | - | ||
81 | configure: packaging-files configure-stamp |
30 | configure: configure-stamp |
82 | configure-stamp: |
31 | configure-stamp: |
83 | dh_testdir |
32 | dh_testdir |
84 | 33 | ||
85 | [ -f debian/autoreconf.before ] || dh_autoreconf |
34 | [ -f debian/autoreconf.before ] || dh_autoreconf |
86 | 35 | ||
87 | ./configure --prefix=/usr $(buildflags) |
36 | ./configure --prefix=/usr $(buildflags) |
88 | 37 | ||
89 | touch $@ |
38 | touch $@ |
90 | 39 | ||
91 | build: build-arch |
40 | build: build-arch |
92 | build-indep: |
41 | build-indep: |
93 | build-arch: build-stamp |
42 | build-arch: build-stamp |
94 | build-stamp: configure-stamp |
43 | build-stamp: configure-stamp |
95 | dh_testdir |
44 | dh_testdir |
96 | 45 | ||
97 | $(MAKE) |
46 | $(MAKE) |
98 | 47 | ||
99 | touch $@ |
48 | touch $@ |
100 | 49 | ||
101 | clean: |
50 | clean: |
102 | dh_testdir |
51 | dh_testdir |
103 | dh_testroot |
52 | dh_testroot |
104 | rm -f build-stamp configure-stamp |
53 | rm -f build-stamp configure-stamp |
105 | 54 | ||
106 | [ ! -f Makefile ] || $(MAKE) distclean |
55 | [ ! -f Makefile ] || $(MAKE) distclean |
107 | 56 | ||
108 | dh_autoreconf_clean |
57 | dh_autoreconf_clean |
109 | dh_clean libtool configure |
58 | dh_clean |
110 | 59 | ||
111 | install: build |
60 | install: build |
112 | dh_testdir |
61 | dh_testdir |
113 | dh_testroot |
62 | dh_testroot |
114 | dh_prep |
63 | dh_prep |
115 | 64 | ||
116 | $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp |
65 | $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp |
117 | 66 | ||
118 | binary-indep: |
67 | binary-indep: |
119 | dh_testdir |
68 | dh_testdir |
120 | dh_testroot |
69 | dh_testroot |
121 | dh_install -i |
70 | dh_install -i |
122 | 71 | ||
123 | dh_installdocs -i |
72 | dh_installdocs -i |
124 | dh_installman -i |
73 | dh_installman -i |
125 | dh_installinfo -i |
74 | dh_installinfo -i |
126 | dh_installchangelogs -i |
75 | dh_installchangelogs -i |
127 | dh_link -i |
76 | dh_link -i |
128 | dh_compress -i -Xliboop-doc/html |
77 | dh_compress -i -Xliboop-doc/html |
129 | dh_fixperms -i |
78 | dh_fixperms -i |
130 | dh_installdeb -i |
79 | dh_installdeb -i |
131 | dh_gencontrol -i |
80 | dh_gencontrol -i |
132 | dh_md5sums -i |
81 | dh_md5sums -i |
133 | dh_builddeb -i |
82 | dh_builddeb -i |
134 | 83 | ||
135 | binary-arch: install |
84 | binary-arch: install |
136 | dh_testdir |
85 | dh_testdir |
137 | dh_testroot |
86 | dh_testroot |
138 | dh_install -a |
87 | dh_install -a |
139 | 88 | ||
140 | dh_installdocs -a |
89 | dh_installdocs -a |
141 | dh_installman -a |
90 | dh_installman -a |
142 | dh_installinfo -a |
91 | dh_installinfo -a |
143 | dh_installchangelogs -a |
92 | dh_installchangelogs -a |
144 | dh_link -a |
93 | dh_link -a |
145 | dh_strip -a --dbg-package=liboop-dbg |
94 | dh_strip -a --dbg-package=liboop-dbg |
146 | dh_compress -a -Xliboop-doc/html |
95 | dh_compress -a -Xliboop-doc/html |
147 | dh_fixperms -a |
96 | dh_fixperms -a |
148 | dh_makeshlibs -a |
97 | dh_makeshlibs -a |
149 | dh_installdeb -a |
98 | dh_installdeb -a |
150 | # Don't add the depends for adapter libraries - programs which link |
99 | # Don't add the depends for adapter libraries - programs which link |
151 | # with them will also link with the appropriate library |
100 | # with them will also link with the appropriate library |
152 | dh_shlibdeps -a -Xliboop- |
101 | dh_shlibdeps -a -Xliboop- |
153 | dh_gencontrol -a |
102 | dh_gencontrol -a |
154 | dh_md5sums -a |
103 | dh_md5sums -a |
155 | dh_builddeb -a |
104 | dh_builddeb -a |
156 | 105 | ||
157 | binary: binary-indep binary-arch |
106 | binary: binary-indep binary-arch |
158 | 107 | ||
159 | .PHONY: packaging-files configure build install |
108 | .PHONY: configure build build-arch build-indep install |
160 | .PHONY: binary-indep binary-arch binary clean |
109 | .PHONY: binary-indep binary-arch binary clean |