~ubuntu-branches/ubuntu/lucid/freetype/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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/usr/bin/make -f
#
# This is free software; see the GNU General Public Licence
# version 2 or later for copying conditions.  There is NO warranty.

SHELL = /bin/bash

# FreeType sets its -Wall in XX_CFLAGS 
CFLAGS = -g -Werror

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2 -fno-strict-aliasing
endif

UPACKAGE = $(shell dh_listpackages | grep -- -udeb$$)
VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

# always abort if there are any problems with the symbols file
DPKG_GENSYMBOLS_CHECK_LEVEL = 4
export DPKG_GENSYMBOLS_CHECK_LEVEL

srcpkg = freetype2

ver := $(shell dpkg-parsechangelog | sed -n -e's/^Version: \(.*\)-[^-]\+/\1/p')

freetype_ver := $(ver)
ftdocs_ver   := $(ver)
ft2demos_ver := $(ver)
dependency = $(libpkg) (>= 2.3.9)

freetype_u := freetype-$(freetype_ver)
ftdocs_u   := freetype-doc-$(ftdocs_ver)
ftdocs_d   := $(freetype_u)
ft2demos_u := ft2demos-$(ft2demos_ver)

libpkg := libfreetype6
devpkg := $(libpkg)-dev
docpkg := $(libpkg)-doc
demospkg := freetype2-demos
udebpkg := libfreetype6-udeb
docdir := usr/share/doc
patchdir := $(CURDIR)/debian/patches
freetype_config_man := $(CURDIR)/debian/freetype-config.man
freetype_config_sgml := $(CURDIR)/debian/freetype-config.man.sgml

# These files are general documentation and should go into the lib package.
libdoc = FTL.TXT CHANGES PATENTS TODO

TMP = $(CURDIR)/debian/tmp

unpack: unpack-stamp
unpack-stamp:
	# Unpack upstream tarballs
	@for i in $(freetype_u) $(ftdocs_u) $(ft2demos_u); do \
	    if [ -f $$i.tar.bz2 ]; then \
		echo "Unpacking $$i.tar.bz2 ..."; \
		tar -x --bzip2 -f $$i.tar.bz2; \
	    elif [ -f $$i.tar.gz ]; then \
		echo "Unpacking $$i.tar.gz ..."; \
		tar -x --gzip -f $$i.tar.gz; \
	    else \
		echo "Error!  $$i.tar.{bz2,gz} not found!"; \
		exit 1; \
	    fi \
	done
	touch unpack-stamp

patch: unpack patch-stamp
patch-stamp:
	cd $(freetype_u) \
	    && QUILT_PATCHES=../debian/patches-freetype quilt push -a
	cd $(ft2demos_u) \
	    && QUILT_PATCHES=../debian/patches-ft2demos quilt push -a
	touch patch-stamp

build: unpack patch build-stamp
build-stamp:
	dh_testdir
	cd $(freetype_u) && ./configure --prefix=/usr CFLAGS="$(CFLAGS)"
