[geany/geany-plugins] c4bc3c: Improve Waf support for Markdown plugin

Enrico Tröger git-noreply at xxxxx
Thu Mar 7 22:20:38 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:        Thu, 07 Mar 2013 22:20:38 UTC
Commit:      c4bc3c8c773aefcfb79cbdbffd6fdf52b7b3991b
             https://github.com/geany/geany-plugins/commit/c4bc3c8c773aefcfb79cbdbffd6fdf52b7b3991b

Log Message:
-----------
Improve Waf support for Markdown plugin

Now the Discount library is checked first and used if available. The embedded markdown
library is used as fallback.


Modified Paths:
--------------
    markdown/wscript_build
    markdown/wscript_configure

Modified: markdown/wscript_build
16 files changed, 16 insertions(+), 0 deletions(-)
===================================================================
@@ -33,6 +33,22 @@ sources = [ "src/conf.c",
             "src/plugin.c",
             "src/viewer.c" ]
 
+sources_peg_markdown = [ "peg-markdown/markdown_lib.c",
+                         "peg-markdown/markdown_output.c",
+                         "peg-markdown/markdown_parser.c",
+                         "peg-markdown/odf.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']:
+    # 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)
 
 # install docs


Modified: markdown/wscript_configure
12 files changed, 9 insertions(+), 3 deletions(-)
===================================================================
@@ -21,6 +21,8 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 from build.wafutils import check_cfg_cached
+from waflib.Errors import ConfigurationError
+
 
 packages = [ ('gtk+-2.0', '2.16', 'GTK'),
              ('gthread-2.0', '', 'GTHREAD'),
@@ -34,9 +36,13 @@ for package_name, package_version, uselib_store in packages:
                      mandatory=True,
                      args='--cflags --libs')
 
-conf.check(header_name='mkdio.h',
+try:
+    # try Discount/libmarkdown
+    conf.check(header_name='mkdio.h',
            mandatory=True)
-
-conf.check(lib='markdown',
+    conf.check(lib='markdown',
            uselib_store='DISCOUNT',
            mandatory=True)
+except ConfigurationError:
+    # fallback to embedded peg-markdown
+    pass



--------------
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