File: rules

package info (click to toggle)
ffmpeg 0.cvs20060823-8
  • links: PTS, VCS
  • area: main
  • in suites: etch-m68k
  • size: 11,716 kB
  • ctags: 18,201
  • sloc: ansic: 231,024; sh: 2,496; asm: 1,471; makefile: 1,033; cpp: 382; perl: 306
file content (187 lines) | stat: -rwxr-xr-x 6,327 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/make -f

#export DH_VERBOSE=1
export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

confflags += --enable-gpl --enable-pp --enable-pthreads
confflags += --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm

DEB_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: //p')

ifneq (,$(findstring linux,$(DEB_HOST_GNU_TYPE)))
  confflags += --enable-dc1394
  lib1394-dev = libraw1394-dev, libdc1394-13-dev
  FIREWIRELIBS="-lraw1394 -ldc1394_control"
else
  lib1394-dev =
  FIREWIRELIBS=""
endif

ifeq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  confflags += --disable-debug
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  # This hack is necessary because GCC won't build fdct_mmx.c with -O0
  confflags += --extra-cflags="-O1"
endif
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  confflags += --disable-strip
endif

ifneq (,$(findstring risky,$(DEB_BUILD_OPTIONS)))
weak-build-deps += liblame-dev
confflags += --enable-mp3lame
weak-build-deps += libfaad2-dev
confflags += --enable-faadbin --enable-faad
weak-build-deps += libfaac-dev
confflags += --enable-faac
weak-build-deps += libxvidcore-dev
confflags += --enable-xvid
$(warning Make sure these packages are installed: $(weak-build-deps))
endif

