OPTION (ENABLE_ZCHUNK_COMPRESSION "Build with zchunk compression support?" OFF)
OPTION (WITH_SYSTEM_ZCHUNK "Use system zchunk library?" OFF)
OPTION (WITH_LIBXML2 "Build with libxml2 instead of libexpat?" OFF)
+OPTION (WITHOUT_COOKIEOPEN "Disable the use of stdio cookie opens?" OFF)
include (GNUInstallDirs)
message (STATUS "Libraries will be installed in ${CMAKE_INSTALL_FULL_LIBDIR}")
# should create config.h with #cmakedefine instead...
FOREACH (VAR HAVE_STRCHRNUL HAVE_FOPENCOOKIE HAVE_FUNOPEN WORDS_BIGENDIAN
- HAVE_RPM_DB_H HAVE_PGPDIGGETPARAMS WITH_LIBXML2 )
+ HAVE_RPM_DB_H HAVE_PGPDIGGETPARAMS WITH_LIBXML2 WITHOUT_COOKIEOPEN)
IF(${VAR})
ADD_DEFINITIONS (-D${VAR}=1)
SET (SWIG_FLAGS ${SWIG_FLAGS} -D${VAR})
#include "solv_xfopen.h"
#include "util.h"
+#ifndef WITHOUT_COOKIEOPEN
static FILE *cookieopen(void *cookie, const char *mode,
ssize_t (*cread)(void *, char *, size_t),
#endif /* ENABLE_ZCHUNK_COMPRESSION */
+#else
+/* no cookies no compression */
+#undef ENABLE_ZLIB_COMPRESSION
+#undef ENABLE_LZMA_COMPRESSION
+#undef ENABLE_BZIP2_COMPRESSION
+#undef ENABLE_ZSTD_COMPRESSION
+#undef ENABLE_ZCHUNK_COMPRESSION
+#endif
+
+
FILE *
solv_xfopen(const char *fn, const char *mode)
return 0;
}
+
+#ifndef WITHOUT_COOKIEOPEN
+
struct bufcookie {
char **bufp;
size_t *buflp;
}
return fp;
}
+
+#else
+
+FILE *
+solv_xfopen_buf(const char *fn, char **bufp, size_t *buflp, const char *mode)
+{
+ FILE *fp;
+ size_t l;
+ if (*mode != 'r')
+ return 0;
+ l = buflp ? *buflp : strlen(*bufp);
+ if (!strcmp(mode, "rf"))
+ {
+ if (!(fp = fmemopen(0, l + 1, "r+")))
+ return 0;
+ if (l && fwrite(*bufp, l, 1, fp) != 1)
+ {
+ fclose(fp);
+ return 0;
+ }
+ rewind(fp);
+ }
+ else
+ fp = fmemopen(*bufp, l, "r");
+ return fp;
+}
+
+#endif
+
sprintf(priobuf, "%d.%d", repo->priority, repo->subpriority);
else
sprintf(priobuf, "%d", repo->priority);
+#if !defined(WITHOUT_COOKIEOPEN) && defined(ENABLE_ZLIB_COMPRESSION)
out = pool_tmpjoin(pool, name, ".repo", ".gz");
+#else
+ out = pool_tmpjoin(pool, name, ".repo", 0);
+#endif
for (i = 0; out[i]; i++)
if (out[i] == '/')
out[i] = '_';