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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2004-2009, Masayuki Hatta (mhatta) <mhatta@debian.org>
# Copyright © 2009-2011, Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for GPL Ghostscript
#
# 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 2, 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/>.
# This needs to run before cdbs auto-update
debian/control:: debian/control.in
DEB_PHONY_RULES += debian/control.in
debian/control.in::
sed $(SEDRULE_CONTENT) <debian/control.in.in >debian/control.in
DEB_AUTO_UPDATE_AUTOCONF = 2.67
include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.mk
# ABI by default follows upstream version (without repackaging suffix)
abi = $(DEB_UPSTREAM_TARBALL_VERSION)
major := $(shell echo $(DEB_UPSTREAM_VERSION) | sed 's/\..*$$//')
libname = libgs
libpkgname = $(libname)$(major)
datapkgname = $(libname)$(major)-common
DEB_UPSTREAM_URL = http://downloads.ghostscript.com/public
DEB_UPSTREAM_TARBALL_MD5 = 153ddb0622cb155d2f600146f1e28d84
# convenience libraries cluttering authorship/licensing tracking
# * jpeg would enable old non-standard option (see bug#582521)
# * jpegxr would enable patented controversial JPEG XR format
DEB_UPSTREAM_REPACKAGE_EXCLUDES += \
./cups/libs/ \
./expat/ \
./freetype/ \
./icclib/ \
./ijs/ \
./jasper/ \
./jbig2dec/ \
./jpeg/ \
./jpegxr/ \
./lcms/ \
./lcms2/ \
./libpng/ \
./openjpeg/ \
./tiff/ \
./zlib/
# extract metadata from ICC, PDF, and fonts before copyright check
CDBS_BUILD_DEPENDS +=, libregexp-assemble-perl, libimage-exiftool-perl
CDBS_BUILD_DEPENDS +=, libfont-ttf-perl
local_inspection_regex = icc|pdf|ttf
local_inspection_exif_dir = Resource/Font/
DEB_COPYRIGHT_CHECK_IGNORE_REGEX = ^((.*/)?[^/]+\.($(local_inspection_regex))|$(local_inspection_exif_dir).*|debian/(changelog|copyright(|_hints|_newhints)))$$
debian/stamp-copyright-check: debian/stamp-extract-copyright
debian/stamp-extract-copyright:
find * -type f -regextype posix-extended \
-regex '.*\.($(local_inspection_regex))' \
-print0 | perl -0 debian/license-miner
find $(local_inspection_exif_dir) -type f \
-printf 'exif:%p\0' | perl -0 debian/license-miner
touch $@
pre-build:: clean-extracted-copyright-during-build
clean-extracted-copyright-during-build: debian/stamp-copyright-check
find -type f -name '*.metadata_dump' -delete
clean::
find -type f -name '*.metadata_dump' -delete
rm -f debian/stamp-extract-copyright
# put aside upstream-shipped temp files during build but after copyright-check
upstreamtmpfiles = configure
pre-build:: debian/stamp-upstreamtmpstuff
debian/stamp-upstreamtmpstuff: debian/stamp-copyright-check
for file in $(upstreamtmpfiles); do \
[ ! -e $$file ] || [ -e $$file.upstream ] || cp -a $$file $$file.upstream; \
done
touch $@
clean::
for file in $(upstreamtmpfiles); do \
[ ! -e $$file.upstream ] || mv -f $$file.upstream $$file; \
done
rm -f debian/stamp-upstreamtmpstuff
# workaround for autotools-resolved paths ignored in base/unix-auth.mak
export DEB_HOST_MULTIARCH
gs_opts += SHARE_JPEG=1
dev-deps += jpeg
gs_opts += SHARE_LIBPNG=1
dev-deps += png
gs_opts += SHARE_LIBTIFF=1
DEB_CONFIGURE_EXTRA_FLAGS += --with-system-libtiff
dev-deps += tiff
gs_opts += SHARE_ZLIB=1
dev-deps += z
gs_opts += SHARE_JBIG2=1
DEB_CONFIGURE_EXTRA_FLAGS += --with-jbig2dec
dev-deps += jbig2dec
gs_opts += SHARE_IJS=1
DEB_CONFIGURE_EXTRA_FLAGS += --with-ijs
dev-deps += ijs
gs_opts += SHARE_EXPAT=1
dev-deps += expat
DEB_CONFIGURE_EXTRA_FLAGS += --with-x --disable-gtk
dev-deps += xt xext x11 ice sm
DEB_CONFIGURE_EXTRA_FLAGS += --enable-dynamic
DEB_CONFIGURE_EXTRA_FLAGS += --disable-compile-inits
# TODO: enable when working again (failed since 9.07 and maybe 9.06)
#DEB_CONFIGURE_EXTRA_FLAGS += --with-omni
DEB_CONFIGURE_EXTRA_FLAGS += --with-drivers=ALL
gs_opts += WHICH_CMS=lcms2 SHARE_LCMS=1 LCMS2DIR=/usr
dev-deps += lcms2
# openjpeg requires patching for ICC and CMYK support
gs_opts += SHARE_JPX=1
CDBS_BUILD_DEPENDS +=, libopenjpeg-dev (>= 1.5)
gs_opts += SHARE_FT=1
DEB_CONFIGURE_EXTRA_FLAGS += --enable-freetype
DEB_CONFIGURE_EXTRA_FLAGS += --with-fontpath=/var/lib/ghostscript/fonts:/usr/share/cups/fonts:/usr/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/fonts
dev-deps += freetype6
dev-deps += fontconfig1
# avoid building CUPS driver when bootstrapping an architecture
ifeq (,$(findstring stage1,$(DEB_BUILD_PROFILES)))
gs_opts += SHARE_LCUPS=1 SHARE_LCUPSI=1
DEB_CONFIGURE_EXTRA_FLAGS += --enable-cups
endif
dev-deps += cups2 cupsimage2
DEB_MAKE_BUILD_TARGET = so gs.a $(gs_opts)
DEB_MAKE_INSTALL_TARGET = soinstall DESTDIR=$(DEB_DESTDIR) $(gs_opts)
DEB_DH_MAKESHLIBS_ARGS_ghostscript-x = -n
SEDRULE_CONTENT = 's/__ABI__/$(abi)/g;s/__VER__/$(major)/g'
# avoid checking symbols file when bootstrapping an architecture
ifneq (,$(findstring stage1,$(DEB_BUILD_PROFILES)))
DEB_DH_MAKESHLIBS_ARGS = -- -c0
endif
pre-build:: debian/control.in.in
echo "sed $(SEDRULE_CONTENT) <$< | diff -u debian/control.in -"
@sed $(SEDRULE_CONTENT) <$< | diff -u debian/control.in - || ( \
echo; \
echo "Upstream version has changed (or debian/control.in.in is out of sync)"; \
echo "Edit debian/control manually, or use the following command:"; \
echo " DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean"; \
exit 1)
# Generate (and cleanup) files containing variables static per build
infiles = $(filter-out debian/control.in debian/control.in.in, $(wildcard debian/*.in))
outfiles = $(subst $(libname)__VER__,$(libpkgname),$(basename $(infiles)))
pre-build:: $(outfiles)
$(outfiles): update-config debian/stamp-copyright-check
sed $(SEDRULE_CONTENT) <$(subst $(libpkgname),$(libname)__VER__,$@).in >$@
clean::
rm -f $(outfiles)
pre-build clean:: fail-source-not-repackaged
clean::
[ ! -f Makefile ] || $(MAKE) soclean
[ ! -f Makefile ] || $(MAKE) distclean
# These are somehow left...
rm -rf sobin soobj gs.a
# Remove some of the scripts
install/ghostscript::
rm -f $(DEB_DESTDIR)/usr/bin/unix-lpr.sh $(DEB_DESTDIR)/usr/bin/lprsetup.sh $(DEB_DESTDIR)/usr/bin/pv.sh $(DEB_DESTDIR)/usr/bin/fixmswrd.pl
# Do not include the Ghostscript loader executable with GTK support
install/ghostscript::
rm -f $(DEB_DESTDIR)/usr/bin/gsx
# Rename /usr/bin/gsc, to not conflict with gambc
install/ghostscript::
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/$(datapkgname)::
mkdir -p $(DEB_DESTDIR)/usr/share/color/icc
mv $(DEB_DESTDIR)/usr/share/ghostscript/$(abi)/iccprofiles \
$(DEB_DESTDIR)/usr/share/color/icc/ghostscript
# Strip CMap files (separately packaged in poppler-data)
install/$(datapkgname)::
rm -rf $(DEB_DESTDIR)/usr/share/ghostscript/$(abi)/Resource/CMap
# Recommend fonts-droid (not ship DroidSansFallback.ttf)
CDBS_RECOMMENDS_$(datapkgname) +=, fonts-droid
install/$(datapkgname)::
rm -f $(DEB_DESTDIR)/usr/share/ghostscript/$(abi)/Resource/CIDFSubst/DroidSansFallback.ttf
install/libgs-dev::
mkdir -p $(DEB_DESTDIR)/usr/lib/
install -m 644 gs.a \
$(DEB_DESTDIR)/usr/lib/libgs.a
# Let d-shlibs calculate development package dependencies
# and handle shared library install
# * recent d-shlibs needed to handle unversioned -dev package and
# suppress library dependency here declared indirectly using CDBS
CDBS_BUILD_DEPENDS +=, d-shlibs (>= 0.45~)
binary-post-install/$(libpkgname):: debian/stamp-local-shlibs-$(libname)
debian/stamp-local-shlibs-$(libname): binary-install/$(libpkgname)
d-shlibmove --commit \
--override s/liblcms2-2-dev/liblcms2-dev/ \
--override s/ld1-dev// \
--devunversioned --ignorelibdep \
--movedev "debian/tmp/usr/include/*" usr/include/ \
debian/tmp/usr/lib/$(libname).so
clean::
rm -f debian/stamp-local-shlibs-$(libname)
binary-post-install/$(datapkgname)::
file='debian/$(datapkgname)/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 )
# Needed at build time
dev-deps += paper idn11
CDBS_BUILD_DEPENDS +=, $(patsubst %,$(comma) lib%-dev,$(dev-deps))
CDBS_BUILD_DEPENDS +=, freeglut3-dev | libglut-dev, pkg-config
# Needed (always, often, sometimes) at runtime
# TODO: drop gs-cjk-resource after Wheezy+1 (obsoleted before Wheezy)
CDBS_DEPENDS_ghostscript +=, gsfonts, debconf | debconf-2.0
CDBS_DEPENDS_ghostscript +=, $(libpkgname) (= $(DEB_VERSION))
CDBS_DEPENDS_ghostscript-x +=, ghostscript (= $(DEB_VERSION))
CDBS_DEPENDS_$(libpkgname) +=, poppler-data (>= 0.4.5-3~) | gs-cjk-resource
CDBS_DEPENDS_libgs-dev +=, $(libpkgname) (= $(DEB_VERSION))
CDBS_SUGGESTS_ghostscript +=, ghostscript-x
CDBS_SUGGESTS_ghostscript-doc +=, ghostscript
# Public virtual packages
CDBS_PROVIDES_ghostscript +=, postscript-viewer
|