~medibuntu-maintainers/mplayer/medibuntu.lucid

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
188
189
190
191
192
193
194
#!/usr/bin/make -f

include /usr/share/quilt/quilt.make

# This has to be exported to make some magic below work.
export DH_OPTIONS

# do not run the actual rules of this makefile in parallel. sub-makes
# can go in parallel
.NOTPARALLEL:

############

DEB_SOURCE := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
DEB_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed -r 's/[^:]+://; s/-[^-]+$$//')
SVN_VERSION := $(shell echo $(UPSTREAM_VERSION) | sed -nr 's/^[0-9.:-~]+svn([0-9]+)$$/\1/p')


#UPSTREAMSOURCE := upstream SVN repository
UPSTREAMSOURCE := http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS    ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_ARCH_CPU   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)


# XXX enable-menu is frowned upon by upstream
DEB_BUILD_CONFIGURE = \
	--prefix=/usr \
	--confdir=/etc/mplayer \
	--enable-xvmc \
	--enable-menu \
	--enable-largefiles \
	--language=all \
	--disable-libdvdcss-internal \
	--disable-dvdread-internal \
	--disable-libavutil_a \
	--disable-libavcodec_a \
	--disable-libavformat_a \
	--disable-libpostproc_a \
	--disable-libswscale_a \
	$(archconf)

ifeq ($(DEB_HOST_ARCH),i386)
#configure optimizes for the cpu detected at ./configure time
#in order to build a generic binary, avoid non-standard opcodes through gcc
  archconf += --target=i586-linux
  DEB_BUILD_CONFIGURE += --enable-runtime-cpudetection
endif
ifeq ($(DEB_HOST_ARCH),amd64)
  DEB_BUILD_CONFIGURE += --enable-runtime-cpudetection
endif
ifeq ($(DEB_HOST_ARCH),kfreebsd-i386)
  DEB_BUILD_CONFIGURE += --enable-runtime-cpudetection
endif
ifeq ($(DEB_HOST_ARCH),kfreebsd-amd64)
  DEB_BUILD_CONFIGURE += --enable-runtime-cpudetection
endif
ifeq ($(DEB_HOST_ARCH),powerpc)
  DEB_BUILD_CONFIGURE += --enable-runtime-cpudetection
endif
ifeq ($(DEB_HOST_ARCH),alpha)
#Avoid high optimization through gcc.
# see http://permalink.gmane.org/gmane.linux.debian.ports.alpha/7295
  archconf += --target=alpha_ev5-linux
endif

# generate debugging symbols for mplayer-dbg for all archs but mipsen,
# see bug #520113
ifeq (,$(findstring mips,$(DEB_HOST_ARCH)))
DEB_BUILD_CONFIGURE += --enable-debug
endif


ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
         NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
         MAKEFLAGS += -j$(NUMJOBS)
endif


ifeq (linux,$(DEB_HOST_ARCH_OS))
    DEB_BUILD_CONFIGURE += --enable-mga --enable-3dfx --enable-tdfxfb
endif

####### build-arch


# See http://wiki.debian.org/Teams/Dpkg/DebianRules; #465282  and
# https://wiki.ubuntu.com/DistCompilerFlags
CLEAN_ENV=env -u CFLAGS -u CPPFLAGS -u LDFLAGS -u FFLAGS -u CXXFLAGS


install-arch: $(QUILT_STAMPFN)
	dh_testdir
	dh_prep -a
	[ ! -f config.mak ] || $(MAKE) distclean
	echo "$(UPSTREAM_VERSION)" > snapshot_version
	$(CLEAN_ENV) \
	./configure $(COMMON_CONFIGURE_FLAGS) $(DEB_BUILD_CONFIGURE) --disable-gui
	$(CLEAN_ENV) \
	$(MAKE)
	# build non-gui version
	$(MAKE) install-mplayer DESTDIR=$(CURDIR)/debian/mplayer
	$(MAKE) install-mplayer-man DESTDIR=$(CURDIR)/debian/mplayer
	$(MAKE) install-mencoder-man DESTDIR=$(CURDIR)/debian/mplayer
	install -D -m 644 debian/mplayer.conf \
	                  $(CURDIR)/debian/mplayer/etc/mplayer/mplayer.conf
	install -D -m 644 debian/apport-hook.py \
	                  $(CURDIR)/debian/mplayer/usr/share/apport/package-hooks/source_mplayer.py
	#install mencoder
	$(MAKE) install-mencoder DESTDIR=$(CURDIR)/debian/mencoder
	# build gui version
	[ ! -f config.mak ] || $(MAKE) distclean
	$(CLEAN_ENV) \
	./configure $(COMMON_CONFIGURE_FLAGS) $(DEB_BUILD_CONFIGURE) --enable-gui
	$(CLEAN_ENV) \
	$(MAKE)
	install -D -m 755 mplayer $(CURDIR)/debian/mplayer-gui/usr/bin/gmplayer
	install -D -m 644 etc/mplayer.desktop \
	                  $(CURDIR)/debian/mplayer-gui/usr/share/applications/mplayer.desktop
	install -D -m 644 etc/mplayer.xpm \
	                  $(CURDIR)/debian/mplayer-gui/usr/share/pixmaps/mplayer.xpm

###### build-indep

# commands to compile the documentation
install-indep: install-indep-stamp
install-indep-stamp:
	dh_testdir
	sh debian/all-lang-config-mak.sh > config.mak
	cd DOCS/xml && ./configure
	$(MAKE) -C DOCS/xml html-chunked
	dh_installchangelogs -i
	dh_installdocs -i
	dh_compress -i
	dh_fixperms -i
	touch $@

################ clean

clean: clean-real unpatch
clean-real:
	dh_testdir
	dh_testroot
	[ ! -f config.mak ] || $(MAKE) -C DOCS/xml distclean || true
	[ ! -f config.mak ] || $(MAKE) distclean
	dh_clean build-arch-stamp configure-arch-stamp snapshot_version

# Build architecture-independent packages
binary-indep: install-indep

# Build architecture-dependent packages
binary-arch: install-arch
	dh_testdir
	dh_testroot
	dh_install -a
	dh_installchangelogs -a
	dh_installdocs -a
	dh_installexamples -a
	dh_installmenu -a
	dh_installmime -a
	dh_installman -a
	dh_strip -a --dbg-package=mplayer-dbg
	dh_link
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

###############################################
##These targets generate the DFSG-free tar.gz.
## They are not automatically invoked.

get-orig-source:
	dh_testdir
	# strip patented code
	chmod +x debian/strip.sh
	sh debian/get-orig-source.sh -d $(SVN_VERSION)

PHONY += build clean binary-indep binary-arch binary-common binary 
PHONY += install binary binary-arch binary-indep clean checkroot get-orig-source
PHONY += autocontrol fix-orig-source copy-orig-from-svn download-and-unpack-orig
PHONY += build-gui build-nogui install-gui install-nogui

.PHONY: $(PHONY)