[llvm-commits] [hlvm] r38223 - in /hlvm/trunk/build: configure.py documentation.py hlvm.py

Reid Spencer reid at x10sys.com
Sat Jul 7 17:01:18 PDT 2007


Author: reid
Date: Sat Jul  7 19:01:18 2007
New Revision: 38223

URL: http://llvm.org/viewvc/llvm-project?rev=38223&view=rev
Log:
Add rules for building HTML and man pages from Perl POD pages.

Modified:
    hlvm/trunk/build/configure.py
    hlvm/trunk/build/documentation.py
    hlvm/trunk/build/hlvm.py

Modified: hlvm/trunk/build/configure.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/configure.py?rev=38223&r1=38222&r2=38223&view=diff

==============================================================================
--- hlvm/trunk/build/configure.py (original)
+++ hlvm/trunk/build/configure.py Sat Jul  7 19:01:18 2007
@@ -190,6 +190,8 @@
     ret = fname != None
     if ret:
       ctxt.env[varname] = fname
+    else:
+      ctxt.env[varname] = None
   ctxt.Result(ret)
   if critical and not ret:
     print "Required Program '" + progname + "' is missing."
@@ -243,14 +245,13 @@
   conf.CheckProgram('llvm-gcc','with_llvmgcc')
   conf.CheckProgram('llvm-g++','with_llvmgxx')
   conf.CheckProgram('gperf','with_gperf')
+  conf.CheckProgram('pod2html','with_pod2html',[],0)
+  conf.CheckProgram('pod2man','with_pod2man',[],0)
   if not conf.CheckProgram('runtest','with_runtest',[],0):
-    env['with_runtest'] = None
     print "*** TESTING DISABLED ***"
   if not conf.CheckProgram('doxygen','with_doxygen',[],0):
-    env['with_runtest'] = None
     print "*** DOXYGEN DISABLED ***"
   if not conf.CheckProgram('xsltproc','with_xsltproc',[],0):
-    env['with_runtest'] = None
     print "*** XSLTPROC DISABLED ***"
   return 1
 

Modified: hlvm/trunk/build/documentation.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/documentation.py?rev=38223&r1=38222&r2=38223&view=diff

==============================================================================
--- hlvm/trunk/build/documentation.py (original)
+++ hlvm/trunk/build/documentation.py Sat Jul  7 19:01:18 2007
@@ -5,6 +5,7 @@
 from string import join as sjoin
 from os.path import join as pjoin
 from os.path import exists
+import os.path as path
 
 def getHeaders(env):
   context = pjoin(env['AbsSrcRoot'],'hlvm')
@@ -55,9 +56,9 @@
   tarfile = target[0].path
   tgtdir  = target[0].dir.path
   srcpath = source[0].path
-  env.Execute(Copy(tarfile,srcpath))
-  env.Execute(env['TAR'] + ' zxf ' + tarfile + ' -C ' + tgtdir )
-  return 0
+  if not env.Execute(Copy(tarfile,srcpath)):
+    return env.Execute(env['TAR'] + ' zxf ' + tarfile + ' -C ' + tgtdir )
+  return 1
 
 def DoxygenInstall(env):
   doxyInstAction = env.Action(DoxygenInstallAction,DoxygenInstallMessage)
@@ -69,10 +70,36 @@
   return "Creating " + target[0].path + " via XSLT from " + source[0].path
 
 def XSLTAction(target,source,env):
-  env.Execute( env['with_xsltproc'] + ' ' + source[0].path + ' ' + 
+  return env.Execute( env['with_xsltproc'] + ' ' + source[0].path + ' ' + 
     source[1].path + ' >' + target[0].path )
 
 def XSLTproc(env):
   xsltAction = env.Action(XSLTAction,XSLTMessage)
   xsltBuilder = env.Builder(action=xsltAction)
   env.Append(BUILDERS = {'XSLTproc':xsltBuilder} )
+
+def Pod2HtmlMessage(target,source,env):
+  return "Generating HTML From POD: " + source[0].path 
+  
+def Pod2HtmlAction(target,source,env):
+  title = path.splitext(path.basename(source[0].path))[0]
+  return env.Execute( env['with_pod2html'] + ' --css=man.css --htmlroot=.' +
+      ' --podpath=. --noindex --infile=' + source[0].path + 
+      ' --outfile=' + target[0].path + ' --title="' + title + ' command"')
+
+def Pod2ManMessage(target,source,env):
+  return "Generating MAN Page From POD: " + source[0].path 
+  
+def Pod2ManAction(target,source,env):
+  title = path.splitext(path.basename(source[0].path))[0]
+  return env.Execute( env['with_pod2man'] + ' --release=CVS' +
+    ' --center="HLVM Tools Manual" ' + source[0].path + ' ' + target[0].path )
+
+def PodGen(env):
+  p2hAction = env.Action(Pod2HtmlAction,Pod2HtmlMessage)
+  p2hBuildr = env.Builder(action=p2hAction,suffix='.html',src_suffix='.pod',
+      single_source=1)
+  p2mAction = env.Action(Pod2ManAction,Pod2ManMessage)
+  p2mBuildr = env.Builder(action=p2mAction,suffix='.1',src_suffix='.pod',
+      single_source=1)
+  env.Append(BUILDERS = {'Pod2Html':p2hBuildr, 'Pod2Man':p2mBuildr} )

Modified: hlvm/trunk/build/hlvm.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/hlvm.py?rev=38223&r1=38222&r2=38223&view=diff

==============================================================================
--- hlvm/trunk/build/hlvm.py (original)
+++ hlvm/trunk/build/hlvm.py Sat Jul  7 19:01:18 2007
@@ -58,6 +58,10 @@
   from build import documentation
   return documentation.XSLTproc(env)
 
+def GetPodGen(env):
+  from build import documentation
+  return documentation.PodGen(env)
+
 def Dirs(env,dirlist=[]):
   dir = env.Dir('.').path
   if (dir == env.Dir('#').path):
@@ -98,11 +102,20 @@
 
 def InstallDocs(env,docs):
   if 'install' in COMMAND_LINE_TARGETS:
-    dir = pjoin(env['prefix'],'docs')
+    moddir = strrepl(env.Dir('.').path,pjoin(env['BuildDir'],''),'',1)
+    dir = pjoin(env['prefix'],moddir)
     if not exists(dir):
       env.Execute(Mkdir(dir))
     env.Install(dir=dir,source=docs)
 
+def InstallMan(env,mans):
+  if 'install' in COMMAND_LINE_TARGETS:
+    dir = pjoin(env['prefix'],'docs','man','man1')
+    if not exists(dir):
+      env.Execute(Mkdir(dir))
+    env.Install(dir=dir,source=mans)
+
+
 def GetBuildEnvironment(targets,arguments):
   env = Environment();
   env.EnsurePythonVersion(2,3)
@@ -159,6 +172,10 @@
            '/usr/local/bin/doxygen')
   opts.Add('with_xsltproc','Specify where the XSLT processor is located',
            '/usr/local/bin/xsltproc')
+  opts.Add('with_pod2html','Specify where the POD to HTML generator is located',
+           '/usr/local/bin/pod2html')
+  opts.Add('with_pod2man','Specify where the POD to MAN generator is located',
+           '/usr/local/bin/pod2man')
   opts.Update(env)
   env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer'
   env['HLVM_Maintainer'] = 'Reid Spencer <rspencer at reidspencer>'
@@ -266,4 +283,3 @@
   env['HLVM_ConfigTime'] = now.ctime();
   opts.Save(options_file,env)
   return env
-





More information about the llvm-commits mailing list