Vulkan-Docs/doc/specs/vulkan/genRelease

97 lines
3.1 KiB
Python
Executable File

#!/usr/bin/python3
import time
from datetime import *
# This script builds a full release package including XHTML and PDF
# versions of the specified branches (usually 1.0 and 1.0-wsi_extensions,
# but tags or commits can be used as well). Other files in the release
# directory are removed, including man pages, XHTML chunked, HTML,
# validity output, etc.
#
# Both branches must be fully committed and up to date when the script
# is run, with no outstanding un-added / un-committed files. Both
# branches must have fully regnerated all automatically-regeneratable
# files. After completing the build, the current branch is set to
# the first (core) branch and suggestions for creating tags are printed out.
# branch = branch or commit or tag name
# label = textual label to apply
# outdir = directory to generate specs in
# xmlTargets = targets to build in src/spec/
# specTargets = targets to build in doc/specs/vulkan/
def buildRelease(branch,label,outdir,xmlTargets,specTargets):
global root, xml, spec
print('echo Info: Generating branch=' + branch,
'label=' + label,
'outdir=' + outdir)
print('git checkout', branch)
print('echo Info: Cleaning spec in', outdir)
print('cd', spec)
print('rm -rf',
outdir + '/man',
outdir + '/xhtml',
outdir + '/pdf',
outdir + '/chunked',
outdir + '/vkspec.html',
'specversion.txt')
print('echo Info: Generating headers and spec include files')
print('cd', xml)
print('make OUTDIR=' + outdir, xmlTargets)
print('echo Info: Generating spec')
print('cd', spec)
print('make specversion.txt')
print('make -j 4 OUTDIR=' + outdir, ' NOTEOPTS="-a implementation-guide"',
specTargets)
print('rm', outdir + '/pdf/vkspec.xml')
# Main
global root, xml, spec
# Root of the Vulkan git repo containing the specs
root = '/home/tree/git/Vulkan-Docs'
# Directory with vk.xml and generation tools
xml = root + '/src/spec'
# Directory with spec sources
spec = root + '/doc/specs/vulkan'
# Output directory, which does not have to be (and probably
# should not be) in the spec repo
outdir = '/home/tree/git/Vulkan-Web-Registry/specs/'
# These can be changed to tags, etc.
corebranch = '1.0'
wsibranch = '1.0-wsi_extensions'
# date in YYYYMMDD format
now = datetime.today().strftime('%Y%m%d')
# Generate specs
coreXmlTargets='clobber full_install pdf_install'
coreSpecTargets='xhtml pdf styleguide manhtml manpdf manhtmlpages'
buildRelease(corebranch, corebranch, outdir + corebranch,
coreXmlTargets, coreSpecTargets)
wsiXmlTargets='clobber full_install'
wsiSpecTargets='xhtml pdf'
buildRelease(wsibranch, wsibranch, outdir + wsibranch,
wsiXmlTargets, wsiSpecTargets)
print('echo Info: post-generation cleanup')
print('git checkout ' + corebranch)
print('echo To tag the spec branches, execute these commands:')
print('echo git checkout', corebranch)
print('echo git tag -a -m \\"Tag core API specification for', now,
'release\\"', 'v1.0-core-' + now)
print('echo git checkout', wsibranch)
print('echo git tag -a -m \\"Tag core+WSI API specification for', now,
'release\\"', 'v1.0-core+wsi-' + now)