build: build-stamp
build-stamp:
	dh_testdir
	QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
	
	# Build static libraries
	./configure $(confflags) --disable-ffmpeg --disable-ffserver --disable-ffplay --prefix=/usr
	cd doc && $(MAKE)
	$(MAKE)
	
	# Backup static libraries
	mv libavutil/libavutil.a libavutil/libavutil.a.bak
	mv libpostproc/libpostproc.a libpostproc/libpostproc.a.bak
	mv libavcodec/libavcodec.a libavcodec/libavcodec.a.bak
	mv libavformat/libavformat.a libavformat/libavformat.a.bak
	
	# Build ffmpeg and shared libraries
	./configure $(confflags) --enable-shared --prefix=/usr
	
	sed 's/ldts/ldts_pic/' <config.mak >config.mak.pic
	
	cd libavutil && \
	  $(MAKE) clean && \
	  rm -f Makefile.pic && \
	  sed 's/^CFLAGS *=/&-fPIC -DPIC /; s/config.mak/config.mak.pic/' <Makefile >Makefile.pic && \
	  $(MAKE) -f Makefile.pic && \
	  rm -f Makefile.pic
	
	cd libavcodec && \
	  $(MAKE) clean && \
	  rm -f Makefile.pic && \
	  sed 's/^CFLAGS *=/&-fPIC -DPIC /; s/config.mak/config.mak.pic/' <Makefile >Makefile.pic && \
	  $(MAKE) -f Makefile.pic && \
	  rm -f Makefile.pic
	
	cd libpostproc && \
	  $(MAKE) clean && \
	  rm -f Makefile.pic && \
	  sed 's/^CFLAGS *=/&-fPIC -DPIC /; s/config.mak/config.mak.pic/' <Makefile >Makefile.pic && \
	  $(MAKE) -f Makefile.pic && \
	  rm -f Makefile.pic
	
	cd libavformat && \
	  $(MAKE) clean && \
	  rm -f Makefile.pic && \
	  sed 's/^CFLAGS *=/&-fPIC -DPIC /; s/config.mak/config.mak.pic/' <Makefile >Makefile.pic && \
	  $(MAKE) -f Makefile.pic && \
	  rm -f Makefile.pic
	
	rm -f config.mak.pic
	
	# Restore static libraries
	mv libavutil/libavutil.a.bak libavutil/libavutil.a
	mv libpostproc/libpostproc.a.bak libpostproc/libpostproc.a
	mv libavcodec/libavcodec.a.bak libavcodec/libavcodec.a
	mv libavformat/libavformat.a.bak libavformat/libavformat.a
	
	# Fix timestamps
	touch libavutil/libavutil.a libpostproc/libpostproc.a
	touch libavcodec/libavcodec.a libavformat/libavformat.a
	touch ffmpeg ffmpeg_g ffplay ffplay_g
	
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	-cd tests && $(MAKE)
endif
	
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	-cd doc && $(MAKE) clean
	-cd tests && $(MAKE) clean
	-$(MAKE) distclean
	QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2
	rm -f libavutil/Makefile.pic libavformat/Makefile.pic config.log
	rm -f libpostproc/Makefile.pic libavformat/Makefile.pic
	rm -f libavutil/libavutil.a.bak
	rm -f libpostproc/libpostproc.a.bak
	rm -f libavcodec/libavcodec.a.bak
	rm -f libavformat/libavformat.a.bak
	rm -f libavcodec-uninstalled.pc libavcodec.pc
	rm -f libavutil-uninstalled.pc libavutil.pc
	rm -f libavformat-uninstalled.pc libavformat.pc
	rm -f libpostproc-uninstalled.pc libpostproc.pc
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs -ptmp usr/share/doc/ffmpeg/html etc usr/include/ffmpeg usr/lib usr/bin usr/share/man/man1 usr/include/postproc
	
	$(MAKE) install DESTDIR=`pwd`/debian/tmp/ mandir=`pwd`/debian/tmp/usr/share/man
	rm -f debian/tmp/usr/include/ffmpeg/swscale.h # unused yet
	cp libavcodec/dsputil.h debian/tmp/usr/include/ffmpeg
	cp libpostproc/libpostproc.a debian/tmp/usr/lib
	cp libpostproc/postprocess.h debian/tmp/usr/include/postproc
	cp libpostproc.pc debian/tmp/usr/lib/pkgconfig/
	
	dh_install -ptmp libavutil/libavutil.so* libavcodec/libavcodec.so* libpostproc/libpostproc.so* libavformat/libavformat.so* /usr/lib
	
	cp doc/*.html debian/tmp/usr/share/doc/ffmpeg/html/
	cp doc/ffserver.conf debian/tmp/etc/
	
	sed -e s/@FIREWIRELIBS@/$(FIREWIRELIBS)/ -e s/@VERSION@/$(DEB_VERSION)/ ffmpeg-config.in > debian/tmp/usr/bin/ffmpeg-config
	chmod 644 debian/tmp/usr/bin/ffmpeg-config
	cp ffmpeg-config.1 debian/tmp/usr/share/man/man1/ffmpeg-config.1
	
	dh_install --fail-missing --sourcedir=debian/tmp

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs doc/ffmpeg_powerpc_performance_evaluation_howto.txt doc/optimization.txt
	dh_installdocs -A CREDITS doc/TODO debian/patents.txt debian/README.Debian
	dh_installexamples -pffmpeg doc/ffserver.conf
	dh_installexamples -plibavcodec-dev libavcodec/apiexample.c
	dh_installmenu
	dh_installcron
	dh_installinfo
	dh_installmime
	dh_installchangelogs Changelog
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs -p libavcodec0d -V 'libavcodec0d (>= 0.cvs20060823)'
	dh_makeshlibs -p libavformat0d -V 'libavformat0d (>= 0.cvs20060823)'
	dh_makeshlibs -p libpostproc0d -V 'libpostproc0d (>= 0.cvs20060823)'
	dh_installdeb
	dh_shlibdeps -L libavcodec0d -L libpostproc0d -L libavformat0d -l debian/libavcodec0d/usr/lib:debian/libavformat0d/usr/lib:debian/libpostproc0d/usr/lib
	dh_gencontrol -- -Vlib1394-dev="$(lib1394-dev)"
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install