#!/usr/bin/make -f # rules file for jade # # The principle of these rules files are simplicity, robustness, # ease of maintenance, and readability through abstraction # # Some bytes in this file may have been touched by Ian Jackson, # so I can never remove his name from this file. Oh boy. pkg-sp := sp pkg-jade := jade pkg-libsp1 := libsp1 pkg-libsp1-dev := libsp1-dev # default SGML dir sgml-dir := /usr/share/sgml old-sgml-dir := /usr/lib/sgml # default SGML pathing default-catalogs := /usr/local/share/sgml/catalog:/usr/local/lib/sgml/catalog:/etc/sgml/catalog # might want to enable :$(old-sgml-dir) here, then again, might not default-sgml-path := /usr/local/share/sgml:/usr/local/lib/sgml:$(sgml-dir) # directory abstraction prefix-jade := debian/$(pkg-jade) bindir-jade := $(prefix-jade)/usr/bin libdir-jade := $(prefix-jade)/usr/lib/$(pkg-jade) sgmldir-jade := $(prefix-jade)$(sgml-dir)/jade docdir-jade := $(prefix-jade)/usr/share/doc/$(pkg-jade) infodir-jade := $(prefix-jade)/usr/share/info sharedir-jade := $(prefix-jade)/usr/share prefix-sp := debian/$(pkg-sp) bindir-sp := $(prefix-sp)/usr/bin confdir-sp := $(prefix-sp)/etc libdir-sp := $(prefix-sp)/usr/lib/$(pkg-sp) sgmldir-sp := $(prefix-sp)$(sgml-dir)/sp old-sgmldir-sp := $(prefix-sp)$(old-sgml-dir)/declaration docdir-sp := $(prefix-sp)/usr/share/doc/$(pkg-sp) infodir-sp := $(prefix-sp)/usr/share/info sharedir-sp := $(prefix-sp)/usr/share prefix-libsp1 := debian/$(pkg-libsp1) docdir-libsp1 := $(prefix-libsp1)/usr/share/doc/$(pkg-libsp1) libdir-libsp1 := $(prefix-libsp1)/usr/lib prefix-libsp1-dev := debian/$(pkg-libsp1-dev) incdir-libsp1-dev := $(prefix-libsp1-dev)/usr/include/$(pkg-sp) docdir-libsp1-dev := $(prefix-libsp1-dev)/usr/share/doc/$(pkg-libsp1-dev) libdir-libsp1-dev := $(prefix-libsp1-dev)/usr/lib # build tool abstraction install_file := install -o root -g root -m 644 -p install_script := install -o root -g root -m 755 -p install_program := install -o root -g root -m 755 -p make_directory := install -d -o root -g root -m 755 compress := gzip -9f # debhelper compatability mode export DH_COMPAT=3 # debhelper verbose #export DH_VERBOSE=1 # first version of package providing the right shlibs SHLIBS_PKGVER := 1.3.4-1.2.1-30 # determine our version numbers SRC_VERSION := $(shell LC_ALL=C dpkg-parsechangelog | sed -n 's/^Version: *//p') SP_VERSION := $(shell cat VERSION) # determine our top level SRCDIR := $(shell pwd) CFLAGS := -g -pipe CXXFLAGS := -g -pipe -D_REENTRANT #COMPILER := CC="gcc" CXX="g++" CC := gcc CXX := g++ # work around broken C++ compiler on alpha, s390 and m68k DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH) ### Remove, see if still necessary # ifneq ($(DEB_BUILD_ARCH),alpha) # CXXFLAGS += -O2 # endif ifeq ($(DEB_BUILD_ARCH),s390) CC := gcc-3.2 CXX := g++-3.2 endif ifeq ($(DEB_BUILD_ARCH),m68k) CC := gcc-3.3 CXX := g++-3.3 endif # policy recommendations ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 CXXFLAGS += -O0 else ifeq ($(DEB_BUILD_ARCH),hppa) CFLAGS += -O0 CXXFLAGS += -O0 else CFLAGS += -O2 CXXFLAGS += -O2 endif endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif version-test: @echo Debian version is $(SRC_VERSION) @echo upstream version is $(UPSTREAM_VERSION) config.status: CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CC="$(CC)" CXX="$(CXX)" \ ./configure --prefix=/usr --enable-html \ --enable-http --enable-static --enable-shared --enable-mif \ --enable-default-catalog=$(default-catalogs) \ --enable-default-search-path=$(default-sgml-path) sed -e "s/CC=\"gcc\"/CC=\"$(CXX)\"/g" libtool > libtool.tmp && mv -f libtool.tmp libtool build: config.status $(checkdir) -$(CC) --version $(MAKE) touch build clean: $(checkdir) # update config.sub and config.guess, from autotools-dev test -r /usr/share/misc/config.sub && \ cp -f /usr/share/misc/config.sub config/ test -r /usr/share/misc/config.guess && \ cp -f /usr/share/misc/config.guess config/ rm -f build binary-arch $(MAKE) clean test ! -f Makefile.dist || $(MAKE) mrproper rm -f `find . -name "*~"` rm -rf $(prefix-sp) $(prefix-libsp1) $(prefix-libsp1-dev) rm -rf $(prefix-jade) rm -f debian/copyright debian/files* core # remove some autoconf spam rm -f conftest* # force the M4 files to rebuild, timestamps can't be trusted find . -name '*.m4' | xargs chmod +w find . -name '*.m4' | xargs touch # these are created in the binary-arch rule rm -f debian/README.Debian debian/substvars debian/shlibs* \ debian/sp.conffiles debian/*.substvars # some stuff that should be cleaned in upstream Makefile find . -name 'Makefile.dep' | xargs rm -f rm -f libtool dh_clean binary-indep: build # There are no architecture-independent files to be uploaded # generated by this package. binary-arch: build $(checkdir) $(checkroot) dh_clean -k # lets create our debian-std copyright file; I like to ensure # I have a verbatim copy of the upstream copyright by cat'ing # the Debian-specific stuff to the end cat COPYING debian/copyright.Debian > debian/copyright # substvar used to indicated our version of sp and libsp1 : > debian/substvars echo "$(pkg-sp):Version=$(pkg-sp) (= $(SP_VERSION)-$(SRC_VERSION))" \ >> debian/substvars echo "$(pkg-libsp1):Version=$(pkg-libsp1) (= $(SP_VERSION)-$(SRC_VERSION))" \ >> debian/substvars echo "$(pkg-libsp1):ShlibVersion=$(pkg-libsp1) (>= $(SHLIBS_PKGVER))" \ >> debian/substvars : > debian/${pkg-libsp1-dev}.substvars echo "$(pkg-libsp1):Version=$(pkg-libsp1) (= $(SP_VERSION)-$(SRC_VERSION))" \ >> debian/${pkg-libsp1-dev}.substvars # substitution in README.Debian sed -e 's|%{default-catalogs}|$(default-catalogs)|; \ s|%{default-sgml-path}|$(default-sgml-path)|; \ s|%{sgml-dir}|$(sgml-dir)|;' \ debian/README.Debian.in > debian/README.Debian ## ## install sp suite $(make_directory) $(bindir-sp) $(sgmldir-sp) $(docdir-sp) \ $(libdir-sp) $(confdir-sp) $(MAKE) install PROGDIRS="nsgmls spam sgmlnorm spent sx" LIBDIRS="" \ prefix=$(SRCDIR)/$(prefix-sp)/usr INSTALL="$(install_script)" mv $(bindir-sp)/sx $(bindir-sp)/sgml2xml # The place for sp pubtext, clearly indicated in the LSB (stripped of # package versioning), is /usr/share/sgml/sp/; we provide compatability # symlinks to the old location, represented by old-sgmldir-sp. # install declarations $(make_directory) $(sgmldir-sp) $(install_file) japan.sgmldecl $(sgmldir-sp)/japan.decl $(install_file) debian/sp_implied.decl $(sgmldir-sp) # install xml.soc, this is the expected location $(make_directory) $(prefix-sp)$(sgml-dir)/declaration $(install_file) pubtext/xml.soc $(prefix-sp)$(sgml-dir)/declaration # install unicode stuff $(make_directory) $(sgmldir-sp)/unicode $(install_file) unicode/catalog unicode/demo.sgm unicode/unicode.syn \ $(sgmldir-sp)/unicode/ $(install_file) unicode/unicode.sd $(sgmldir-sp)/unicode/unicode.decl # putting this script here is a little perverse $(install_script) unicode/gensyntax.pl $(sgmldir-sp)/unicode/ # compatability from /usr/lib/sp/unicode ln -s ../../share/sgml/sp/unicode $(libdir-sp)/unicode # compatability symlinks in old-sgmldir-sp $(make_directory) $(old-sgmldir-sp) set -e; for i in $(sgmldir-sp)/*; do \ base=`basename $$i` ;\ ln -s ../../../share/sgml/sp/$$base \ $(old-sgmldir-sp)/$$base ;\ done # install HTML documentation dh_installdocs -p$(pkg-sp) README doc/*.htm # now sx is named sgml2xml, change it in the doco perl -pi -e 's/sx/sgml2xml/g; s/SX/SGML2XML/g;' \ $(docdir-sp)/sx.htm perl -pi -e 's/>sx/>sgml2xml/g; s/>SX/>SGML2XML/g;' \ $(docdir-sp)/index.htm $(docdir-sp)/new.htm dh_installchangelogs -p$(pkg-sp) dh_installexamples -p$(pkg-sp) dsssl/FOT.tex dsssl/demo* # install man pages dh_installman -p$(pkg-sp) debian/nsgmls.1 debian/spam.1 debian/spent.1 \ debian/sgml2xml.1 debian/sgmlnorm.1 # make sure control files are good sh -n debian/sp.postinst sh -n debian/sp.prerm ## ## install libsp1 $(make_directory) $(prefix-libsp1)/usr/lib $(prefix-libsp1)/DEBIAN # std shlibs file, with the first version that supplied the version # that applications should build with # should work but doesn't # dh_makeshlibs -p$(pkg-libsp1) -V'$(pkg-libsp1) (>=$(SHLIBS_PKGVER))' # do it by hand : > $(prefix-libsp1)/DEBIAN/shlibs echo "libsp 1 $(pkg-libsp1) (>= $(SHLIBS_PKGVER))" >> $(prefix-libsp1)/DEBIAN/shlibs echo "libgrove 1 $(pkg-libsp1) (>= $(SHLIBS_PKGVER))" >> $(prefix-libsp1)/DEBIAN/shlibs echo "libspgrove 1 $(pkg-libsp1) (>= $(SHLIBS_PKGVER))" >> $(prefix-libsp1)/DEBIAN/shlibs echo "libstyle 1 $(pkg-libsp1) (>= $(SHLIBS_PKGVER))" >> $(prefix-libsp1)/DEBIAN/shlibs chmod 0644 $(prefix-libsp1)/DEBIAN/shlibs chown 0.0 $(prefix-libsp1)/DEBIAN/shlibs $(MAKE) install PROGDIRS="" LIBDIRS="lib grove spgrove style" \ prefix=$(SRCDIR)/$(prefix-libsp1)/usr INSTALL="$(install_file)" rm -f $(libdir-libsp1)/*.so $(libdir-libsp1)/*.a $(libdir-libsp1)/*.la # install Debian-std docs dh_installdocs -p$(pkg-libsp1) README dh_installchangelogs -p$(pkg-libsp1) $(install_file) debian/README.sp-dev $(docdir-libsp1)/README.Debian ## ## install libsp1-dev $(make_directory) $(incdir-libsp1-dev) $(make_directory) $(prefix-libsp1-dev)/DEBIAN \ $(prefix-libsp1-dev)/usr/lib $(MAKE) install PROGDIRS="" LIBDIRS="lib grove spgrove style" \ prefix=$(SRCDIR)/$(prefix-libsp1-dev)/usr INSTALL="$(install_script)" rm -f $(libdir-libsp1-dev)/*.so.* $(libdir-libsp1-dev)/*.la # includes $(install_file) include/*.* $(incdir-libsp1-dev) $(install_file) generic/*.h $(incdir-libsp1-dev) $(install_file) grove/Node.h $(incdir-libsp1-dev) $(install_file) spgrove/GroveApp.h $(incdir-libsp1-dev) $(install_file) spgrove/GroveBuilder.h $(incdir-libsp1-dev) $(install_file) style/FOTBuilder.h style/GroveManager.h \ style/DssslApp.h style/dsssl_ns.h $(incdir-libsp1-dev) # install Debian-std docs dh_installdocs -p$(pkg-libsp1-dev) README dh_installchangelogs -p$(pkg-libsp1-dev) $(install_file) debian/README.sp-dev $(docdir-libsp1-dev)/README.Debian ## ## install jade $(make_directory) $(bindir-jade) $(sgmldir-jade) $(docdir-jade) \ $(libdir-jade) $(MAKE) install PROGDIRS="jade" LIBDIRS="" \ prefix=$(SRCDIR)/$(prefix-jade)/usr INSTALL="$(install_script)" # check these in dsssl/catalog $(make_directory) $(sgmldir-jade) $(install_file) dsssl/*.dtd dsssl/catalog \ $(sgmldir-jade) # make the links /usr/share/sgml-data/sgml-catalog-check.pl -l -v 0 -d \ $(prefix-jade)/usr/share/sgml $(sgmldir-jade)/catalog # install HTML documentation dh_installdocs -p$(pkg-jade) jadedoc/*.htm ln -s jade.htm $(docdir-jade)/index.html dh_installchangelogs -p$(pkg-jade) # install man pages dh_installman -p$(pkg-jade) debian/jade.1 # install examples dh_installexamples -p$(pkg-jade) dsssl/demo.* dsssl/FOT.tex # make sure control files are good sh -n debian/jade.postinst sh -n debian/jade.prerm dh_strip -a dh_compress -a dh_fixperms -a dh_installdeb -a # put it all together dh_shlibdeps -l $(libdir-libsp1) -a # control files for sp, libsp1, and libsp1-dev have a different # version dh_gencontrol -p$(pkg-sp) -- -v$(SP_VERSION)-$(SRC_VERSION) dh_gencontrol -p$(pkg-libsp1) -- -v$(SP_VERSION)-$(SRC_VERSION) dh_gencontrol -p$(pkg-libsp1-dev) -- -v$(SP_VERSION)-$(SRC_VERSION) # jade is more normal dh_gencontrol -p$(pkg-jade) dh_md5sums -a dh_builddeb -a touch binary-arch define checkdir test -f debian/rules test -f VERSION endef # Below here is fairly generic really define checkroot test `id -u` = 0 endef binary: binary-indep binary-arch .PHONY: binary binary-indep clean #Local variables: #mode: makefile #End: