File: rules

package info (click to toggle)
mgp 1.13a%2Bupstream20090219-12
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 4,200 kB
  • sloc: ansic: 32,387; sh: 4,295; lisp: 1,405; yacc: 945; lex: 264; makefile: 158; perl: 117; awk: 9
file content (163 lines) | stat: -rwxr-xr-x 4,877 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
#!/usr/bin/make -f

ifeq (,$(findstring terse,${DEB_BUILD_OPTIONS}))
export DH_VERBOSE=1
export V=1
export VERBOSE=1
endif

LC_ALL:=C
export LC_ALL

shellescape='$(subst ','\'',$(1))'
shellexport=$(1)=$(call shellescape,${$(1)})

# Hallo Helmut, yes, I know this causes FTCBFS, will deal with that later
DEB_HOST_GNU_TYPE?=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

EXTRA_CPPFLAGS=	-DFREETYPEFONTDIR=\"/usr/share/fonts/truetype\"
EXTRA_CPPFLAGS+=-D_DEFAULT_SOURCE	# work around imake weirdness
EXTRA_CPPFLAGS+=-D_GNU_SOURCE		# for asprintf(3)
EXTRA_CFLAGS+=	-Wall -Wformat
#EXTRA_CFLAGS+=	-Wextra
EXTRA_LDFLAGS=	-Wl,--as-needed
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
EXTRA_CFLAGS+=	-Og -g3
endif

# cut my losses, for now
EXTRA_CFLAGS+=	-Wno-unused-variable
EXTRA_CFLAGS+=	-Wno-unused-but-set-variable
EXTRA_CFLAGS+=	-Wno-pointer-sign
EXTRA_CFLAGS+=	-Wno-unused-function
EXTRA_CFLAGS+=	-Wno-unused-result

DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
DEB_CXXFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
DEB_LDFLAGS_MAINT_APPEND=${EXTRA_LDFLAGS}
DEB_BUILD_MAINT_OPTIONS=hardening=+all
include /usr/share/dpkg/buildflags.mk

CONFIGURE_ARGS+=	--prefix=/usr
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CONFIGURE_ARGS+=	--enable-debug
endif
CONFIGURE_ARGS+=	--enable-locale
CONFIGURE_ARGS+=	--enable-freetype
CONFIGURE_ARGS+=	--enable-freetype-charset16
CONFIGURE_ARGS+=	--enable-xft2
CONFIGURE_ARGS+=	--disable-vflib
CONFIGURE_ARGS+=	--enable-gif
CONFIGURE_ARGS+=	--build=${DEB_HOST_GNU_TYPE}

CONFIGURE_ENV+=		ac_cv_path_mgp_cv_path_gunzip=/bin/gunzip
CONFIGURE_ENV+=		ac_cv_path_mgp_cv_path_gzip=/bin/gzip

MAKE_ARGS+=		LIBDIR=/etc
MAKE_ARGS+=		INSTPGMFLAGS= INSTALLFLAGS=-p
# work around imake weirdness
MAKE_ARGS+=		EXTRA_DEFINES=$(call shellescape,${CPPFLAGS})
MAKE_ARGS+=		CDEBUGFLAGS=$(call shellescape,${CFLAGS})
MAKE_ARGS+=		CXXDEBUGFLAGS=$(call shellescape,${CXXFLAGS})
MAKE_ARGS+=		LOCAL_LDFLAGS=$(call shellescape,${LDFLAGS})
MAKE_ARGS+=		PROJECTMANSUFFIX=

build-arch: build-stamp
build-stamp:
	dh_testdir
	ln -sf /usr/share/misc/config.sub .
	ln -sf /usr/share/misc/config.guess .
	exec env ${CONFIGURE_ENV} \
	    $(foreach i,CC CFLAGS CXXFLAGS CPPFLAGS LDFLAGS,$(call shellexport,$i)) \
	    sh configure ${CONFIGURE_ARGS}
	xmkmf
	make Makefiles
	make ${MAKE_ARGS}
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	-rm -f build-stamp install-stamp
	[ ! -f Makefile ] || make distclean
	-rm -f `find . -name "*~"`
	-rm -rf debian/mgp debian/files* core debian/substvars
	-rm -f Makefile Imakefile *._man
	rm -f config.guess config.sub
	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	make ${MAKE_ARGS} \
	    DESTDIR=$(CURDIR)/debian/mgp prefix=$(CURDIR)/debian/mgp/usr \
	    install install.man
	# contrib
	install -d $(CURDIR)/debian/mgp/usr/share/doc/mgp/contrib/mgp-el
	install -m 755 contrib/eqn2eps.sh \
		contrib/mgp2html.pl contrib/mgp2latex.pl \
		contrib/tex2eps.sh \
		$(CURDIR)/debian/mgp/usr/bin/
	install -m 644 contrib/mgp-el/README \
		$(CURDIR)/debian/mgp/usr/share/doc/mgp/contrib/mgp-el
	install -m 644 contrib/mgp-el/mgp.sty \
		$(CURDIR)/debian/mgp/usr/share/doc/mgp/contrib/mgp-el
	install -m 644 contrib/mgp-el/sample.tex \
		$(CURDIR)/debian/mgp/usr/share/doc/mgp/contrib/mgp-el
	install -m 644 contrib/mgp-mode.el contrib/mgp-el/mgp.el \
		$(CURDIR)/debian/mgp/usr/share/emacs/site-lisp/mgp
	-rm $(CURDIR)/debian/mgp/etc/mgp/*
	cp debian/default.mgp $(CURDIR)/debian/mgp/etc/mgp/default.mgp

	#Rename shell scripts to remove .sh extension.
	mv $(CURDIR)/debian/mgp/usr/bin/eqn2eps.sh \
		$(CURDIR)/debian/mgp/usr/bin/eqn2eps
	mv $(CURDIR)/debian/mgp/usr/bin/tex2eps.sh \
		$(CURDIR)/debian/mgp/usr/bin/tex2eps
	mv $(CURDIR)/debian/mgp/usr/bin/mgp2html.pl \
		$(CURDIR)/debian/mgp/usr/bin/mgp2html
	mv $(CURDIR)/debian/mgp/usr/bin/mgp2latex.pl \
		$(CURDIR)/debian/mgp/usr/bin/mgp2latex

	touch install-stamp

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

# Build architecture-dependent files here.
binary-arch: build-arch install
#	dh_testversion
	dh_testdir
	dh_testroot
	dh_installdocs COPYRIGHT COPYRIGHT.jp FAQ \
		README README.fonts README.fonts.jp README.lang \
		SYNTAX TODO.jp USAGE USAGE.jp
	dh_installexamples `find sample -type f ! -name '*akefile*' ! -name .cvsignore -print` debian/mgp-print6
	dh_installmenu
	dh_installmime
	dh_installcron
#	dh_installman
	dh_installinit
	dh_installemacsen
	dh_installchangelogs RELNOTES
#	dh_movefiles
	dh_strip
	dh_compress --exclude=examples
	dh_fixperms
#	dh_suidregister
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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