Changeset 97454


Ignore:
Timestamp:
Sep 6, 2012, 10:00:13 PM (8 years ago)
Author:
wsiegrist@…
Message:

Add Linux support to guide generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc-new/Makefile

    r94337 r97454  
    77# here.
    88
     9UNAME := $(shell uname)
    910
    1011# Prefix of the MacPorts installation.
    1112PREFIX = /opt/local
     13ifeq ($(UNAME), Linux)
     14PREFIX = /usr
     15endif
    1216
    1317# Command abstraction variables.
     
    1721LN       = /bin/ln
    1822SED      = /usr/bin/sed
     23ifeq ($(UNAME), Linux)
     24SED      = /bin/sed
     25endif
    1926TCLSH    = /usr/bin/tclsh
    2027XSLTPROC = $(PREFIX)/bin/xsltproc
     
    3845# Path to the DocBook XSL files.
    3946DOCBOOK         = $(PREFIX)/share/xsl/docbook-xsl
     47ifeq ($(UNAME), Linux)
     48DOCBOOK         = /usr/local/share/xsl/docbook-xsl
     49endif
    4050GUIDE_XSL       = $(GUIDE)/resources/single-page.xsl
    4151GUIDE_XSL_CHUNK = $(GUIDE)/resources/chunk.xsl
     
    5464        $(CP) $(GUIDE)/resources/$(STYLESHEET) $(GUIDE_RESULT)/$(STYLESHEET)
    5565        $(CP) $(GUIDE)/resources/images/* $(GUIDE_RESULT)/
     66ifeq ($(UNAME), Linux)
     67        $(LN) -sfn $(DOCBOOK) $(GUIDE)/resources/xsl
     68else
    5669        $(LN) -sfh $(DOCBOOK) $(GUIDE)/resources/xsl
     70endif
    5771        $(XSLTPROC) --xinclude \
    5872            --output $(GUIDE_RESULT)/index.html \
     
    6074        # Convert all sections (h1-h9) to a link so it's easy to link to them.
    6175        # If someone knows a better way to do this please change it.
     76ifeq ($(UNAME), Linux)
     77        $(SED) -i -r -e \
     78            's|(<h[0-9] [^>]*><a id="([^"]*)"></a>)([^<]*)(</h[0-9]>)|\1<a href="#\2">\3</a>\4|g' \
     79            $(GUIDE_RESULT)/index.html
     80else
    6281        $(SED) -i "" -E \
    6382            's|(<h[0-9] [^>]*><a id="([^"]*)"></a>)([^<]*)(</h[0-9]>)|\1<a href="#\2">\3</a>\4|g' \
    6483            $(GUIDE_RESULT)/index.html
     84endif
    6585
    6686# Generate the chunked HTML guide with one section per file.
     
    6989        $(CP) $(GUIDE)/resources/$(STYLESHEET) $(GUIDE_RESULT_CHUNK)/$(STYLESHEET)
    7090        $(CP) $(GUIDE)/resources/images/* $(GUIDE_RESULT_CHUNK)/
     91ifeq ($(UNAME), Linux)
     92        $(LN) -sfn $(DOCBOOK) $(GUIDE)/resources/xsl
     93else
    7194        $(LN) -sfh $(DOCBOOK) $(GUIDE)/resources/xsl
     95endif
    7296        $(XSLTPROC) --xinclude \
    7397            --output $(GUIDE_RESULT_CHUNK)/index.html \
     
    7599        # Convert all sections (h1-h9) to a link so it's easy to link to them.
    76100        # If someone knows a better way to do this please change it.
     101ifeq ($(UNAME), Linux)
     102        $(SED) -i -r -e \
     103            's|(<h[0-9] [^>]*><a id="([^"]*)"></a>)([^<]*)(</h[0-9]>)|\1<a href="#\2">\3</a>\4|g' \
     104            $(GUIDE_RESULT_CHUNK)/*.html
     105else
    77106        $(SED) -i "" -E \
    78107            's|(<h[0-9] [^>]*><a id="([^"]*)"></a>)([^<]*)(</h[0-9]>)|\1<a href="#\2">\3</a>\4|g' \
    79108            $(GUIDE_RESULT_CHUNK)/*.html
     109endif
    80110        # Add the table of contents to every junked HTML file.
    81111        # If someone knows a better way to do this please change it.
     
    102132        $(CP) $(GUIDE_SRC)/portfile-*.xml $(MAN_TMP)
    103133        $(CP) $(GUIDE_SRC)/portgroup-*.xml $(MAN_TMP)
     134ifeq ($(UNAME), Linux)
     135        $(SED) -i -r -e 's|<section|<refsection|g' $(MAN_TMP)/*
     136        $(SED) -i -r -e 's|</section>|</refsection>|g' $(MAN_TMP)/*
     137else
    104138        $(SED) -i "" 's|<section|<refsection|g' $(MAN_TMP)/*
    105139        $(SED) -i "" 's|</section>|</refsection>|g' $(MAN_TMP)/*
     140endif
    106141        $(XSLTPROC) --xinclude --output $(MAN_RESULT) $(MAN_XSL) \
    107142            $(MAN_SRC)/port.1.xml \
     
    113148# Create XSL from template for man pages.
    114149$(MAN_XSL):
     150ifeq ($(UNAME), Linux)
     151        $(SED) -r -e 's:@PREFIX@:$(PREFIX):' $@.in > $@
     152else
    115153        $(SED) 's:@PREFIX@:$(PREFIX):' $@.in > $@
     154endif
    116155
    117156# Remove all temporary files generated by guide: and man:.
Note: See TracChangeset for help on using the changeset viewer.