#	cd $(freetype_u) && ./configure --prefix=/usr
	$(MAKE) -C $(freetype_u)

	$(MAKE) -C $(ft2demos_u) TOP_DIR=../$(freetype_u) \
		X11_PATH=/usr/X11R6 OBJ_DIR=../$(freetype_u)/objs


	docbook-to-man $(freetype_config_sgml) > $(freetype_config_man)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp unpack-stamp patch-stamp
	rm -f $(freetype_config_man)
	rm -rf $(freetype_u) $(ft2demos_u)
	dh_clean

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) -C $(freetype_u) DESTDIR=$(TMP) install

	dh_movefiles
	@if [ "`find debian/tmp ! -type d`" ]; then \
	    echo "Error!  Not all files are moved out of debian/tmp!"; \
	    echo "Please fix your debian/*.files."; \
	    exit 1; \
	fi

	dh_installdirs -p$(demospkg) /usr/bin
	$(freetype_u)/builds/unix/libtool --mode=install \
	    cp -av `find $(ft2demos_u)/bin -type f -perm -u=x -maxdepth 1` \
		$(CURDIR)/debian/$(demospkg)/usr/bin/

	cp -a $(freetype_u)/objs/.libs/*so.* $(CURDIR)/debian/$(udebpkg)/usr/lib

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: DH_OPTIONS=-i
binary-indep:
# We have nothing to do by default.

# Build architecture-dependent files here.
# Pass -a to all debhelper commands in this target to reduce clutter.
binary-arch: DH_OPTIONS=-a
binary-arch: build $(libpkg) $(devpkg) $(demospkg) $(udebpkg)

$(libpkg): DH_OPTIONS=-p$(libpkg)
$(libpkg): build install
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_installdocs $(addprefix $(freetype_u)/docs/,$(libdoc)) \
		$(ftdocs_d)/docs/ft2faq.html 
	mkdir debian/$(libpkg)/$(docdir)/$(libpkg)/pcf
	cp -a $(freetype_u)/src/pcf/README debian/$(libpkg)/$(docdir)/$(libpkg)/pcf/
	dh_installexamples
#	dh_installmenu
#	dh_undocumented
	dh_installchangelogs -k $(freetype_u)/ChangeLog
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip
endif
	dh_link
	dh_compress
	dh_fixperms
	dh_makeshlibs -V '$(dependency)' --add-udeb '$(udebpkg)'
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

$(devpkg): DH_OPTIONS=-p$(devpkg)
$(devpkg): build install
	dh_testdir
	dh_testroot
	dh_installdirs $(docdir)/$(libpkg)
	ln -s $(libpkg) debian/$(devpkg)/$(docdir)/$(devpkg)
	dh_installdocs -Xreference/README -Xreference/.cvsignore -Xcopyright \
		-XLICENSE.TXT -XGPL.TXT \
		$(ftdocs_d)/docs/* $(freetype_u)/docs/*
	cd debian/$(devpkg)/usr/share/doc/$(devpkg)/ \
		&& rm -f $(libdoc) BUILD ft2faq.html
	dh_installman $(freetype_config_man)
#	dh_installexamples
#	dh_installchangelogs
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip
endif
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

$(demospkg): DH_OPTIONS=-p$(demospkg)
$(demospkg): build install
	dh_testdir
	dh_testroot
	dh_installdirs $(docdir)
	ln -s $(libpkg) debian/$(demospkg)/$(docdir)/$(demospkg)
#	dh_installdocs
#	dh_installexamples
#	dh_installmenu
#	dh_installmanpages
#	dh_undocumented
#	dh_installchangelogs
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip
endif
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	# To be safe, make ft2demos depend on the same version of libfreetype6
	unset DH_VERBOSE; dh_shlibdeps -l debian/$(libpkg)/usr/lib --dpkg-shlibdeps-params=-O \
		| sed -e 's/$(dependency)/$(libpkg) (= $(VERSION))/' \
		> debian/$(demospkg).substvars
	dh_gencontrol
	dh_md5sums
	dh_builddeb

$(udebpkg): DH_OPTIONS=-p$(udebpkg)
$(udebpkg): build install
	dh_testdir
	dh_testroot
	dh_installdirs
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip
endif
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_builddeb

binary: binary-indep binary-arch

# This variables is used only by get-orig-source, which will normally only
# be run by maintainers.
URL	= http://savannah.nongnu.org/download/freetype/

# Download the various upstream source tarballs and pack them into a
# single orig.tar.gz.  Assumes wget and gpg are available.
get-orig-source:
	@if [ ! -d "debian" ] ; then \
	    echo 'Run this from the top directory of the Debian source' >&2; \
	    exit 1; \
	fi
	mkdir freetype-$(ver)
	set -e; \
	cd freetype-$(ver); \
	for i in freetype freetype-doc ft2demos; do \
		wget $(URL)/$$i-$(ver).tar.bz2; \
		wget $(URL)/$$i-$(ver).tar.bz2.sig; \
		gpg --verify $$i-$(ver).tar.bz2.sig $$i-$(ver).tar.bz2 \
		&& rm $$i-$(ver).tar.bz2.sig; \
	done
	tar cf freetype_$(ver).orig.tar freetype-$(ver)
	rm -rf freetype-$(ver)
	gzip -9 freetype_$(ver).orig.tar

.PHONY: build clean binary-indep binary-arch binary unpack patch \
	$(libpkg) $(devpkg) install get-orig-source