]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Add porting guide.
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sat, 30 Jan 2021 14:46:24 +0000 (15:46 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 25 Feb 2021 12:05:04 +0000 (13:05 +0100)
Sync cmake dfltcc descriptions with README.

CMakeLists.txt
PORTING.md [new file with mode: 0644]

index 07ca5128badf7d29b28f6f8ab31a8157c1b58c3b..3da8cef130b536357531ad56b3a2d9840d5bae68 100644 (file)
@@ -101,8 +101,8 @@ if(BASEARCH_ARM_FOUND)
 elseif(BASEARCH_PPC_FOUND)
     add_option(WITH_POWER8 "Build with optimisations for POWER8" ON)
 elseif(BASEARCH_S360_FOUND)
-    add_option(WITH_DFLTCC_DEFLATE "Use DEFLATE CONVERSION CALL instruction for compression on IBM Z" OFF)
-    add_option(WITH_DFLTCC_INFLATE "Use DEFLATE CONVERSION CALL instruction for decompression on IBM Z" OFF)
+    add_option(WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z" OFF)
+    add_option(WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z" OFF)
 elseif(BASEARCH_X86_FOUND)
     add_option(WITH_AVX2 "Build with AVX2" ON)
     add_option(WITH_SSE2 "Build with SSE2" ON)
diff --git a/PORTING.md b/PORTING.md
new file mode 100644 (file)
index 0000000..6fa09b8
--- /dev/null
@@ -0,0 +1,56 @@
+Porting applications to use zlib-ng
+-----------------------------------
+
+Zlib-ng can be used/compiled in two different modes, that require some
+consideration by the application developer.
+
+zlib-compat mode
+----------------
+Zlib-ng can be compiled in zlib-compat mode, suitable for zlib-replacement
+in a single application or system-wide.
+
+Please note that zlib-ng in zlib-compat mode is API-compatible but not
+ABI-compatible, meaning that you cannot simply replace the zlib library/dll
+files and expect the application to work. The application will need to be
+recompiled against the zlib-ng headers and libs to ensure full compatability.
+
+Zlib-ng can be distinguished from other zlib implementations at compile-time
+by checking for the existence of ZLIBNG_VERSION defined in the zlib.h header.
+
+Compile against the *zlib.h* provided by zlib-ng.
+
+**Advantages:**
+- Easy to port to, since it only requires a recompile of the application and
+  no changes to the application code.
+
+**Disadvantages:**
+- Can conflict with a system-installed zlib, as that can often be linked in
+  by another library you are linking into your application. This can cause
+  crashes or incorrect output.
+- If your application is pre-allocating a memory buffer and you are providing
+  deflate/inflate init with your own allocator that allocates from that buffer
+  (looking at you nginx), you should be aware that zlib-ng needs to allocate
+  more memory than stock zlib needs. The same problem exists with Intels and
+  Cloudflares zlib forks. Doing this is not recommended since it makes it
+  very hard to maintain compatibility over time.
+
+
+zlib-ng native mode
+-------------------
+Zlib-ng in native mode is suitable for co-existing with the standard zlib
+library, allowing applications to implement support and testing separately.
+
+The zlib-ng native has implemented some modernization and simplifications
+in its API, intended to make life easier for application developers.
+
+Compile against *zlib-ng.h*.
+
+**Advantages:**
+- Does not conflict with other zlib implementations, and can co-exist as a
+  system library along with zlib.
+- In certain places zlib-ng native uses more appropriate data types, removing
+  the need for some workarounds in the API compared to zlib.
+
+**Disadvantages:**
+- Requires minor changes to applications to use the prefixed zlib-ng
+  function calls and structs. Usually this means a small prefix `zng_` has to be added.