summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 9227dc064fa60e2ac91d8ee5d98b839012281e0d (plain)
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
#!/usr/bin/make -f
# debian/rules that uses debhelper.

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

DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

export QUILT_PATCHES := debian/patches

v = 8.6

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS=-g -O0
else
# See bug #446335
CFLAGS=-g -O2 -fno-unit-at-a-time
endif

unpatch:
	dh_testdir
	quilt pop -a || test $$? = 2
	rm -rf patch-stamp .pc

patch: patch-stamp
patch-stamp:
	dh_testdir
	quilt push -a || test $$? = 2
	touch patch-stamp

build: build-stamp
build-stamp: patch-stamp
	dh_testdir
	cd sdl && \
	CFLAGS="$(CFLAGS)" \
	  ./configure --host=$(DEB_HOST_GNU_TYPE) \
		      --build=$(DEB_BUILD_GNU_TYPE) \
		      --prefix=/opt/sdltk86 \
		      --includedir=/opt/sdltk86/include \
		      --with-tcl=/opt/sdltk86/lib \
		      --enable-shared \
		      --enable-man-symlinks \
		      --enable-man-compression=gzip && \
	  $(MAKE)
# Build the static library.
	cd sdl && \
	  ar cr libsdl2tk$(v).a *.o && \
	  ar d libsdl2tk$(v).a tkAppInit.o && \
	  ranlib libsdl2tk$(v).a
	touch build-stamp

clean: clean-patched unpatch
	dh_testdir
	dh_testroot
	dh_clean

clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp
	cd sdl && [ ! -f Makefile ] || $(MAKE) distclean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_installdirs
	mkdir -p debian/tmp/opt
	cd sdl && \
	  GZIP=-9 \
	  $(MAKE) INSTALL_ROOT=`pwd`/../debian/tmp \
		  MAN_INSTALL_DIR=`pwd`/../debian/tmp/opt/sdltk86/man \
		  install install-private-headers
# Fix up the libraries.
	cp sdl/libsdl2tk$(v).a debian/tmp/opt/sdltk86/lib
	cp debian/pkgIndex.tcl debian/tmp/opt/sdltk86/lib/sdl2tk8.6
	touch install-stamp

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_movefiles -i
	dh_installdocs -i
	dh_installchangelogs -i ChangeLog
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_movefiles -a
# now, fix up file locations for .sh
	mv debian/sdl2tk$(v)/opt/sdltk86/lib/*.sh \
	   debian/sdl2tk$(v)-dev/opt/sdltk86/lib
	dh_installdocs -a
	dh_installmenu -a
	dh_installchangelogs -a ChangeLog
	dh_fixperms -a
	dh_strip -a
	dh_makeshlibs -a -V 'sdl2tk$(v) (>= 8.6.2)'
	dh_installdeb -a
	dh_shlibdeps -a -ldebian/sdl2tk$(v)/opt/sdltk86/lib
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch

.PHONY: patch unpatch clean-patched build clean binary-indep binary-arch binary install