File: rules

package info (click to toggle)
ghostscript 9.27~dfsg-2+deb10u3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 94,904 kB
  • sloc: ansic: 547,050; python: 6,552; cpp: 4,265; perl: 2,172; sh: 2,160; tcl: 1,639; makefile: 463; lisp: 407; awk: 66; yacc: 18
file content (177 lines) | stat: -rwxr-xr-x 6,346 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2004-2009, Masayuki Hatta (mhatta) <mhatta@debian.org>
# Copyright 2009-2019, Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for GhostPDL
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

include /usr/share/dpkg/pkg-info.mk

# detect if build targets experimental suite (or is a draft)
DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

# ABI by default follows upstream version (without repackaging suffix)
abi = $(firstword $(subst ~,$() ,$(DEB_UPSTREAM_VERSION)))
major = $(firstword $(subst .,$() ,$(DEB_UPSTREAM_VERSION)))

# These are needed ahead of including CDBS
DEB_AUTO_UPDATE_AUTOCONF = 2.67

include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.mk

libname = libgs
pkg = ghostscript
pkg-x11 = ghostscript-x
pkg-doc = ghostscript-doc
pkg-lib = $(libname)$(major)
pkg-dev = $(libname)-dev
pkg-data = $(libname)$(major)-common

# put aside upstream-shipped temp files during build
DEB_UPSTREAM_CRUFT_MOVE = configure

# TODO: enable when supporting system-shared libjpeg
# http://bugs.ghostscript.com/show_bug.cgi?id=696654
DEB_CONFIGURE_EXTRA_FLAGS += --without-pcl

# workaround for autotools-resolved paths ignored in base/unix-auth.mak
export DEB_HOST_MULTIARCH

# Support parallel building if enabled in DEB_BUILD_OPTIONS
# FIXME: Enable when not causing spurious errors like this
# https://buildd.debian.org/status/fetch.php?pkg=ghostscript&arch=amd64&ver=9.25~dfsg-6&stamp=1541195477&raw=0
#DEB_BUILD_PARALLEL = 1

gs_opts += SHARE_JPEG=1

gs_opts += SHARE_LIBPNG=1

gs_opts += SHARE_LIBTIFF=1
DEB_CONFIGURE_EXTRA_FLAGS += --with-system-libtiff

gs_opts += SHARE_ZLIB=1

gs_opts += SHARE_JBIG2=1
DEB_CONFIGURE_EXTRA_FLAGS += --with-jbig2dec

gs_opts += SHARE_IJS=1
DEB_CONFIGURE_EXTRA_FLAGS += --with-ijs

gs_opts += SHARE_EXPAT=1

DEB_CONFIGURE_EXTRA_FLAGS += --with-x --disable-gtk

DEB_CONFIGURE_EXTRA_FLAGS += --enable-dynamic
DEB_CONFIGURE_EXTRA_FLAGS += --disable-compile-inits

DEB_CONFIGURE_EXTRA_FLAGS += --with-drivers=ALL

gs_opts += WHICH_CMS=lcms2 SHARE_LCMS=1 LCMS2DIR=/usr

# openjpeg requires patching for ICC and CMYK support
gs_opts += SHARE_JPX=1
#DEB_CONFIGURE_EXTRA_FLAGS += --disable-openjpeg

fontdirs = /var/lib/ghostscript/fonts /usr/share/cups/fonts \
 /usr/share/ghostscript/fonts /usr/local/lib/ghostscript/fonts \
 /usr/share/fonts
gs_opts += SHARE_FT=1
DEB_CONFIGURE_EXTRA_FLAGS += --enable-freetype \
 --with-fontpath=$(subst $() ,:,$(strip $(fontdirs)))

# avoid building CUPS driver when bootstrapping an architecture
ifeq (,$(findstring stage1,$(DEB_BUILD_OPTIONS)))
gs_opts += SHARE_LCUPS=1 SHARE_LCUPSI=1
DEB_CONFIGURE_EXTRA_FLAGS += --enable-cups
endif

DEB_MAKE_BUILD_TARGET = so $(gs_opts)
DEB_MAKE_INSTALL_TARGET = soinstall DESTDIR=$(DEB_DESTDIR) $(gs_opts)

