~didrocks/totem/ubuntu

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Didier Roche
  • Date: 2009-01-06 16:54:42 UTC
  • Revision ID: didrocks@ubuntu.com-20090106165442-6kjg99vrbyiddwrg
init totem package in bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/make -f
 
2
#-*- makefile -*-
 
3
 
 
4
#export DH_VERBOSE=1
 
5
 
 
6
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
 
7
DEB_VERSION := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
 
8
include /usr/share/gnome-pkg-tools/1/rules/gnome-version.mk
 
9
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk
 
10
 
 
11
STAMP_DIR := debian/stamp
 
12
BUILD_DIR := debian/build
 
13
PATCH_DIR := debian/patches
 
14
 
 
15
COMPKG := totem-common
 
16
PLUGPKG := totem-plugins
 
17
PLUGEXTRAPKG := totem-plugins-extra
 
18
 
 
19
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
20
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
21
 
 
22
FLAVORS := xine gstreamer
 
23
PRIORITY_xine := 35
 
24
PRIORITY_gstreamer := 40
 
25
export PRIORITY_xine PRIORITY_gstreamer
 
26
 
 
27
CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)
 
28
 
 
29
COMMON_CONFIGURE_FLAGS += \
 
30
        --prefix=/usr \
 
31
        --sysconfdir=/etc \
 
32
        --mandir=\$${prefix}/share/man \
 
33
        --disable-maintainer-mode \
 
34
        --with-gecko=mozilla \
 
35
        --disable-run-in-source-tree \
 
36
        --disable-scrollkeeper
 
37
 
 
38
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
 
39
        COMMON_CONFIGURE_FLAGS += --build=$(DEB_BUILD_GNU_TYPE)
 
40
else
 
41
        COMMON_CONFIGURE_FLAGS += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
 
42
endif
 
43
 
 
44
xine_CONFIGURE_FLAGS := $(COMMON_CONFIGURE_FLAGS) \
 
45
        --libexecdir=\$${prefix}/lib/totem/xine \
 
46
        --enable-xine
 
47
 
 
48
gstreamer_CONFIGURE_FLAGS := $(COMMON_CONFIGURE_FLAGS) \
 
49
        --libexecdir=\$${prefix}/lib/totem/gstreamer
 
50
 
 
51
patch: $(STAMP_DIR)/patch-stamp
 
52
$(STAMP_DIR)/patch-stamp:
 
53
        dh_testdir
 
54
        mkdir -p $(STAMP_DIR)
 
55
        QUILT_PATCHES=$(PATCH_DIR) quilt --quiltrc /dev/null push -a || test $$? = 2
 
56
        touch $@
 
57
 
 
58
builddir = $(BUILD_DIR)/$*
 
59
 
 
60
configure: $(addprefix $(STAMP_DIR)/configure-stamp-, $(FLAVORS))
 
61
$(STAMP_DIR)/configure-stamp-%: $(STAMP_DIR)/patch-stamp
 
62
        dh_testdir
 
63
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
 
64
        cp -f /usr/share/misc/config.sub config.sub
 
65
endif
 
66
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 
67
        cp -f /usr/share/misc/config.guess config.guess
 
68
endif
 
69
        mkdir -p $(builddir)
 
70
        cd $(builddir) && \
 
71
                CFLAGS="$(CFLAGS)" $(CURDIR)/configure $($*_CONFIGURE_FLAGS)
 
72
        touch $@
 
73
 
 
74
build: $(addprefix $(STAMP_DIR)/build-stamp-, $(FLAVORS))
 
75
$(STAMP_DIR)/build-stamp-%: $(STAMP_DIR)/configure-stamp-%
 
76
        dh_testdir
 
77
        $(MAKE) -C $(builddir)
 
78
        touch $@
 
79
        cd po; intltool-update -p
 
80
 
 
81
installdir = $(CURDIR)/debian/totem-$*
 
82
 
 
83
install-clean:
 
84
        dh_testdir
 
85
        dh_testroot
 
86
        dh_clean -k
 
87
 
 
88
install-%: $(STAMP_DIR)/build-stamp-%
 
89
        GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 \
 
90
                $(MAKE) -C $(builddir) install DESTDIR=$(installdir)
 
91
        cd $(installdir)/usr/bin && for i in totem*; do \
 
