File: rules

package info (click to toggle)
xpcd 2.08-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 632 kB
  • ctags: 556
  • sloc: ansic: 6,368; makefile: 235; sh: 200; perl: 12
file content (195 lines) | stat: -rwxr-xr-x 5,552 bytes parent folder | download
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
#!/usr/bin/make -f
#
# debian/rules file for xpcd.
#
# (c) 1997-1999 Stephan A Suerken <absurd@debian.org>.
#

#
# CONFIGURATION
#
export DH_VERBOSE=0

#
# GENERIC PART
#
# build should always be the default target
default: build
build: build-stamp

binary:	binary-clean binary-indep binary-arch

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

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

#
# PACKAGE PART
#

xpcd_confdir=etc/X11/

build-stamp:
	dh_testdir

#
# STEP 1: CONGIGURE
#

#
# Note 0:
#
# Makefile is NOT a standard GNU automake makefile; most options for configure
# dont have any effect as the housemade Makefile.in does not recognize them :(

# Note 1: (Obsolete (?))
#
# Note: Don't recreate ./configure -- or if needed, use "make autoconf" rather
# than autoconf itself (strange gimp recognition problem).
#

# Note 2:
#
# "Unusual Source Dependencies" (afaik):
# -libgtk and the gimp libraries (for the gimp-gate)
# -svgalib (for gimp-svga)
# -libtiff and libjpeg (optional, adds functionality to the internal viewer)

	./configure --with-x --with-gimp --with-svga --prefix=usr

# this should build everything

#
# STEP 2: BUILDING
#

# the x11_libdir arg to make will make compile the binaries with the correct SYSRC
# location while not interfering with compile time searc paths. As suggested by the
# upstream author.
	make x11_libdir=/${xpcd_confdir}
	touch $@

binary-indep: build
#	dh_testdir
#	dh_testroot
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.


#
# Hack for slink (debhelper). Only needed once.
#
std_man_dir=$(shell if grep --quiet "2.1" /etc/debian_version; then echo -n "man" ; else echo -n "share/man"; fi)


binary-arch: build
	dh_testdir
	dh_testroot

#
# INSTALLING TO debian/tmp
#

# The housebrewed Makefile is no good, skipping installation with it completely
# DESTDIR must not be relative!
# Changing the suid flags from default 4711 to 4755.
	make install DESTDIR=`pwd`/debian/tmp/ SUID_ROOT="-o 0 -g 0 -m 4755" mandir=`pwd`/debian/tmp/usr/${std_man_dir}

#
# Check if svgalib is there, else build replacement binary and man page
#
	@if [ ! -f debian/tmp/usr/bin/pcdview ]; \
          then cd debian/tmp/usr/bin/ &&\
               echo && \
               echo "Could not build svgalib-binary!" && \
               echo && \
               echo "Possible reasons:" && \
               echo " 1. error You don't have the appropriate packages installed." &&\
               echo " 2. error This is a source package bug." &&\
               echo " 3. ok svgalib is not yet, or not at all e.g. m68k available on your architecture." &&\
               echo && \
               echo "Building dummy script replacements for pcdview and pcdview.1" &&\
               echo && \
               echo "#!/bin/sh" >pcdview &&\
               echo "echo 'Sorry, this binary is not available.' " >>pcdview &&\
               echo "echo 'There was an error when building the package that prevented' " >>pcdview &&\
               echo "echo 'this binary from compiling. Most likely your system lacks' " >>pcdview &&\
               echo "echo 'the svga library.' " >>pcdview &&\
               chmod +x pcdview &&\
               cd ../${std_man_dir}/man1/ &&\
               echo ".SH NAME" >pcdview.1 &&\
               echo "pcd[svga]view \- Unavailable on your system" >>pcdview.1 ;\
        fi

# Renaming too generally named binaries && manpages for pcdview [ fbview: since 2.08, fbview isnt in xpcd any more ]
	cd debian/tmp/usr/bin/ && mv pcdview pcdsvgaview
	cd debian/tmp/usr/${std_man_dir}/man1/ && mv pcdview.1 pcdsvgaview.1
# moving xpcd binary && man to X11R6
	install -d debian/tmp/usr/X11R6/bin
	install -d debian/tmp/usr/X11R6/man/man1
	mv debian/tmp/usr/bin/xpcd debian/tmp/usr/X11R6/bin/
	mv debian/tmp/usr/${std_man_dir}/man1/xpcd.1 debian/tmp/usr/X11R6/man/man1/
# Fixing wrongly placed sysrc
	install -d debian/tmp/${xpcd_confdir}
	mv debian/tmp/usr/X11R6/lib/X11/xpcd debian/tmp/${xpcd_confdir}
# Add an Icon for the Debian Menu System xpcd.xpm
	cp debian/xpcd-menu.xpm debian/tmp/usr/X11R6/include/X11/pixmaps/
# Add Debian pcdsvgaview wrapper
	cp -p debian/pcdsvgaview_photocd debian/tmp/usr/bin/
# SUID chmod for pcdsvgaview (now done by make install)
#	chmod 4755 debian/tmp/usr/bin/pcdsvgaview

#
# Debhelper processing
#

# auto: debian/copyright debian/README.Debian debian/TODO
	dh_installdocs README xpcd.lsm linux/

# auto: %
	dh_installexamples
# auto: %; menu menu-method --or-- package.menu package.menu-method
	dh_installmenu
#
# autoinstall all other found man pages to xpcd (i.e., only pcdsvgaview_photocd.1)
	dh_installmanpages -pxpcd

# auto: debian/changelog
	dh_installchangelogs

	dh_movefiles -pxpcd-svga usr/bin/pcdsvgaview usr/bin/pcdsvgaview_photocd usr/${std_man_dir}/man1/pcdsvgaview.1 usr/${std_man_dir}/man1/pcdsvgaview_photocd.1
	dh_movefiles -pxpcd-gimp usr/lib/gimp/

# Removing left-over usr/lib/gimp/* (maybe dh_movefiles should remove empty dirs?)
	rm -rf debian/tmp/usr/lib/gimp

#
# Register suid programs
#
	dh_suidregister -pxpcd-svga

#
# "Standard" debhelper
#
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
#	dh_makeshlibs
	dh_md5sums
	dh_builddeb

binary-clean:
	dh_testdir
	dh_clean
	-rm -rf debian/tmp debian/xpcd-svga debian/xpcd-gimp debian/files*

clean: binary-clean
	dh_testdir
# xpcd calls distclean realclean ... 
	-make realclean
	-rm -f build-stamp `find . -name "*~"`