summaryrefslogtreecommitdiff
path: root/libcmark-gfm/libcmark-gfm
diff options
context:
space:
mode:
Diffstat (limited to 'libcmark-gfm/libcmark-gfm')
-rw-r--r--libcmark-gfm/libcmark-gfm/.gitignore3
-rw-r--r--libcmark-gfm/libcmark-gfm/buildfile84
-rw-r--r--libcmark-gfm/libcmark-gfm/cmark-gfm_export.h54
-rw-r--r--libcmark-gfm/libcmark-gfm/cmark-gfm_version.h7
-rw-r--r--libcmark-gfm/libcmark-gfm/config.h81
l---------libcmark-gfm/libcmark-gfm/config.h.in.orig1
l---------libcmark-gfm/libcmark-gfm/src1
7 files changed, 231 insertions, 0 deletions
diff --git a/libcmark-gfm/libcmark-gfm/.gitignore b/libcmark-gfm/libcmark-gfm/.gitignore
new file mode 100644
index 0000000..c2f1607
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/.gitignore
@@ -0,0 +1,3 @@
+# Generated version header.
+#
+version.h
diff --git a/libcmark-gfm/libcmark-gfm/buildfile b/libcmark-gfm/libcmark-gfm/buildfile
new file mode 100644
index 0000000..41c934d
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/buildfile
@@ -0,0 +1,84 @@
+# file : libcmark-gfm/buildfile
+# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd
+# license : FreeBSD License; see accompanying COPYING file
+
+define inc: file
+inc{*}: extension = inc
+
+lib{cmark-gfm}: {h }{* -version} \
+ {h }{ version} \
+ src/{h inc c}{* -main}
+
+windows = ($c.target.class == 'windows')
+
+gcc = ($c.class == 'gcc')
+
+# No need to include the generated version header into the distribution since
+# it is installed under a different name and so the correct one will always
+# be picked up.
+#
+h{version}: src/in{cmark-gfm_version} $src_root/manifest
+h{version}:
+{
+ in.symbol = '@'
+
+ PROJECT_VERSION_MAJOR = $upstream_version_major
+ PROJECT_VERSION_MINOR = $upstream_version_minor
+ PROJECT_VERSION_PATCH = $upstream_version_patch
+ PROJECT_VERSION_GFM = $upstream_version_gfm
+}
+
+# Build options.
+#
+obja{*}: c.poptions += -DCMARK_GFM_STATIC_BUILD
+objs{*}: c.poptions += -DCMARK_GFM_SHARED_BUILD
+
+if! $windows
+ c.coptions += -fvisibility=hidden
+else
+ c.poptions += -DWIN32 -D_WINDOWS
+
+# Note that we add "-I$src_root" for the headers auto-generating machinery to
+# work properly.
+#
+c.poptions =+ "-I$out_root" "-I$src_root" "-I$src_base" "-I$src_base/src"
+
+if $gcc
+{
+ c.coptions += -pedantic
+
+ # Disable warnings that pop up with -Wextra. Upstream doesn't seem to care
+ # about these and it is not easy to disable specific warnings in a way that
+ # works across compilers/version (some -Wno-* options are only recognized in
+ # newer versions). There are still some warnings left that appear for
+ # certain platforms/compilers. We pass them through but disable treating
+ # them as errors.
+ #
+ c.coptions += -Wno-extra -Wno-error
+}
+
+# Export options.
+#
+lib{cmark-gfm}: cc.export.poptions = "-I$out_root" \
+ "-I$src_root" \
+ "-I$src_base" \
+ "-I$src_base/src"
+
+liba{cmark-gfm}: cc.export.poptions += -DCMARK_GFM_STATIC
+libs{cmark-gfm}: cc.export.poptions += -DCMARK_GFM_SHARED
+
+# See bootstrap.build for details.
+#
+if $version.pre_release
+ lib{cmark-gfm}: bin.lib.version = @"-$version.project_id"
+else
+ lib{cmark-gfm}: bin.lib.version = @"-$abi_version"
+
+# Install the bare minimum of headers.
+#
+h{*}: install = false
+
+for h: src/{cmark-gfm.h cmark-gfm-extension_api.h} cmark-gfm_export.h
+ h{$h}@./$path.directory($h): install = include/
+
+h{version}: install = include/cmark-gfm_version.h
diff --git a/libcmark-gfm/libcmark-gfm/cmark-gfm_export.h b/libcmark-gfm/libcmark-gfm/cmark-gfm_export.h
new file mode 100644
index 0000000..b6b42dc
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/cmark-gfm_export.h
@@ -0,0 +1,54 @@
+/* file : libcmark-gfm/cmark-gfm_export.h -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : FreeBSD License; see accompanying COPYING file
+ */
+
+#ifndef CMARK_GFM_EXPORT_H
+#define CMARK_GFM_EXPORT_H
+
+/*
+ * The upstream's version of this file is auto-generated by cmake. It looks
+ * quite convoluted and contains unused macro definitions. Moreover it seems
+ * to be broken, mismatching build/use pre-processor options (see the issue
+ * #156). Note that currently the upstream disables building shared libraries
+ * with VC.
+ *
+ * We implement this file from scratch using the standard build2 export header
+ * as a template.
+ */
+#if defined(CMARK_GFM_STATIC) // Using static.
+# define CMARK_GFM_EXPORT
+#elif defined(CMARK_GFM_STATIC_BUILD) // Building static.
+# define CMARK_GFM_EXPORT
+#elif defined(CMARK_GFM_SHARED) // Using shared.
+# ifdef _WIN32
+# define CMARK_GFM_EXPORT __declspec(dllimport)
+# else
+# define CMARK_GFM_EXPORT
+# endif
+#elif defined(CMARK_GFM_SHARED_BUILD) // Building shared.
+# ifdef _WIN32
+# define CMARK_GFM_EXPORT __declspec(dllexport)
+# else
+# define CMARK_GFM_EXPORT __attribute__((visibility("default")))
+# endif
+#else
+// If none of the above macros are defined, then we assume we are being used
+// by some third-party build system that cannot/doesn't signal the library
+// type. Note that this fallback works for both static and shared but in case
+// of shared will be sub-optimal compared to having dllimport.
+//
+# define CMARK_GFM_EXPORT // Using static or shared.
+#endif
+
+/*
+ * Undefining these cmake-generated macros is not technically required, but
+ * let's keep them for the record.
+ */
+#undef CMARK_GFM_NO_EXPORT
+#undef CMARK_GFM_DEPRECATED
+#undef CMARK_GFM_NO_DEPRECATED
+#undef CMARK_GFM_DEPRECATED_EXPORT
+#undef CMARK_GFM_DEPRECATED_NO_EXPORT
+
+#endif /* CMARK_GFM_EXPORT_H */
diff --git a/libcmark-gfm/libcmark-gfm/cmark-gfm_version.h b/libcmark-gfm/libcmark-gfm/cmark-gfm_version.h
new file mode 100644
index 0000000..6884503
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/cmark-gfm_version.h
@@ -0,0 +1,7 @@
+/*
+ * file : libcmark-gfm/cmark-gfm_version.h
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : FreeBSD License; see accompanying COPYING file
+ */
+
+#include <libcmark-gfm/version.h>
diff --git a/libcmark-gfm/libcmark-gfm/config.h b/libcmark-gfm/libcmark-gfm/config.h
new file mode 100644
index 0000000..955b03b
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/config.h
@@ -0,0 +1,81 @@
+#ifndef CMARK_CONFIG_H
+#define CMARK_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * For the semantics of the following macros refer to src/CMakeLists.txt.
+ */
+
+#define HAVE_STDBOOL_H
+
+#ifdef HAVE_STDBOOL_H
+ #include <stdbool.h>
+#elif !defined(__cplusplus)
+ typedef char bool;
+#endif
+
+#ifndef _MSC_VER
+# define HAVE___BUILTIN_EXPECT
+# define HAVE___ATTRIBUTE__
+#endif
+
+#ifdef HAVE___ATTRIBUTE__
+ #define CMARK_ATTRIBUTE(list) __attribute__ (list)
+#else
+ #define CMARK_ATTRIBUTE(list)
+#endif
+
+#ifndef CMARK_INLINE
+ #if defined(_MSC_VER) && !defined(__cplusplus)
+ #define CMARK_INLINE __inline
+ #else
+ #define CMARK_INLINE inline
+ #endif
+#endif
+
+/* snprintf and vsnprintf fallbacks for MSVC before 2015,
+ due to Valentin Milea http://stackoverflow.com/questions/2915672/
+*/
+
+#if defined(_MSC_VER) && _MSC_VER < 1900
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#define snprintf c99_snprintf
+#define vsnprintf c99_vsnprintf
+
+CMARK_INLINE int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
+{
+ int count = -1;
+
+ if (size != 0)
+ count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
+ if (count == -1)
+ count = _vscprintf(format, ap);
+
+ return count;
+}
+
+CMARK_INLINE int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
+{
+ int count;
+ va_list ap;
+
+ va_start(ap, format);
+ count = c99_vsnprintf(outBuf, size, format, ap);
+ va_end(ap);
+
+ return count;
+}
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcmark-gfm/libcmark-gfm/config.h.in.orig b/libcmark-gfm/libcmark-gfm/config.h.in.orig
new file mode 120000
index 0000000..6d2701e
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/config.h.in.orig
@@ -0,0 +1 @@
+src/config.h.in \ No newline at end of file
diff --git a/libcmark-gfm/libcmark-gfm/src b/libcmark-gfm/libcmark-gfm/src
new file mode 120000
index 0000000..ff7dce8
--- /dev/null
+++ b/libcmark-gfm/libcmark-gfm/src
@@ -0,0 +1 @@
+../../upstream/src \ No newline at end of file