Fix Centos 7 build.
authorCarl Hetherington <cth@carlh.net>
Tue, 21 Nov 2023 19:20:04 +0000 (20:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 21 Nov 2023 19:20:04 +0000 (20:20 +0100)
src/lib/zipper.cc
wscript

index db84cdf71db596062a68b6ad5a8ec06382fd337c..625f3049a52a76df41c13d5bd94a49cfa6f6f3af 100644 (file)
@@ -57,7 +57,11 @@ Zipper::add (string name, string content)
                throw runtime_error ("could not create ZIP source");
        }
 
+#ifdef DCPOMATIC_HAVE_ZIP_FILE_ADD
        if (zip_file_add(_zip, name.c_str(), source, ZIP_FL_ENC_GUESS) == -1) {
+#else
+       if (zip_add(_zip, name.c_str(), source) == -1) {
+#endif
                throw runtime_error(String::compose("failed to add data to ZIP archive (%1)", zip_strerror(_zip)));
        }
 }
diff --git a/wscript b/wscript
index 351e8b3559cc72c35921d4d8cba2f790da4211ad..d6e2726b49ef2c9534c7ffd167bf9d7e913f32f3 100644 (file)
--- a/wscript
+++ b/wscript
@@ -256,6 +256,15 @@ def configure(conf):
                    uselib="ZIP",
                    define_name='DCPOMATIC_HAVE_ZIP_SOURCE_T'
                    )
+    conf.check_cxx(fragment="""
+                            #include <zip.h>
+                            int main() { struct zip* zip; zip_source_t* source; zip_file_add(zip, "foo", source, ZIP_FL_ENC_GUESS); }
+                            """,
+                   mandatory=False,
+                   msg="Checking for zip_file_add",
+                   uselib="ZIP",
+                   define_name='DCPOMATIC_HAVE_ZIP_FILE_ADD'
+                   )
 
     # libbz2; must be explicitly linked on macOS for some reason
     conf.check_cxx(fragment="""