Make package $(DESTDIR) aware

parent fd8e1906
......@@ -4,25 +4,24 @@
# Copyright (C) 1996 Sven Rudolph
# Copyright (C) 2008 Agustin Martin
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
auxbindir = @auxbindir@
datadir = @datadir@
mandir = @mandir@
PERL = @PERL@
pkgdatadir = $(datadir)/linuxdoc-tools
LINUXDOCDOC = $(prefix)/share/doc/linuxdoc-tools
mandir1 = $(mandir)/man1
texdir = $(pkgdatadir)
perl5libdir = $(pkgdatadir)
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ -m 755
INSTALL_DATA = @INSTALL_DATA@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
auxbindir = @auxbindir@
datadir = @datadir@
mandir = @mandir@
PERL = @PERL@
pkgdatadir = $(datadir)/linuxdoc-tools
docdir = $(prefix)/share/doc/linuxdoc-tools
man1dir = $(mandir)/man1
texdir = $(pkgdatadir)
perl5libdir = $(pkgdatadir)
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ -m 755
INSTALL_DATA = @INSTALL_DATA@
#
# nsgmls or onsgmls should be installed already
# BUILD_NSGMLS=@BUILD_NSGMLS@
......@@ -30,6 +29,15 @@ BUILD_SGMLSASP = @BUILD_SGMLSASP@
BUILD_ENTITY_MAP = @BUILD_ENTITY_MAP@
BUILD_ISO_ENTITIES = @BUILD_ISO_ENTITIES@
# Now real destination dirs, honouring $(DESTDIR)
auxbin_ddir = $(DESTDIR)$(auxbindir)
bin_ddir = $(DESTDIR)$(bindir)
doc_ddir = $(DESTDIR)$(docdir)
man1_ddir = $(DESTDIR)$(man1dir)
perl5lib_ddir = $(DESTDIR)$(perl5libdir)
pkgdata_ddir = $(DESTDIR)$(pkgdatadir)
tex_ddir = $(DESTDIR)$(texdir)
GENFILES := bin/linuxdoc
progs := sgml2html sgml2info sgml2latex sgml2lyx sgml2rtf sgml2txt sgmlcheck
......@@ -69,83 +77,97 @@ endif
done
install::
@echo "Installing binaries in $(bindir) ..."
if [ ! -d $(bindir) ]; then mkdir -p $(bindir); fi
-chmod 755 $(bindir)
@echo "Installing binaries in $(bin_ddir) ..."
[ -d $(bin_ddir) ] || mkdir -m 755 -p $(bin_ddir)
# nsgmls or onsgmls should be installed already
# ifeq ($(BUILD_NSGMLS), true)
# $(INSTALL_PROGRAM) sp/nsgmls/nsgmls $(bindir)/nsgmls
# $(INSTALL_PROGRAM) sp/nsgmls/nsgmls $(bin_ddir)/nsgmls
# endif
# --
ifeq ($(BUILD_SGMLSASP), true)
$(INSTALL_PROGRAM) sgmls-1.1/sgmlsasp $(bindir)/sgmlsasp
$(INSTALL_PROGRAM) sgmls-1.1/sgmlsasp $(bin_ddir)/sgmlsasp
endif
# --
ifeq ($(BUILD_ENTITY_MAP), true)
@echo "Installing Entity Mapping library (in entity-map)..."
( cd entity-map; \
$(MAKE) install )
$(MAKE) install DESTDIR=$(DESTDIR))
endif
# --
ifeq ($(BUILD_ISO_ENTITIES), true)
@echo "Installing ISO character entity sets (in iso-entities)..."
( cd iso-entities; \
$(MAKE) install )
$(MAKE) install DESTDIR=$(DESTDIR))
endif
# -- Install linuxdoc script
$(INSTALL_PROGRAM) bin/linuxdoc $(bin_ddir)/linuxdoc
# -- Install auxiliary programs
mkdir -p $(auxbindir)
mkdir -p $(auxbin_ddir)
for ii in sgmlpre/sgmlpre rtf-fix/rtf2rtf; do \
bn=`basename $$ii`; \
$(INSTALL_PROGRAM) $$ii $(auxbindir)/$$bn; \
$(INSTALL_PROGRAM) $$ii $(auxbin_ddir)/$$bn; \
done
$(INSTALL_PROGRAM) bin/linuxdoc $(bindir)/linuxdoc
@echo "Installing library and support files in $(pkgdatadir)..."
if [ ! -d $(pkgdatadir) ]; then mkdir -p $(pkgdatadir); fi
chmod 755 $(pkgdatadir)
# cp -r lib/* $(pkgdatadir)
( cd lib && tar --exclude='CVS' -cpf - . ) | ( cd $(pkgdatadir) && tar -xpf - )
cp VERSION $(pkgdatadir)
# -- Install perl libraries and support files
@echo "Installing library and support files in $(pkgdata_ddir)..."
[ -d $(pkgdata_ddir) ] || mkdir -m 755 -p $(pkgdata_ddir)
# # cp -r lib/* $(pkgdata_ddir)
( cd lib && tar --exclude='CVS' -cpf - . ) | ( cd $(pkgdata_ddir) && tar -xpf - )
cp VERSION $(pkgdata_ddir)
# -- Install manual pages
@echo "Installing man pages in $(mandir1) ..."
if [ ! -d $(mandir1) ]; then mkdir -p $(mandir1) ; fi
-chmod 755 $(mandir1)
[ -d $(man1_ddir) ] || mkdir -m 755 -p $(man1_ddir)
for ii in genman/sgml2* genman/sgmlcheck.1 \
genman/rtf*.1 genman/sgmlpre*.1; do \
bn=`basename $$ii`; \
$(INSTALL_DATA) $$ii $(mandir1)/$$bn; \
$(INSTALL_DATA) $$ii $(man1_ddir)/$$bn; \
done
$(INSTALL_DATA) genman/linuxdoc.1 $(mandir1)/linuxdoc.1
$(INSTALL_DATA) genman/linuxdoc.1 $(man1_ddir)/linuxdoc.1
ifeq ($(BUILD_NSGMLS), true)
$(INSTALL_DATA) man/nsgmls.1 $(mandir1)/nsgmls.1
$(INSTALL_DATA) man/nsgmls.1 $(man1_ddir)/nsgmls.1
endif
ifeq ($(BUILD_SGMLSASP), true)
$(INSTALL_DATA) man/sgmlsasp.1 $(mandir1)/sgmlsasp.1
$(INSTALL_DATA) man/sgmlsasp.1 $(man1_ddir)/sgmlsasp.1
endif
# Fix permissions in $(pkgdatadir)
find $(pkgdatadir) -type d -print | xargs chmod 755
find $(pkgdatadir) -type f -print | xargs chmod 644
(cd $(bindir); for i in $(progs); do rm -f $$i; ln -s linuxdoc $$i;done)
@echo "Installing documentation in $(LINUXDOCDOC) ..."
(cd doc; PATH=${PATH}:$(bindir) PREFIX=$(prefix) BINDIR=$(bindir) \
DATADIR=$(datadir) bash Makedoc.sh)
if [ ! -d $(LINUXDOCDOC) ]; then mkdir -p $(LINUXDOCDOC); fi
chmod 755 $(LINUXDOCDOC)
# cp -r doc/* $(LINUXDOCDOC)
( cd doc && tar --exclude='CVS' -cpf - . ) | ( cd $(LINUXDOCDOC) && tar -xpf - )
rm -f $(LINUXDOCDOC)/Makedoc.sh
find $(LINUXDOCDOC) -type d -print | xargs chmod 755
find $(LINUXDOCDOC) -type f -print | xargs chmod 644
# -- Fix permissions in $(pkgdata_ddir)
find $(pkgdata_ddir) -type d -print | xargs chmod 755
find $(pkgdata_ddir) -type f -print | xargs chmod 644
(cd $(bin_ddir); for i in $(progs); do rm -f $$i; ln -s linuxdoc $$i;done)
# -- Install perl modules
mkdir -p $(perl5libdir)/LinuxDocTools
$(INSTALL_DATA) perl5lib/LinuxDocTools.pm $(perl5libdir)
$(INSTALL_DATA) perl5lib/LinuxDocTools/*.pm $(perl5libdir)/LinuxDocTools
mkdir -m 755 -p $(perl5lib_ddir)/LinuxDocTools
$(INSTALL_DATA) perl5lib/LinuxDocTools.pm $(perl5lib_ddir)
$(INSTALL_DATA) perl5lib/LinuxDocTools/*.pm $(perl5lib_ddir)/LinuxDocTools
# -- Install tex stuff
mkdir -p $(texdir)
$(INSTALL_DATA) tex/* $(texdir)
mkdir -m 755 -p $(tex_ddir)
$(INSTALL_DATA) tex/* $(tex_ddir)
# -- Build and install documentation
@echo "Installing documentation in $(doc_ddir) ..."
(cd doc; \
PATH=${PATH}:$(bin_ddir) \
PREFIX=$(prefix) \
BINDIR=$(auxbin_ddir) \
PKGPERL5LIB=$(perl5lib_ddir) \
PKGDATADIR=$(pkgdata_ddir) \
bash Makedoc.sh)
mkdir -m 755 -p $(doc_ddir)
# cp -r doc/* $(doc_ddir)
( cd doc && tar --exclude='CVS' -cpf - . ) | ( cd $(doc_ddir) && tar -xpf - )
rm -f $(doc_ddir)/Makedoc.sh
find $(doc_ddir) -type d -print | xargs chmod 755
find $(doc_ddir) -type f -print | xargs chmod 644
# what dirs do the targets clean and distclean need?
DDIRS=
......
#!/usr/bin/make -f
#
# Rules makefile for linuxdoc-tools package
#
# Copyright (C) 2007-2008 Agustin Martin <agmartin@debian.org>
#
# Based on debhelper examples by Joey Hess and former Debian/rules
# by Taketoshi Sano and Sven Rudolph
# --------------------------------------------------------------
SHELL = /bin/bash
package = linuxdoc-tools
# for FHS transition
DOCDIR = usr/share/doc/$(package)
MANDIR = usr/share/man
INFODIR = usr/share/info
copyright = debian/$(package).copyright
DESTDIR = $(CURDIR)/debian/tmp
# -- For FHS transition
MANDIR = /usr/share/man
# create linuxdoc-tools copyright file by merging some files
# -- Create linuxdoc-tools copyright file by merging some files
define build_ldt_copyright
cat debian/copyright > $(copyright)
......@@ -34,15 +41,12 @@ build: build-stamp
build-stamp:
dh_testdir
PATH=/usr/bin:$(PATH) ./configure \
--prefix=/usr \
--mandir=/$(MANDIR) \
./configure --prefix=/usr \
--mandir=$(MANDIR) \
--with-installed-nsgmls \
--with-auxbindir=/usr/lib/linuxdoc-tools
$(MAKE) prefix=/usr mandir=/$(MANDIR) \
PERL=/usr/bin/perl \
OPTIMIZE="-g -O2"
$(MAKE) OPTIMIZE="-g -O2"
# --- Rewrite to use sgmlswhich wrapper
......@@ -78,31 +82,28 @@ install: build
dh_installdirs
# --- do 'make install'
$(MAKE) prefix=`pwd`/debian/tmp/usr \
perl5libdir=`pwd`/debian/tmp/usr/share/perl5 \
PERL=/usr/bin/perl \
mandir=`pwd`/debian/tmp/usr/share/man \
auxbindir=`pwd`/debian/tmp/usr/lib/linuxdoc-tools \
texdir=`pwd`/debian/tmp/usr/share/texmf/tex/latex/misc \
$(MAKE) DESTDIR=$(DESTDIR) \
perl5libdir=/usr/share/perl5 \
texdir=/usr/share/texmf/tex/latex/misc \
install
# --- Install shell scripts for sgml2{txt,latex,info}
for i in txt latex info; do \
install -m 755 debian/addition/sgml2$$i \
debian/tmp/usr/bin/sgml2$$i; \
$(DESTDIR)/usr/bin/sgml2$$i; \
done
# ---
install -m 755 debian/addition/sgmlswhich \
debian/tmp/usr/share/linuxdoc-tools/sgmlswhich;
$(DESTDIR)/usr/share/linuxdoc-tools/sgmlswhich;
install -m 755 debian/addition/awkwhich \
debian/tmp/usr/share/linuxdoc-tools/awkwhich;
install -m 755 linuxdoc.new debian/tmp/usr/bin/linuxdoc
$(DESTDIR)/usr/share/linuxdoc-tools/awkwhich;
install -m 755 linuxdoc.new $(DESTDIR)/usr/bin/linuxdoc
# ---
cat debian/linuxdoc-tools.info-base doc/guide.info > doc/linuxdoc-sgml.info
dh_installinfo doc/linuxdoc-sgml.info
# ---
mkdir -p debian/tmp/usr/share/sgml
( cd debian/tmp/usr/share/linuxdoc-tools && mv dtd ../sgml )
mkdir -p $(DESTDIR)/usr/share/sgml
( cd $(DESTDIR)/usr/share/linuxdoc-tools && mv dtd ../sgml )
binary-indep:
dh_testdir -i
......@@ -126,7 +127,7 @@ binary-arch: build install
dh_installchangelogs -a
# - Docs are installed by dh_installdocs
# - We use entities from sgml-data package
dh_install -a --sourcedir=debian/tmp -Xusr/share/doc -Xusr/share/sgml/iso-entities-8879.1986 '*'
dh_install -a --sourcedir=$(DESTDIR) -Xusr/share/doc -Xusr/share/sgml/iso-entities-8879.1986 '*'
dh_installdocs -a -Xdoc/guide.info
dh_installman -a
dh_link -a usr/share/info/linuxdoc-sgml.info.gz \
......
......@@ -15,20 +15,15 @@ function abort()
trap 'abort' 1 2 3 6 9 15
# export BINDIR=${BINDIR}
# export DATADIR=${DATADIR}
export PKGDATADIR=${DATADIR}/linuxdoc-tools
export PERL5LIB=${DATADIR}/linuxdoc-tools:${TMPDIR}
export PERL5LIB=../perl5lib:${TMPDIR}
export PERL5LIB=${TMPDIR}:../perl5lib
mkdir $TMPDIR/Text
sed < ../entity-map/EntityMap.pm.in >$TMPDIR/Text/EntityMap.pm \
-e 's|\@localentitymapdir\@|'${DATADIR}'/entity-map|g' \
-e 's|\@entitymapdir\@|'${DATADIR}'/entity-map/0.1.0|g'
sed < ../entity-map/EntityMap.pm.in > $TMPDIR/Text/EntityMap.pm \
-e 's|\@localentitymapdir\@|'${PKGDATADIR}'/../entity-map|g' \
-e 's|\@entitymapdir\@|'${PKGDATADIR}'/../entity-map/0.1.0|g'
cp -r ${DATADIR}/linuxdoc-tools $TMPDIR
cp -r ${PKGDATADIR} $TMPDIR
NSGMLS=`which nsgmls`
SGMLSASP=`which sgmlsasp`
......@@ -43,7 +38,7 @@ PERL=`which perl`
sed < ../bin/linuxdoc.in >$TMPDIR/linuxdoc \
-e 's!\@prefix\@!'${PREFIX}'!' \
-e 's!\@auxbindir\@!'${auxbindir}'!' \
-e 's!\@auxbindir\@!'${BINDIR}'!' \
-e 's!\@DATADIR\@!'${TMPDIR}'/linuxdoc-tools!' \
-e 's!\@NSGMLS\@!'${NSGMLS}'!' \
-e 's!\@SGMLSASP\@!'${SGMLSASP}'!' \
......@@ -77,7 +72,7 @@ sed -e '/global->{NsgmlsOpts} .= \"-D \/usr\/share\/sgml \"/a \
-e "s,TMPCONFIG,"${DATADIR}"/linuxdoc-tools/dtd/catalog ," \
-e "s,TMPLIBDIR1,"${DATADIR}"/linuxdoc-tools ," \
-e "s,TMPLIBDIR2,/usr/share/sgml ," \
>$TMPDIR/linuxdoc-tools/LinuxDocTools.pm
> $TMPDIR/linuxdoc-tools/LinuxDocTools.pm
if [ -n "`which groff`" ]; then
ln -s $TMPDIR/linuxdoc $TMPDIR/sgml2txt
......
#
# Copyright (C) 1996 Ken MacLeod
# See the file COPYING for distribution terms.
#
# $Id: Makefile.in,v 1.2 2001/11/30 23:41:44 sano Exp $
# See the file COPYING for distribution terms.
#
# DESTDIR modifications by Agustin Martin <agmartin@debian.org>
# ---------------------------------------------------------------------------
SHELL = /bin/sh
SHELL = /bin/sh
PACKAGE=@PACKAGE@
VERSION=@VERSION@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
prefix=@prefix@
exec_prefix=@exec_prefix@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir=@libdir@
datadir=@datadir@
docdir=@docdir@
perl5libdir=@perl5libdir@
textmoddir=@textmoddir@
entitymapdir=@entitymapdir@
localentitymapdir=@localentitymapdir@
libdir = @libdir@
datadir = @datadir@
docdir = @docdir@
perl5libdir = @perl5libdir@
textmoddir = @textmoddir@
entitymapdir = @entitymapdir@
localentitymapdir = @localentitymapdir@
mandir=@mandir@
manext=.3
man3dir=${mandir}/man3
mandir = @mandir@
manext = .3
man3dir = ${mandir}/man3
srcdir=@srcdir@
VPATH=@srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
@SET_MAKE@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
SED=@SED@
PERL5=@PERL5@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
SED = @SED@
PERL5 = @PERL5@
DOCS = \
COPYING \
README
# Now real destination dirs, honouring $(DESTDIR)
doc_ddir = $(DESTDIR)@docdir@
entitymap_ddir = $(DESTDIR)@entitymapdir@
localentitymap_ddir = $(DESTDIR)@localentitymapdir@
sgml_ddir = $(DESTDIR)@sgmldir@
textmod_ddir = $(DESTDIR)@textmoddir@
# -----------------------------------------------------------------------------------------
.SUFFIXES:
.SUFFIXES: .pl .sgml
......@@ -48,25 +56,28 @@ all: EntityMap.pm
EntityMap.pm: EntityMap.pm.in Makefile
${RM} EntityMap.pm
sed <EntityMap.pm.in >EntityMap.pm \
sed < EntityMap.pm.in > EntityMap.pm \
-e 's|[@]localentitymapdir@|${localentitymapdir}|g' \
-e 's|[@]entitymapdir@|${entitymapdir}|g'
install: all installdirs
${INSTALL_DATA} EntityMap.pm ${textmoddir}/EntityMap.pm
cd sdata; $(MAKE) LIBDIR=${entitymapdir} \
${INSTALL_DATA} EntityMap.pm ${textmod_ddir}/EntityMap.pm
cd sdata; $(MAKE) LIBDIR=${entitymap_ddir} \
PERM_D=755 PERM_F=644 MKDIR="../config/install-sh -d" CP=cp install
installdirs:
for ii in ${prefix} ${perl5libdir} ${textmoddir} \
${localentitymapdir} ${entitymapdir}; do \
for ii in \
${perl5lib_ddir} \
${textmod_ddir} \
${localentitymap_ddir} \
${entitymap_ddir}; do \
./config/install-sh -d $$ii; \
done
installdoc:
./config/install-sh -d ${docdir}
./config/install-sh -d ${doc_ddir}
for ii in ${DOCS}; do \
${INSTALL_DATA} $$ii ${docdir}/$$ii; \
${INSTALL_DATA} $$ii ${doc_ddir}/$$ii; \
done
Makefile: Makefile.in configure
......
#
# Copyright (C) 1996 Ken MacLeod
# See the file COPYING for distribution terms.
#
# $Id: Makefile.in,v 1.1.1.1 2001/05/24 15:57:40 sano Exp $
# See the file COPYING for distribution terms.#
#
# DESTDIR modifications by Agustin Martin <agmartin@debian.org>
# ---------------------------------------------------------------------------
SHELL = /bin/sh
SHELL = /bin/sh
PACKAGE=@PACKAGE@
VERSION=@VERSION@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
prefix=@prefix@
exec_prefix=@exec_prefix@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir=@datadir@
docdir=@docdir@
sgmldir=@sgmldir@
isoentdir=@isoentdir@
datadir = @datadir@
docdir = @docdir@
sgmldir = @sgmldir@
isoentdir = @isoentdir@
srcdir=@srcdir@
VPATH=@srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
@SET_MAKE@
INSTALL = @INSTALL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
SED=@SED@
PERL5=@PERL5@
SED = @SED@
PERL5 = @PERL5@
DOCS = \
COPYING \
README
# Now real destination dirs, honouring $(DESTDIR)
doc_ddir = $(DESTDIR)@docdir@
isoent_ddir = $(DESTDIR)@isoentdir@
sgml_ddir = $(DESTDIR)@sgmldir@
.SUFFIXES:
.SUFFIXES: .pl .sgml
......@@ -39,20 +44,20 @@ DOCS = \
all:
install: all installdirs
${INSTALL_DATA} iso-entities.cat ${isoentdir}/iso-entities.cat
${INSTALL_DATA} iso-entities.cat ${isoent_ddir}/iso-entities.cat
for ii in `cd entities; find . -type f`; do \
${INSTALL_DATA} entities/$$ii ${isoentdir}/$$ii; \
${INSTALL_DATA} entities/$$ii ${isoent_ddir}/$$ii; \
done
installdirs:
for ii in ${sgmldir} ${isoentdir}; do \
for ii in ${sgml_ddir} ${isoent_ddir}; do \
./config/install-sh -d $$ii; \
done
installdoc:
./config/install-sh -d ${docdir}
./config/install-sh -d ${doc_ddir}
for ii in ${DOCS}; do \
${INSTALL_DATA} $$ii ${docdir}/$$ii; \
${INSTALL_DATA} $$ii ${doc_ddir}/$$ii; \
done
Makefile: Makefile.in configure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment