Vulkan-Docs/doc/specs/vulkan/genRelease

87 lines
2.8 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
def buildRelease(branch,label,outdir,targets):
global root, xml, spec
print('echo Info: Generating branch=' + branch,
'label=' + label,
'outdir=' + outdir)
print('git checkout', branch)
print('echo Info: Generating headers and spec include files')
print('cd', xml)
print('make clobber full_install')
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 spec')
print('make specversion.txt')
print('make -j 4 OUTDIR=' + outdir, ' NOTEOPTS="-a implementation-guide"', targets)
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'
# 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 in the 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
coretargets='xhtml pdf styleguide manhtml manpdf manhtmlpages'
buildRelease(corebranch, corebranch, outdir + corebranch, coretargets)
wsitargets='xhtml pdf'
buildRelease(wsibranch, wsibranch, outdir + wsibranch, wsitargets)
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)
print('echo git push --tags')