92
                mv $$i totem-$*$${i#totem} ; done
 
93
        cd $(installdir)/$$(pkg-config libnautilus-extension --variable=extensiondir) && \
 
94
                mv libtotem-properties-page.so libtotem-properties-page.so.$*
 
95
        # hide the mozilla plugin in a specific directory
 
96
        cd $(installdir)/usr/lib/mozilla/plugins && \
 
97
                mv *.so $(installdir)/usr/lib/totem/$*/
 
98
        # drop anything else
 
99
        rm -rf $(installdir)/usr/lib/xulrunner
 
100
        # drop *.a and *.la files
 
101
        find debian/totem-$*/usr/lib -mindepth 2 -name '*.a' -exec rm {} \;
 
102
        find debian/totem-$*/usr/lib -name '*.la' -exec rm {} \;
 
103
        echo gnome:Version=$(DEB_GNOME_VERSION) >> debian/totem-$*.substvars
 
104
        echo gnome:NextVersion=$(DEB_GNOME_NEXTVERSION) >> debian/totem-$*.substvars
 
105
 
 
106
TOTEM_XINE_ONLY_MIMES := x-content/video-dvd;x-content/video-vcd;x-content/video-svcd;
 
107
 
 
108
install: install-clean $(addprefix install-, $(FLAVORS))
 
109
        dh_installdirs
 
110
        mkdir -p debian/$(COMPKG)/usr
 
111
        mv debian/totem-gstreamer/etc debian/$(COMPKG)/
 
112
        mv debian/totem-gstreamer/usr/share debian/$(COMPKG)/usr/
 
113
        mkdir -p debian/$(PLUGPKG)/usr/lib/totem
 
114
        mv debian/totem-gstreamer/usr/lib/totem/plugins debian/$(PLUGPKG)/usr/lib/totem/
 
115
        find debian/$(PLUGPKG) -name '*.py[co]' -delete
 
116
        mkdir -p debian/$(PLUGEXTRAPKG)/usr/lib/totem/plugins
 
117
        mv debian/$(PLUGPKG)/usr/lib/totem/plugins/gromit debian/$(PLUGEXTRAPKG)/usr/lib/totem/plugins
 
118
        find debian/$(PLUGEXTRAPKG) -name '*.py[co]' -delete
 
119
        cd debian/totem-xine && rm -rf etc usr/share usr/lib/totem/plugins
 
120
# Make both totems installable together
 
121
        for f in $(FLAVORS); do \
 
122
                F=`echo $$f | sed -r 's/^([a-z])/\U\1/'` ; \
 
123
                mkdir -p debian/totem-$$f/usr/share/applications ; \
 
124
                ( sed -r "s/^Name(.*)$$/Name\1 ($$F)/" \
 
125
                        debian/$(COMPKG)/usr/share/applications/totem.desktop \
 
126
                        | sed -r "s,^(Exec=.*totem),\1-$$f," \
 
127
                        | grep -v ^MimeType ; \
 
128
                        echo NoDisplay=true ) \
 
129
                > debian/totem-$$f/usr/share/applications/totem-$$f.desktop ; \
 
130
                sed -e"s/@FLAVOUR@/$$f/" \
 
131
                    -e"s/@PRIORITY@/$$(eval echo \$$PRIORITY_$$f)/" \
 
132
                    -e"s,@NAUTILUS_EXTDIR@,$$(pkg-config libnautilus-extension --variable=extensiondir)," \
 
133
                < debian/totem-flavor.postinst.in \
 
134
                > debian/totem-$${f}.postinst ; \
 
135
        done
 
136
        printf "\nTryExec=/usr/bin/totem" >> debian/$(COMPKG)/usr/share/applications/totem.desktop
 
137
        
 
138
        # only totem-xine can play DVDs and VCDs satisfactorily (for now)
 
139
        grep -q '^MimeType=.*$(TOTEM_XINE_ONLY_MIMES)' debian/$(COMPKG)/usr/share/applications/totem.desktop
 
140
        sed -i 's,$(TOTEM_XINE_ONLY_MIMES),,' debian/$(COMPKG)/usr/share/applications/totem.desktop
 
141
        printf '\nMimeType=$(TOTEM_XINE_ONLY_MIMES)' >> debian/totem-xine/usr/share/applications/totem-xine.desktop
 
142
        
 
143
        dh_install
 
144
 
 
145
clean::
 
146
        dh_testdir
 
147
        dh_testroot
 
148
        QUILT_PATCHES=$(PATCH_DIR) quilt --quiltrc /dev/null pop -a -R || test $$? = 2
 
149
        rm -f $(foreach f,$(FLAVORS),debian/totem-$(f).postinst)
 
150
        rm -rf .pc
 
151
        rm -rf $(INSTALL_DIR) $(BUILD_DIR) $(STAMP_DIR)
 
152
        -rm -f po/totem.pot config.sub config.guess
 
153
        dh_clean
 
154
 
 
155
binary: binary-arch binary-indep
 
156
 
 
157
# Build architecture-independent files here.
 
158
binary-indep: build install
 
159
        dh_testdir -i
 
160
        dh_testroot -i
 
161
        dh_installdocs -i -A NEWS README
 
162
        dh_installchangelogs -i ChangeLog
 
163
        dh_installman -i
 
164
        dh_scrollkeeper -i
 
165
        dh_gconf -i
 
166
        dh_desktop -i
 
167
        dh_icons -i
 
168
        dh_compress -i
 
169
        dh_link -i
 
170
        dh_fixperms -i
 
171
        : # symlink identical Gnome help files within packages
 
172
        for p in $$(dh_listpackages -i); do \
 
173
          if [ -d debian/$$p/usr/share/gnome/help ]; then \
 
174
            (cd debian/$$p && LC_ALL=C fdupes -r1nq usr/share/gnome/help \
 
175
            | while read s; do \
 
176
                set -- $$(echo $$s | tr ' ' '\n' | sort); \
 
177
                f=$$1; shift; \
 
178
                for d; do \
 
179
                  echo "symlinking duplicate Gnome help file $$d to $$f"; \
 
180
                  rm $$d; ln -s /$$f $$d; \
 
181
                done; \
 
182
              done; \
 
183
            ); \
 
184
          dh_link -p$$p; \
 
185
          fi; \
 
186
        done
 
187
        dh_pysupport -i
 
188
        dh_installdeb -i
 
189
        dh_gencontrol -i
 
190
        dh_md5sums -i
 
191
        dh_builddeb -i
 
192
 
 
193
# Build architecture-dependent files here.
 
194
binary-arch: build install
 
195
        dh_testdir -a
 
196
        dh_testroot -a
 
197
        dh_installdocs -a -A NEWS README
 
198
        dh_installmenu -a
 
199
        dh_installchangelogs -a ChangeLog
 
200
        dh_desktop -a
 
201
        dh_icons -a
 
202
        dh_compress -a
 
203
        dh_link -a
 
204
        : # symlink identical Gnome help files within packages
 
205
        for p in $$(dh_listpackages -a); do \
 
206
          if [ -d debian/$$p/usr/share/gnome/help ]; then \
 
207
            (cd debian/$$p && LC_ALL=C fdupes -r1nq usr/share/gnome/help \
 
208
            | while read s; do \
 
209
                set -- $$(echo $$s | tr ' ' '\n' | sort); \
 
210
                f=$$1; shift; \
 
211
                for d; do \
 
212
                  echo "symlinking duplicate Gnome help file $$d to $$f"; \
 
213
                  rm $$d; ln -s /$$f $$d; \
 
214
                done; \
 
215
              done; \
 
216
            ); \
 
217
          dh_link -p$$p; \
 
218
          fi; \
 
219
        done
 
220
        dh_fixperms -a
 
221
        dh_strip -a --dbg-package=totem-dbg
 
222
        dh_shlibdeps -a
 
223
        dh_perl -a
 
224
        dh_pysupport -a /usr/lib/totem/plugins/totem \
 
225
                /usr/lib/totem/plugins/bbc \
 
226
                /usr/lib/totem/plugins/pythonconsole \
 
227
                /usr/lib/totem/plugins/youtube
 
228
        dh_installdeb -a
 
229
        dh_gencontrol -a
 
230
        dh_md5sums -a
 
231
        dh_builddeb -a
 
232
 
 
233
.PHONY: patch configure build install clean install-clean binary-indep binary-arch binary