summaryrefslogtreecommitdiff
path: root/tvision/debian/rules
blob: 15849daa6839e07104d397b8029e3a6edd8f75c7 (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/make -f
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independant
# package.

version=$(shell cat version.txt)
package=rhtvision
destdir=$(shell pwd)/debian/tmp/usr

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

# This is the debhelper compatibility version to use:
export DH_COMPAT=1

# Set CFLAGS according to the Debian Policy:
CFLAGS = -D_REENTRANT -g -Wall
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
CXXFLAGS = $(CFLAGS)


# Compile the beast!:
build: build-stamp
build-stamp: debianbackup.tar
	dh_testdir
# Rename debian/rhtvision.postinst file if it exists (and others):
ifneq ($(wildcard debian/rhtvision.postinst),)
	mv debian/rhtvision.postinst debian/rhtvision$(version).postinst
	mv debian/rhtvision.postrm debian/rhtvision$(version).postrm
endif
	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure \
		--prefix=$(destdir) --fhs --no-libs-here --real-prefix=/usr
	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" $(MAKE)
	touch build-stamp


# Clean everything as if nothing happened :) :
clean: clean-debian debianbackup.tar
# If we don't configure there is no guarantee that we have a Makefile:
	./configure --prefix=$(destdir) --fhs --no-libs-here --real-prefix=/usr
	$(MAKE) clean
# Restore upstream provided regenerated files:
	test -e debianbackup.tar && tar -xf debianbackup.tar
	rm -f debianbackup.tar
# FIXME: ask upstream about adding the next files to his clean target:
	rm -f compat/rhide.env examples/rhide.env include/tv/configtv.h Makefile \
		makes/rhide.env redhat/librhtv-*.spec makes/libtvfintl.a
	rm -f build-stamp

# Use the following target when you just want for example to rebuild the
# package without recompiling the sources:
clean-debian:
	dh_testdir
	dh_testroot
# Rename rhtvision$(version).postinst file if it exists (and others):
ifneq ($(wildcard debian/rhtvision$(version).postinst),)
	mv debian/rhtvision$(version).postinst debian/rhtvision.postinst
	mv debian/rhtvision$(version).postrm debian/rhtvision.postrm
endif
	dh_clean

# Let's backup modified files to restore them later!:
debianbackup.tar:
	dh_testdir
# Backup upstream provided regenerated files:
	-tar -cf debianbackup.tar --files-from=debian/files_to_backup


# Copy needed files to the temporary directories for the packages:
install: build
	dh_testdir
	dh_testroot
	dh_clean
	dh_installdirs -p $(package)$(version)-dev usr/lib usr/bin \
		usr/include/$(package) usr/share/doc \
		usr/share/doc/$(package)$(version)-dev \
		usr/share/doc/$(package)$(version)-dev/examples
	dh_installdirs -p $(package)$(version) usr/lib usr/share \
		usr/share/doc/$(package)$(version) \
		usr/share/doc/$(package)$(version)/eterm
	$(MAKE) install
# We need to move files for other packages than the first one in the control file:
	dh_movefiles -p $(package)$(version) usr/lib/librhtv.so.$(version) \
		usr/share/locale/


# Build the packages for a specific architecture:
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs -A borland.txt copying copying.rh readme.txt \
		doc/CodePages.txt doc/ConfigFile.txt doc/Eterm.txt doc/Linux.txt \
		doc/X11.txt doc/XTerm.txt THANKS
	dh_installdocs -p $(package)$(version)-dev doc/TVReference.html \
		doc/I18n.txt doc/Streams.txt
	dh_installdocs -p $(package)$(version) extra/eterm/ debian/README.debian
	mv debian/$(package)$(version)/usr/share/doc/$(package)$(version)/README.debian \
		debian/$(package)$(version)/usr/share/doc/$(package)$(version)/README.Debian
	dh_installexamples -p $(package)$(version)-dev examples/*
	find $(destdir) debian/$(package)$(version) \
        \( -name '.cvsignore' -o -name 'CVS' -prune \) -exec rm -rf '{}' \;
#	dh_installmenu
#	dh_installemacsen
#	dh_installinit
#	dh_installcron
#	dh_installmanpages
#	dh_undocumented -p $(package)$(version) rhtvision.3
	dh_installchangelogs change.log
	dh_strip
	dh_compress
	dh_fixperms
#	dh_suidregister
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_makeshlibs -m$(version)
	dh_md5sums
	dh_builddeb


# Build architecture-independent files here.
binary-indep: build install
#This package doesn't have architecture-independent files for the moment...

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

# Build all the packages:
binary: binary-indep binary-arch

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