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
|
#! /usr/bin/make -f
# =============================================================================
# debian/rules for the GNU Prolog packages:
# architecture-dependant package (gprolog-doc),
# architecture-independent package (gprolog).
#
# Written by Salvador Abreu <spa@debian.org> based on the template in
# /usr/share/doc/debhelper/examples/rules.multi, with the following header:
# =============================================================================
#
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess.
#
# -----------------------------------------------------------------------------
SHELL=/bin/sh
PACKAGE = gprolog
LIBDIR = /usr/lib/$(PACKAGE)
BINDIR = /usr/lib/$(PACKAGE)/bin
DOCDIR = /usr/share/doc/$(PACKAGE)-doc
GCCV = $(shell gcc -dumpversion)
COMMONFLAG = "-fcommon"
SRCDIR=src
DBGFLAGS=-g -O3 -fomit-frame-pointer -no-pie $(COMMONFLAG)
BCFLAGS=-funsigned-char
export LDFLAGS=-no-pie
REGS = --enable-regs
# FTBFS workaround (#852008)
ifneq ($(filter $(DEB_TARGET_ARCH), i386),)
REGS = --disable-regs
endif
# =============================================================================
CPPFLAGS = \
-DDEBIAN
CONFOPTIONS = \
--prefix=/usr \
--bindir=$(BINDIR) \
--libdir=$(LIBDIR) \
--includedir=$(LIBDIR)/include \
--with-install-dir=$(LIBDIR) \
--with-doc-dir=$(DOCDIR) \
--with-html-dir=$(DOCDIR)/gprolog.html \
--with-examples-dir=$(DOCDIR)/examples \
--without-links \
--disable-ebp \
$(REGS) \
--with-c-flags="$(DBGFLAGS) $(BCFLAGS) -Wall $(CPPFLAGS)"
INSTALLDIRS = \
INSTALL_DIR=$(CURDIR)/debian/$(PACKAGE)$(LIBDIR) \
INSTALL_BIN=$(CURDIR)/debian/$(PACKAGE)$(BINDIR) \
INSTALL_LIB=$(CURDIR)/debian/$(PACKAGE)$(LIBDIR) \
INSTALL_INC=$(CURDIR)/debian/$(PACKAGE)$(LIBDIR)/include \
DOC_DIR=$(CURDIR)/debian/$(PACKAGE)-doc$(DOCDIR) \
HTML_DIR=$(CURDIR)/debian/$(PACKAGE)-doc$(DOCDIR)/gprolog.html \
EXAMPLES_DIR=$(CURDIR)/debian/$(PACKAGE)-doc$(DOCDIR)/examples
ROOT = $(shell pwd)
SRCPATH = $(ROOT)/src
SRCXDIRS = TopComp EnginePl Pl2Wam Wam2Ma Ma2Asm Fd2C DevUtils
SRCXPATH := $(foreach dir,$(SRCXDIRS),$(SRCPATH)/$(dir):)
SRCXPATH := $(shell echo $(SRCXPATH) | tr -d ' ')
PATH = $(SRCXPATH):/usr/bin:/bin
PL_PATH = ${CURDIR}/src
CC = gcc
# == build binaries and documentation =========================================
build: build-indep build-arch
stamp-config: config
config:
dh_testdir
# -----------------------------------------------------------------------------
( PATH=${PATH}; \
if [ ! -f $(SRCDIR)/Makefile -o \
! -f $(SRCDIR)/configure -o \
$(SRCDIR)/Makefile.in -nt $(SRCDIR)/Makefile ]; then \
cd $(SRCDIR); \
[ -f ./configure ] || autoconf; \
CC=$(CC) CPPFLAGS="${CPPFLAGS}" ./configure $(CONFOPTIONS); fi )
# -----------------------------------------------------------------------------
touch stamp-config
build-indep: stamp-build-indep
stamp-build-indep: stamp-config
dh_testdir
# -- commands to configure and build the package ------------------------------
PATH=${PATH} make -C doc pdf html
# -----------------------------------------------------------------------------
touch stamp-build-indep
build-arch: stamp-build-arch
stamp-build-arch: stamp-config
# env > ENV
dh_testdir
# -- commands to configure and build the package ------------------------------
## fix up the time stamp on generated files in the Debian diff,
## which can't be regenerated during build w/o a tool that depends
## on them!
if [ -f src/BipsPl/arith_inl.wam ]; then \
touch src/BipsPl/arith_inl.wam; \
fi
PATH=${PATH} PL_PATH=${PL_PATH} make -C $(SRCDIR)
# -----------------------------------------------------------------------------
touch stamp-build-arch
# == clean up everything ======================================================
clean:
clean: stamp-config
dh_testdir
dh_testroot
rm -f stamp-build-arch stamp-build-indep stamp-config
# -- commands to clean up after the build process -----------------------------
set -e; PATH=${PATH} make -C $(SRCDIR) distclean
# -- now, get rid of some more generated files --------------------------------
set -e; \
find -name Makefile -o -name configure | \
while read FILE; do \
if [ -f "$$FILE.in" ]; then rm -f "$$FILE"; fi; done
find src -name VERSION | xargs -r rm -f
rm -rf $(SRCDIR)/autom4te.cache
rm -f $(SRCDIR)/EnginePl/gprolog_cst.h
rm -f $(SRCDIR)/EnginePl/wam_stacks.h
# -- make sure all *.wam files are more recent than *.pl ----------------------
find $(SRCDIR) -name \*.wam | xargs touch
# -- clean up docs ------------------------------------------------------------
make -C doc clean-all distclean
[ -e doc/copyright-stored.tex ] && \
cp doc/copyright-stored.tex doc/copyright.tex || true
# -- clean up examples --------------------------------------------------------
ls -d examples/Examples* | while read DIR; do \
if [ -f $$DIR/Makefile ]; then \
make -C "$$DIR" clean; \
fi; \
done
# -----------------------------------------------------------------------------
dh_clean
# == arch-dependent installation ==============================================
install-arch:
install-arch: build-arch
dh_testdir
dh_testroot
dh_prep
dh_installdirs -A
# -- install the package into the staging area --------------------------------
make -C $(SRCDIR) $(INSTALLDIRS) install-system
# -- create gprolog etc, links in /usr/bin ------------------------------------
# (this is now done by gprolog.postinst)
# -- Install manpages ---------------------------------------------------------
mkdir -p debian/$(PACKAGE)/usr/share/man/man1/
cat debian/manpage.1 | \
sed -e "s/@PACKAGE@/$(PACKAGE)/g" | \
gzip -9 > debian/$(PACKAGE)/usr/share/man/man1/$(PACKAGE).1.gz
for CMD in gplc hexgplc; do \
ln -sf $(PACKAGE).1.gz \
debian/$(PACKAGE)/usr/share/man/man1/$$CMD.1.gz; \
done
# -- Install auxiliary stuff --------------------------------------------------
mkdir -p debian/$(PACKAGE)/usr/share/icons/
install -c -m 444 \
doc/logo.png \
debian/$(PACKAGE)/usr/share/icons/$(PACKAGE).png
mkdir -p debian/$(PACKAGE)/usr/share/doc/$(PACKAGE)/
install -c -m 444 \
NEWS README \
debian/$(PACKAGE)/usr/share/doc/$(PACKAGE)/
# -----------------------------------------------------------------------------
# dh_movefiles
# == arch-independent installation ============================================
install-indep:
install-indep: build-indep
dh_testdir
dh_testroot
dh_clean
dh_installdirs -A
# -- commands to install the package into the staging area --------------------
make -C $(SRCDIR) $(INSTALLDIRS) \
install-doc install-html install-examples
# -- remove stray PDFs --------------------------------------------------------
find debian/$(PACKAGE)-doc -name compil-scheme.pdf\* | xargs -r rm -f
find debian/$(PACKAGE)-doc -name debug-box.pdf\* | xargs -r rm -f
# -----------------------------------------------------------------------------
# dh_movefiles
# == build architecture-independent files =====================================
binary-indep: build-indep install-indep
dh_testdir -i
dh_testroot -i
# dh_installdebconf -i
dh_installdocs -i # -pgprolog-doc
# dh_installexamples -i
dh_installemacsen -i
# dh_installman -i
dh_installinfo -i
dh_installchangelogs -i
dh_link -i
dh_compress -i -X.pdf -X.pl
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build-arch install-arch
dh_testdir -a
dh_testroot -a
# dh_installdebconf -a
dh_installdocs -a
dh_installexamples -a
# dh_installmenu -a
dh_installman -a
# dh_installinfo -a
dh_installchangelogs ChangeLog
dh_link -a
dh_strip -a
dh_compress -a -X.pl -X.html
dh_fixperms -a
# dh_makeshlibs -a
for CTLFILE in postinst prerm; do \
( echo "# -- Prolog variant ---------"; \
echo LIB=/usr/lib/gprolog; \
echo "# ---------------------------" ) \
>> debian/$(PACKAGE).$$CTLFILE.debhelper; \
done
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install
|