Fix build on Centos 7.
authorCarl Hetherington <cth@carlh.net>
Tue, 20 Feb 2024 13:37:58 +0000 (14:37 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 20 Feb 2024 13:37:58 +0000 (14:37 +0100)
src/lib/unzipper.cc
wscript

index 2add8f2a943edf2e886ceb9f7049a74bd888a8a3..f0170e7e0646fdca6d2536123c8c287c759e0dad 100644 (file)
@@ -39,7 +39,11 @@ using std::string;
 Unzipper::Unzipper(boost::filesystem::path file)
 {
        int error;
+#ifdef DCPOMATIC_HAVE_ZIP_RDONLY
        _zip = zip_open(dcp::filesystem::fix_long_path(file).string().c_str(), ZIP_RDONLY, &error);
+#else
+       _zip = zip_open(dcp::filesystem::fix_long_path(file).string().c_str(), 0, &error);
+#endif
        if (!_zip) {
                throw FileError("could not open ZIP file", file);
        }
diff --git a/wscript b/wscript
index 4c40e34b110799177e499fce0d51246fc5f85171..a62b5c2c3a2e9b27c5c67b484fb99617b7e08195 100644 (file)
--- a/wscript
+++ b/wscript
@@ -281,6 +281,15 @@ def configure(conf):
                    uselib="ZIP",
                    define_name='DCPOMATIC_HAVE_ZIP_FILE_ADD'
                    )
+    conf.check_cxx(fragment="""
+                            #include <zip.h>
+                            int main() { int error; zip_open("foo", ZIP_RDONLY, &error); }
+                            """,
+                   mandatory=False,
+                   msg="Checking for ZIP_RDONLY",
+                   uselib="ZIP",
+                   define_name='DCPOMATIC_HAVE_ZIP_RDONLY'
+                   )
 
     # libbz2; must be explicitly linked on macOS for some reason
     conf.check_cxx(fragment="""