aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-07-31 15:26:34 -0400
committergit <svn-admin@ruby-lang.org>2023-07-31 20:10:23 +0000
commit04f4e0aeb2e9543e360a566eca0d1cea859b13dd (patch)
tree88a2bcc15ea6a0428360050e8cbae735ca80f740
parent5d78ec8a94b7d44b5b152f4fad7e419a2436fe70 (diff)
downloadruby-04f4e0aeb2e9543e360a566eca0d1cea859b13dd.tar.gz
[ruby/yarp] Document building, more macro changes
https://github.com/ruby/yarp/commit/4214f262d2
-rw-r--r--docs/building.md26
-rw-r--r--lib/yarp/yarp.gemspec1
-rw-r--r--yarp/defines.h16
3 files changed, 34 insertions, 9 deletions
diff --git a/docs/building.md b/docs/building.md
new file mode 100644
index 0000000000..758f02eb41
--- /dev/null
+++ b/docs/building.md
@@ -0,0 +1,26 @@
+# Building
+
+The following describes how to build YARP from source.
+
+## Common
+
+All of the source files match `src/**/*.c` and all of the headers match `include/**/*.h`.
+
+The following flags should be used to compile YARP:
+
+* `-std=c99` - Use the C99 standard
+* `-Wall -Wconversion -Wextra -Wpedantic -Wundef` - Enable the warnings we care about
+* `-Werror` - Treat warnings as errors
+* `-fvisibility=hidden` - Hide all symbols by default
+
+The following flags can be used to compile YARP:
+
+* `-DHAVE_MMAP` - Should be passed if the system has the `mmap` function
+* `-DHAVE_SNPRINTF` - Should be passed if the system has the `snprintf` function
+
+## Shared
+
+If you want to build YARP as a shared library and link against it, you should compile with:
+
+* `-fPIC -shared` - Compile as a shared library
+* `-DYP_EXPORT_SYMBOLS` - Export the symbols (by default nothing is exported)
diff --git a/lib/yarp/yarp.gemspec b/lib/yarp/yarp.gemspec
index c80d37b4f9..e9d228496a 100644
--- a/lib/yarp/yarp.gemspec
+++ b/lib/yarp/yarp.gemspec
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
"config.h.in",
"config.yml",
"configure",
+ "docs/building.md",
"docs/configuration.md",
"docs/design.md",
"docs/encoding.md",
diff --git a/yarp/defines.h b/yarp/defines.h
index ea5db993c9..5c7e02e932 100644
--- a/yarp/defines.h
+++ b/yarp/defines.h
@@ -12,18 +12,16 @@
#include <string.h>
// YP_EXPORTED_FUNCTION
-#if defined(_WIN32)
-# define YP_EXPORTED_FUNCTION __declspec(dllexport) extern
-#elif defined(YP_EXPORT_SYMBOLS)
-# ifndef YP_EXPORTED_FUNCTION
-# ifndef RUBY_FUNC_EXPORTED
-# define YP_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
+#ifndef YP_EXPORTED_FUNCTION
+# ifdef YP_EXPORT_SYMBOLS
+# ifdef _WIN32
+# define YP_EXPORTED_FUNCTION __declspec(dllexport) extern
# else
-# define YP_EXPORTED_FUNCTION RUBY_FUNC_EXPORTED
+# define YP_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
# endif
+# else
+# define YP_EXPORTED_FUNCTION
# endif
-#else
-# define YP_EXPORTED_FUNCTION
#endif
// YP_ATTRIBUTE_UNUSED