DEB_DH_MAKESHLIBS_ARGS_$(pkg-x11) = -n

# relax symbols check when targeting experimental
# and when bootstrapping an architecture
STAGE1 = $(findstring stage1,$(DEB_BUILD_PROFILES))
export DPKG_GENSYMBOLS_CHECK_LEVEL=$(if $(DEB_SUITE_EXP)$(STAGE1),0,1)

DEB_COMPRESS_EXCLUDE_ALL = .pdf

# install ABI-specific subdir explicitly, to fail if resolved wrong
DEB_DH_INSTALL_ARGS_$(pkg-data) = usr/share/ghostscript/$(abi)/

cleanbuilddir::
	[ ! -f Makefile ] || $(MAKE) soclean
	[ ! -f Makefile ] || $(MAKE) distclean

# Remove some of the scripts
DEB_DH_INSTALL_ARGS_ALL += $(patsubst %,-Xbin/%,\
 unix-lpr.sh lprsetup.sh pv.sh fixmswrd.pl)

# Do not include the Ghostscript loader executable with GTK support
install/$(pkg)::
DEB_DH_INSTALL_ARGS_ALL += -Xbin/gsx

# Rename /usr/bin/gsc, to not conflict with gambc
install/$(pkg)::
	mv $(DEB_DESTDIR)/usr/bin/gsc $(DEB_DESTDIR)/usr/bin/gs
	mkdir -p $(DEB_DESTDIR)/usr/sbin/
	install -m 755 debian/update-gsfontmap $(DEB_DESTDIR)/usr/sbin

# Move ICC profiles to shared dir, to allow reuse by others.
install/$(pkg-data)::
	mkdir -p $(DEB_DESTDIR)/usr/share/color/icc
	mv $(DEB_DESTDIR)/usr/share/ghostscript/$(abi)/iccprofiles \
		$(DEB_DESTDIR)/usr/share/color/icc/ghostscript
DEB_DH_LINK_$(pkg-data) += \
 /usr/share/color/icc/ghostscript usr/share/ghostscript/$(abi)/iccprofiles

# Strip CMap files (separately packaged in poppler-data)
DEB_DH_INSTALL_ARGS_$(pkg-data) += -X/Resource/CMap
DEB_DH_LINK_$(pkg-data) += \
 var/lib/ghostscript/CMap usr/share/ghostscript/$(abi)/Resource/CMap

# Recommend fonts-droid (not ship DroidSansFallback.ttf)
DEB_DH_INSTALL_ARGS_ALL += -XDroidSansFallback.ttf
DEB_DH_LINK_$(pkg-data) += \
 /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf \
 /usr/share/ghostscript/$(abi)/Resource/CIDFSubst/DroidSansFallback.ttf

# Let d-shlibs calculate development package dependencies
#  and handle shared library install
binary-post-install/$(pkg-lib):: debian/stamp-local-shlibs-$(libname)
debian/stamp-local-shlibs-$(libname): binary-install/$(pkg-lib)
	d-shlibmove --commit \
		--devunversioned --ignorelibdep --multiarch \
		--exclude-a \
		--movedev "debian/tmp/usr/include/*" usr/include/ \
		debian/tmp/usr/lib/$(libname).so

binary-post-install/$(pkg-data)::
	file='debian/$(cdbs_curpkg)/usr/share/ghostscript/$(abi)/Resource/Init/cidfmap'; \
	  ! egrep -v '^(%([^%].*)?)?$$' "$$file" && rm "$$file" || ( \
		echo; \
		echo 'ERROR: cidfmap not virtually empty as expected,'; \
		echo '       so some alternative to just dropping that file is required.'; \
		echo '       More info at bug#531182.'; \
		exit 1 )

# check that tracked issues are solved
debian/stamp-makefile-check: export GS = LD_LIBRARY_PATH=sobin GS_LIB=Resource/Init sobin/gsc
debian/stamp-makefile-check:
		$(MAKE) --file debian/tests/smoke.mk
		$(MAKE) --file debian/tests/issues/bug_700317/check.mk