~dns/gnash/debian

« back to all changes in this revision

Viewing changes to rules

  • Committer: DNS
  • Date: 2012-02-07 06:12:43 UTC
  • Revision ID: dns@rbose.org-20120207061243-x0zks7m6b958yxfp
* moved files in this branch to the root dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/make -f
 
2
# The template for this file was originally written by Joey Hess and
 
3
# Craig Small. Then further work was done by Miriam Ruiz for Debian, and
 
4
# Alexander Sack for Ubuntu.
 
5
# Many more modifications were made by Rob Savoye for Gnash and Petter
 
6
# Reinholdtsen for Debian Edu.
 
7
 
 
8
# Uncomment this to turn on verbose mode.
 
9
# export DH_VERBOSE=1
 
10
 
 
11
# These are used for cross-compiling and for saving the configure script
 
12
# from having to guess our platform (since we know it already)
 
13
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
14
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
15
 
 
16
SNAPSHOT_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
 
17
MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g' | cut -d '.' -f 1-3)
 
18
BUILD_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g' | cut -d '.' -f 4)
 
19
 
 
20
INFILES := $(wildcard debian/*.desktop.in)
 
21
OUTFILES := $(INFILES:.desktop.in=.desktop)
 
22
 
 
23
%.desktop: %.desktop.in
 
24
        intltool-merge -d debian/po $< $@
 
25
 
 
26
# Set defaults for the compiler and linker flags
 
27
CFLAGS = -Wall -g -Werror-implicit-function-declaration
 
28
 
 
29
# Look for the standard build options
 
30
 
 
31
# Sometimes we want to build without optimization, usually only when
 
32
# testing package building.
 
33
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 
34
        CFLAGS += -O0
 
35
else
 
36
        CFLAGS += -O2
 
37
endif
 
38
 
 
39
# Enable debugging in the package instead of using the debug package
 
40
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
 
41
        CFLAGS += -g
 
42
endif
 
43
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 
44
        INSTALL_PROGRAM += -s
 
45
endif
 
46
 
 
47
# Do parallel builds, ie.. the -jN option to make
 
48
ifneq (,$(findstring parallel=,$(DEB_BUILD_OPTIONS)))
 
49
        NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 
50
        MAKEFLAGS += -j$(NUMJOBS)
 
51
endif
 
52
 
 
53
DEB_DH_SHLIBDEPS_ARGS_ALL := -X* /usr/lib/gnash
 
54
 
 
55
patch: patch-stamp
 
56
patch-stamp:
 
57
        dh_testdir
 
58
        printf "\n == APPLYING PATCHES == \n\n"
 
59
        "we have no patches, we're the developers!"
 
60
#       $(MAKE) -f /usr/share/quilt/quilt.make patch
 
61
        printf "\n ---- End of APPLYING PATCHES ---- \n\n"
 
62
        touch $@
 
63
 
 
64
# CONFIGURE
 
65
 
 
66
# Handle optional configurarions
 
67
 
 
68
# These flags are the defaults Gnash uses when configuring, but we pass
 
69
# them here explicitly because it makes it easier for non Gnash developers
 
70
# to know what those defaults are.
 
71
BUILD_FLAGS = --enable-jemalloc
 
72
 
 
73
# this is where all the objects and executables go. We have to
 
74
# redfine this, instead of just appending the path elements, as
 
75
# make insists on putting a space between each element, which
 
76
# produces a path that doens't work.
 
77
BUILD_DIRECTORY = _build
 
78
 
 
79
# Optionally build an OpenGL enabled package, AGG is the default
 
80
ifneq (,$(findstring ogl,$(DEB_BUILD_OPTIONS)))
 
81
        BUILD_FLAGS += --enable-renderer=ogl
 
82
        BUILD_DIRECTORY = _build.ogl
 
83
        BUILD_DEBUG = -opengl
 
84
        BUILD_VERSION = $(MAIN_VERSION).ogl.$(BUILD_VERSION)
 
85
endif
 
86
 
 
87
# Optionally build an ffmpeg enabled package, Gstreamer is the default
 
88
ifneq (,$(findstring ffmpeg,$(DEB_BUILD_OPTIONS)))
 
89
        BUILD_FLAGS += --enable-media=ffmpeg
 
90
        BUILD_VERSION = $(MAIN_VERSION).ffmpeg.$(BUILD_VERSION)
 
91
ifneq (,$(findstring ogl,$(DEB_BUILD_OPTIONS)))
 
92
        BUILD_DIRECTORY = _build.ogl.ffmpeg
 
93
        BUILD_VERSION = $(MAIN_VERSION).ogl.ffmpeg.$(BUILD_VERSION)
 
94
        BUILD_DEBUG = -opengl-ffmpeg
 
95
else
 
96
        BUILD_DIRECTORY = _build.ffmpeg
 
97
        BUILD_DEBUG = -ffmpeg
 
98
endif
 
99
else
 
100
        BUILD_FLAGS += --enable-media=gst,ffmpeg
 
101
endif
 
102
 
 
103
# Optionally build the older kde3 package, Qt4 is the default
 
104
ifneq (,$(findstring kde3,$(DEB_BUILD_OPTIONS)))
 
105
        BUILD_FLAGS += --enable-gui=gtk,kde3
 
106
        BUILD_VERSION = $(MAIN_VERSION).kde3.$(BUILD_VERSION)
 
107
ifneq (,$(findstring ogl,$(DEB_BUILD_OPTIONS)))
 
108
        BUILD_DIRECTORY = _build.ogl.kde3
 
109
        BUILD_VERSION = $(MAIN_VERSION).ogl.kde3.$(BUILD_VERSION)
 
110
        BUILD_DEBUG = -opengl-kde3
 
111
else
 
112
        BUILD_DIRECTORY = _build.kde3
 
113
        BUILD_DEBUG = -kde3
 
114
endif
 
115
else
 
116
        BUILD_FLAGS += --enable-gui=gtk,qt4
 
117
endif
 
118
 
 
119
# Configure Gnash. We use a different set of options, as when building
 
120
# packages, we want to enable everything that Gnash can do, like
 
121
# python support, the SDK cygnal, etc... These are not enabled by
 
122
# default to make it less complicated for end users building Gnash
 
123
# from source.
 
124
# for now, only build the qt4 support, as kde3 is being depreciated.
 
125
CONFIGURE_FLAGS = CFLAGS="$(CFLAGS)" \
 
126
        CXXFLAGS="$(CXXFLAGS)" \
 
127
        --host=$(DEB_HOST_GNU_TYPE) \
 
128
        --build=$(DEB_BUILD_GNU_TYPE) \
 
129
        --prefix=/usr \
 
130
        --sysconfdir=/etc \
 
131
        --mandir=/usr/share/man \
 
132
        --infodir=/usr/share/info \
 
133
        --with-plugins-install=system \
 
134
        --disable-dependency-tracking \
 
135
        --disable-testsuite \
 
136
        --disable-rpath \
 
137
        --enable-docbook \
 
138
        --enable-cygnal \
 
139
        --enable-device=egl,x11 \
 
140
        --enable-renderer=agg,cairo,opengl \
 
141
        --enable-extensions=fileio,lirc,mysql \
 
142
        $(BUILD_FLAGS)
 
143
 
 
144
config: config-stamp
 
145
config-stamp: patch-stamp
 
146
        dh_testdir
 
147
 
 
148
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
 
149
        cp -f /usr/share/misc/config.sub config.sub
 
150
endif
 
151
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 
152
        cp -f /usr/share/misc/config.guess config.guess
 
153
endif
 
154
 
 
155
#       Only run autogen.sh if there isn't a configure script. When
 
156
#       building packages from within a configured build directory. In
 
157
#       a freshly checked out source tree from bzr, there is no
 
158
#       configure script. When building from a source tarball as made
 
159
#       by 'make dist', then all the configure scripts are already
 
160
#       included.
 
161
        if test ! -e configure; then \
 
162
          printf "\n == AUTOGEN == \n\n"; \
 
163
          $(CURDIR)/autogen.sh; \
 
164
          printf "\n ---- End of AUTOGEN ---- \n\n"; \
 
165
        fi
 
166
 
 
167
#       Make a sub-directory to build all the objects and executables in.
 
168
        if test ! -d $(BUILD_DIRECTORY); then \
 
169
          mkdir $(BUILD_DIRECTORY); \
 
170
        fi
 
171
 
 
172
#       Configure that build subdirectory.
 
173
        printf "\n == CONFIGURE == \n\n"
 
174
        cd $(BUILD_DIRECTORY) && $(CURDIR)/configure $(CONFIGURE_FLAGS);
 
175
        printf "\n ---- End of CONFIGURE ---- \n\n"
 
176
 
 
177
        touch $@
 
178
 
 
179
# BUILD
 
180
 
 
181
# We don't run make check, as the testsuite takes a long time to build
 
182
# and run, and we just want a package. This of course requires the
 
183
# package builder to run make check before building packages if the
 
184
# state is unknown.
 
185
build: build-stamp
 
186
build-stamp: config-stamp $(OUTFILES)
 
187
        dh_testdir
 
188
 
 
189
        @printf "\n == MAKE == \n\n"
 
190
        $(MAKE) -C $(BUILD_DIRECTORY) LDFLAGS="$(LDFLAGS)"
 
191
        @printf "\n ---- End of MAKE ---- \n\n"
 
192
        cp cygnal/libamf/README README.amf
 
193
        cp cygnal/README README.cygnal
 
194
#       @printf "\n == CHECK ==\n\n"
 
195
#       $(MAKE) -C $(BUILD_DIRECTORY) check
 
196
#       @printf "\n ---- End of CHECK ---- \n\n"
 
197
 
 
198
        touch $@
 
199
 
 
200
# CLEAN
 
201
 
 
202
# Remove anything that could be left from a previous build. Basically
 
203
# all temporary files or generated files. We also clean out the
 
204
# manpages, as these are the preformatted ones from the tarball, so
 
205
# they don't get rebuild by docbook unless we remove them.
 
206
clean:
 
207
        dh_testdir
 
208
        dh_testroot
 
209
        rm -f build-stamp
 
210
        rm -f $(OUTFILES)
 
211
        rm -f README.amf README.cygnal
 
212
        if test -d debian/po; then \
 
213
          ls $(INFILES) | sed 's#^#../#' > debian/po/POTFILES.in; \
 
214
          cd debian/po && intltool-update -g debian --pot && \
 
215
                for i in *.po; do intltool-update -g debian --dist $${i%.po}; done; \
 
216
          rm -f debian/po/POTFILES.in; \
 
217
        fi
 
218
        rm -fr $(BUILD_DIRECTORY)
 
219
 
 
220
        @printf "\n == CLEANING PATCHES ==\n\n"
 
221
        echo " we have no patches, we're the developers!"
 
222
#       $(MAKE) -f /usr/share/quilt/quilt.make unpatch
 
223
        @printf "\n ---- End of CLEANING PATCHES ---- \n\n"
 
224
 
 
225
        dh_clean 
 
226
 
 
227
# INSTALL
 
228
 
 
229
# Install gnash. This also builds the SDK, which isn't directly
 
230
# supported by the gnash Makefiles. We also have to compress the two
 
231
# man pages aliases, which don't get compressed as they're not part of
 
232
# the standard make target. These get generated when building gnash.1,
 
233
# and of course have no associated source file.
 
234
install: build
 
235
        dh_testdir
 
236
        dh_testroot
 
237
#       dh_clean -k 
 
238
        dh_installdirs
 
239
 
 
240
        @printf "\n == INSTALL ==\n\n"
 
241
        $(MAKE) -C $(BUILD_DIRECTORY) install DESTDIR=$(CURDIR)/debian/tmp
 
242
        $(MAKE) -C $(BUILD_DIRECTORY) install-plugins DESTDIR=$(CURDIR)/debian/tmp
 
243
        @printf "\n ---- End of INSTALL ---- \n\n"
 
244
 
 
245
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libbase/
 
246
        cp libbase/*.h $(CURDIR)/debian/tmp/usr/include/gnash/libbase/
 
247
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libnet/
 
248
        cp libbase/*.h $(CURDIR)/debian/tmp/usr/include/gnash/libnet/
 
249
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libamf/
 
250
        cp cygnal/libamf/*.h $(CURDIR)/debian/tmp/usr/include/gnash/libamf/
 
251
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libcore/
 
252
        cp cygnal/libnet/*.h $(CURDIR)/debian/tmp/usr/include/gnash/libnet/
 
253
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libcore/
 
254
        cp libcore/*.h $(CURDIR)/debian/tmp/usr/include/gnash/libcore/
 
255
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libmedia/
 
256
        cp libmedia/*.h $(CURDIR)/debian/tmp/usr/include/gnash/libmedia/
 
257
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/librender/
 
258
        cp librender/*.h $(CURDIR)/debian/tmp/usr/include/gnash/librender/
 
259
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/gui/
 
260
        cp gui/*.h $(CURDIR)/debian/tmp/usr/include/gnash/gui/
 
261
 
 
262
        install -d $(CURDIR)/debian/tmp/usr/share/pixmaps/
 
263
        cp packaging/*.xpm $(CURDIR)/debian/tmp/usr/share/pixmaps/
 
264
        install -d $(CURDIR)/debian/tmp/usr/share/applications/
 
265
        cp debian/*.desktop $(CURDIR)/debian/tmp/usr/share/applications/
 
266
        #gzip -f9 $(CURDIR)/debian/tmp/usr/share/man/man1/gtk-gnash.1
 
267
        #gzip -f9 $(CURDIR)/debian/tmp/usr/share/man/man1/qt4-gnash.1
 
268
 
 
269
# CREATE PACKAGES
 
270
 
 
271
# Build architecture-independent files here.
 
272
binary-indep: install
 
273
        dh_install -i --sourcedir=$(CURDIR)/debian/tmp
 
274
 
 
275
# Build architecture-dependent files here.
 
276
binary-arch: install
 
277
        dh_testdir
 
278
        dh_testroot
 
279
        dh_installchangelogs -XChangeLog
 
280
        dh_installdocs
 
281
        dh_installexamples
 
282
        dh_install -a --list-missing --sourcedir=$(CURDIR)/debian/tmp
 
283
#       dh_installmenu
 
284
#       dh_installmime
 
285
        dh_installman
 
286
        dh_desktop
 
287
        dh_lintian
 
288
        dh_link
 
289
        dh_strip --dbg-package=gnash-dbg$(BUILD_DEBUG)
 
290
        dh_compress
 
291
        dh_fixperms
 
292
        dh_makeshlibs
 
293
        [ ! -e /usr/bin/dh_buildinfo ] || dh_buildinfo
 
294
        dh_installdeb
 
295
        export LD_LIBRARY_PATH="$(CURDIR)/debian/gnash-common-opengl/usr/lib/gnash:$$LD_LIBRARY_PATH" ; \
 
296
                dh_shlibdeps -Lgnash-common-opengl \
 
297
                -pgnash-common-opengl \
 
298
                -- -Ldebian/shlibs-opengl.local $(shell dpkg-shlibdeps --help | sed -ne "s/.*\(--ignore-missing-info\).*/\1/p")
 
299
        export LD_LIBRARY_PATH="$(CURDIR)/debian/gnash-common-opengl/usr/lib/gnash:$$LD_LIBRARY_PATH" ; \
 
300
                dh_shlibdeps -Lgnash-common-opengl \
 
301
                -pgnash-opengl -pklash-opengl \
 
302
                -- -Ldebian/shlibs-opengl.local
 
303
        export LD_LIBRARY_PATH="$(CURDIR)/debian/gnash-common/usr/lib/gnash:$$LD_LIBRARY_PATH" ; \
 
304
                dh_shlibdeps -Lgnash-common \
 
305
                -pgnash-common \
 
306
                -- -Ldebian/shlibs-agg.local $(shell dpkg-shlibdeps --help | sed -ne "s/.*\(--ignore-missing-info\).*/\1/p")
 
307
        export LD_LIBRARY_PATH="$(CURDIR)/debian/gnash-common/usr/lib/gnash:$$LD_LIBRARY_PATH" ; \
 
308
                dh_shlibdeps -Lgnash-common \
 
309
                -pgnash -pklash \
 
310
                -- -Ldebian/shlibs-agg.local
 
311
        export LD_LIBRARY_PATH="$(CURDIR)/debian/gnash-common/usr/lib/gnash:$$LD_LIBRARY_PATH" ; \
 
312
                dh_shlibdeps -Lgnash-common \
 
313
                -pmozilla-plugin-gnash -pkonqueror-plugin-gnash -pgnash-tools -pgnash-cygnal \
 
314
                -- -Ldebian/shlibs-both.local
 
315
        dh_gencontrol
 
316
        dh_md5sums
 
317
        dh_builddeb
 
318
 
 
319
VERSION_DATE = $(shell /bin/date --utc +%0Y%0m%0d.%0k%0M)
 
320
BRANCH_NICK   = `grep "NICK" $(CURDIR)/revno.h | cut -d '"' -f 2`
 
321
BRANCH_REVNO  = `grep "REVNO" $(CURDIR)/revno.h | cut -d '"' -f 2`
 
322
#VERSION_ID = 0.8.10+bzr.trunk$(VERSION_DATE)
 
323
VERSION_ID = 0.8.10+git.$(BRANCH_NICK)$(BRANCH_REVNO)
 
324
get-git-source:
 
325
        echo Downloading gnash $(VERSION_ID) from git...
 
326
        git clone git://git.sv.gnu.org/gnash.git
 
327
#       cd gnash; rm -rf `find . -name .git`
 
328
        tar cvfz "gnash_$(VERSION_ID).orig.tar.gz" gnash
 
329
        mv gnash "gnash-$(VERSION_ID)"
 
330
        cp debian "gnash-$(VERSION_ID)" -a
 
331
        cd "gnash-$(VERSION_ID)"; dch -v "$(VERSION_ID)-1" "New Upstream Release. Downloaded from Git."
 
332
 
 
333
binary: binary-indep binary-arch
 
334
.PHONY: config build clean binary-indep binary-arch binary install get-git-source patch