[geany/geany-plugins] b4ee42: Build the leg compiler and use it to generate markdown_parser.c during the build process
Enrico Tröger
git-noreply at xxxxx
Sun Mar 10 10:40:30 UTC 2013
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger at uvena.de>
Committer: Enrico Tröger <enrico.troeger at uvena.de>
Date: Sun, 10 Mar 2013 10:40:30 UTC
Commit: b4ee428472e18054b2cf26d6c2f1395c92f54325
https://github.com/geany/geany-plugins/commit/b4ee428472e18054b2cf26d6c2f1395c92f54325
Log Message:
-----------
Build the leg compiler and use it to generate markdown_parser.c during the build process
Modified Paths:
--------------
markdown/wscript_build
Modified: markdown/wscript_build
78 files changed, 63 insertions(+), 15 deletions(-)
===================================================================
@@ -20,9 +20,12 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from build.wafutils import build_plugin
+from build.wafutils import build_plugin, target_is_win32
+from waflib.Task import Task
+from waflib.TaskGen import extension
from waflib.Utils import subst_vars
+
name = 'Markdown'
includes = [ 'src' ]
defines = [ subst_vars('MARKDOWN_DATA_DIR="${PKGDATADIR}/markdown"', bld.env),
@@ -33,6 +36,7 @@ sources = [ "src/conf.c",
"src/plugin.c",
"src/viewer.c" ]
+# sources for embedded peg-markdown library
sources_peg_markdown = [ "peg-markdown/markdown_lib.c",
"peg-markdown/markdown_output.c",
"peg-markdown/markdown_parser.c",
@@ -40,25 +44,69 @@ sources_peg_markdown = [ "peg-markdown/markdown_lib.c",
"peg-markdown/parsing_functions.c",
"peg-markdown/utility_functions.c" ]
-# if we didn't find the Discount/libmarkdown library, use the embedded peg-markdown library
-if not bld.env['LIB_DISCOUNT']:
+# sources for peg utility
+sources_peg = [ "peg-markdown/peg-0.1.9/leg.c",
+ "peg-markdown/peg-0.1.9/compile.c",
+ "peg-markdown/peg-0.1.9/tree.c" ]
+
+
+def _build_peg_markdown():
+ class PegLeg(Task):
+ run_str = '${SRC[0].abspath()} -o ${TGT} ${SRC[1].abspath()}'
+ color = 'PINK'
+
+ @extension('.leg')
+ def process_leg(self, node):
+ tg = self.bld.get_tgen_by_name('LEG')
+ leg = tg.link_task.outputs[0]
+ tsk = self.create_task('PegLeg', [leg, node], node.change_ext('.c'))
+ self.source.extend(tsk.outputs)
+
+ # build peg utility
+ bld.new_task_gen(
+ features = ['c', 'cprogram'],
+ name = 'LEG',
+ target = 'leg',
+ source = sources_peg,
+ includes = ['markdown/peg-markdown/peg-0.1.9'],
+ install_path = None)
+
+ # put all following tasks into a new group to get the build order right
+ bld.add_group()
+
+ # generate markdown_parser.c
+ bld.new_task_gen(
+ features = ['c'],
+ use = libraries,
+ target = 'markdown_parser.c',
+ source = 'peg-markdown/markdown_parser.leg')
+
# tell the code about what we want
defines.append('FULL_PRICE=1')
- # add peg-markdown
includes.append('peg-markdown')
sources.extend(sources_peg_markdown)
-build_plugin(bld, name, sources=sources, includes=includes, libraries=libraries, defines=defines)
+def _build_plugin():
+ build_plugin(bld, name, sources=sources, includes=includes, libraries=libraries, defines=defines)
+
-# install docs
-helpfiles = [ 'docs/help.html',
- 'docs/plugin.png',
- 'docs/plugin_mgr.png',
- 'docs/plugin_prefs.png',
- 'docs/plugin_small.png',
- 'docs/set_filetype.png',
- 'docs/settings.png' ]
+def _install_docs():
+ # install docs
+ helpfiles = [ 'docs/help.html',
+ 'docs/plugin.png',
+ 'docs/plugin_mgr.png',
+ 'docs/plugin_prefs.png',
+ 'docs/plugin_small.png',
+ 'docs/set_filetype.png',
+ 'docs/settings.png' ]
+ docdir = '${G_PREFIX}/doc/plugins' if target_is_win32(bld) else '${DOCDIR}'
+ bld.install_files('%s/markdown/html' % docdir, helpfiles)
-docdir = '${G_PREFIX}/doc/plugins' if target_is_win32(bld) else '${DOCDIR}'
-bld.install_files('%s/markdown/html' % docdir, helpfiles)
+
+
+# if we didn't find the Discount/libmarkdown library, build and use the embedded peg-markdown library
+if not bld.env['LIB_DISCOUNT']:
+ _build_peg_markdown()
+_build_plugin()
+_install_docs()
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list