Commit 0402408b authored by Ralf Treinen's avatar Ralf Treinen

New upstream version 1.07

parent ff813e38
Release 1.07:
- Allocate Zlib data structures outside the OCaml heap for compatibility
with recent versions of Zlib
(Github issue #1, pull request #2, report and fix by Einar Lielmanis).
- Don't pass -L and -I options to the C compiler unless necessary.
- Compile and install the shared library zip.cmxs.
(Contributed by E. Millon.)
- ocamlfind: install under 'zip' and 'camlzip' package names.
(This is what the OPAM package does.)
Release 1.06:
- Switch to "safe string" mode. Some API functions that use to take strings
now take byte sequences instead. OCaml 4.02 or up is required.
......
version="1.07"
requires="unix"
archive(byte)="zip.cma"
archive(native)="zip.cmxa"
archive(native,plugin)="zip.cmxs"
directory="../zip"
version="1.06"
version="1.07"
requires="unix"
archive(byte)="zip.cma"
archive(native)="zip.cmxa"
archive(native,plugin)="zip.cmxs"
......@@ -4,11 +4,13 @@
ZLIB_LIB=-lz
# The directory containing the Zlib library (libz.a or libz.so)
ZLIB_LIBDIR=/usr/lib
# Leave empty if libz is in a standard linker directory
ZLIB_LIBDIR=
# ZLIB_LIBDIR=/usr/local/lib
# The directory containing the Zlib header file (zlib.h)
ZLIB_INCLUDE=/usr/include
# Leave empty if zlib.h is in a standard compiler directory
ZLIB_INCLUDE=
# ZLIB_INCLUDE=/usr/local/include
# Where to install the library. By default: sub-directory 'zip' of
......@@ -25,21 +27,33 @@ OCAMLMKLIB=ocamlmklib
OBJS=zlib.cmo zip.cmo gzip.cmo
C_OBJS=zlibstubs.o
NATDYNLINK := $(shell if [ -f `ocamlc -where`/dynlink.cmxa ]; then echo YES; else echo NO; fi)
ifeq "${NATDYNLINK}" "YES"
CMXS = zip.cmxs
endif
ZLIB_L_OPT=$(if $(ZLIB_LIBDIR),-L$(ZLIB_LIBDIR))
ZLIB_I_OPT=$(if $(ZLIB_INCLUDE),-ccopt -I$(ZLIB_INCLUDE))
all: libcamlzip.a zip.cma
allopt: libcamlzip.a zip.cmxa
allopt: libcamlzip.a zip.cmxa $(CMXS)
zip.cma: $(OBJS)
$(OCAMLMKLIB) -o zip -oc camlzip $(OBJS) \
-L$(ZLIB_LIBDIR) $(ZLIB_LIB)
$(ZLIB_L_OPT) $(ZLIB_LIB)
zip.cmxa: $(OBJS:.cmo=.cmx)
$(OCAMLMKLIB) -o zip -oc camlzip $(OBJS:.cmo=.cmx) \
-L$(ZLIB_LIBDIR) $(ZLIB_LIB)
$(ZLIB_L_OPT) $(ZLIB_LIB)
zip.cmxs: zip.cmxa
$(OCAMLOPT) -shared -linkall -I ./ -o $@ $^
libcamlzip.a: $(C_OBJS)
$(OCAMLMKLIB) -oc camlzip $(C_OBJS) \
-L$(ZLIB_LIBDIR) $(ZLIB_LIB)
$(ZLIB_L_OPT) $(ZLIB_LIB)
.SUFFIXES: .mli .ml .cmo .cmi .cmx
......@@ -50,7 +64,7 @@ libcamlzip.a: $(C_OBJS)
.ml.cmx:
$(OCAMLOPT) -c $<
.c.o:
$(OCAMLC) -c -ccopt -g -ccopt -I$(ZLIB_INCLUDE) $<
$(OCAMLC) -c -ccopt -g $(ZLIB_I_OPT) $<
clean:
rm -f *.cm*
......@@ -58,7 +72,7 @@ clean:
install:
mkdir -p $(INSTALLDIR)
cp zip.cma zip.cmi gzip.cmi zip.mli gzip.mli libcamlzip.a $(INSTALLDIR)
cp zip.cma zip.cmi gzip.cmi zlib.cmi zip.mli gzip.mli zlib.mli libcamlzip.a $(INSTALLDIR)
if test -f dllcamlzip.so; then \
cp dllcamlzip.so $(INSTALLDIR); \
ldconf=`$(OCAMLC) -where`/ld.conf; \
......@@ -68,13 +82,18 @@ install:
fi
installopt:
cp zip.cmxa zip.a zip.cmx gzip.cmx $(INSTALLDIR)
cp zip.cmxa $(CMXS) zip.a zip.cmx gzip.cmx zlib.cmx $(INSTALLDIR)
install-findlib:
ocamlfind install zip META *.mli *.a *.cmi *.cma $(wildcard *.cmxa) $(wildcard *.so)
cp META-zip META && \
ocamlfind install zip META *.mli *.a *.cmi *.cma $(wildcard *.cmx) $(wildcard *.cmxa) $(wildcard *.cmxs) $(wildcard *.so) && \
rm META
cp META-camlzip META && \
ocamlfind install camlzip META && \
rm META
depend:
gcc -MM -I$(ZLIB_INCLUDE) *.c > .depend
gcc -MM $(ZLIB_I_OPT) *.c > .depend
ocamldep *.mli *.ml >> .depend
include .depend
......@@ -47,7 +47,7 @@ The directory test/ contains examples of using this library.
LICENSING:
This library is copyright 2001, 2002, 2006, 2007, 2008, 2016
This library is copyright 2001, 2002, 2006, 2007, 2008, 2016, 2017
Institut National de Recherche en Informatique et en Automatique (INRIA),
and distributed under the terms of the GNU Lesser General Public
License (LGPL) version 2.1 or above, with a special exception
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: gzip.ml 32 2016-06-10 09:30:19Z xleroy $ *)
(* $Id$ *)
(* Module [Gzip]: reading and writing to/from [gzip] compressed files *)
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: gzip.mli 32 2016-06-10 09:30:19Z xleroy $ *)
(* $Id$ *)
(** Reading and writing to/from [gzip] compressed files
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: minigzip.ml 32 2016-06-10 09:30:19Z xleroy $ *)
(* $Id$ *)
let buffer = Bytes.create 4096
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: minizip.ml 14 2006-04-04 08:29:07Z xleroy $ *)
(* $Id$ *)
open Printf
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: zip.ml 35 2016-06-10 12:48:10Z xleroy $ *)
(* $Id$ *)
(* Module [Zip]: reading and writing ZIP archives *)
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: zip.mli 32 2016-06-10 09:30:19Z xleroy $ *)
(* $Id$ *)
(** Reading and writing ZIP archives
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: zlib.ml 32 2016-06-10 09:30:19Z xleroy $ *)
(* $Id$ *)
exception Error of string * string
......
......@@ -11,7 +11,7 @@
(* *)
(***********************************************************************)
(* $Id: zlib.mli 32 2016-06-10 09:30:19Z xleroy $ *)
(* $Id$ *)
exception Error of string * string
......
......@@ -11,7 +11,7 @@
/* */
/***********************************************************************/
/* $Id: zlibstubs.c 33 2016-06-10 12:37:25Z xleroy $ */
/* $Id$ */
/* Stub code to interface with Zlib */
......@@ -23,8 +23,9 @@
#include <caml/callback.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/custom.h>
#define ZStream_val(v) ((z_stream *) (v))
#define ZStream_val(v) (*((z_streamp *)Data_custom_val(v)))
static value * camlzip_error_exn = NULL;
......@@ -51,10 +52,21 @@ static void camlzip_error(char * fn, value vzs)
caml_raise(bucket);
}
void camlzip_free_stream(value vzs)
{
caml_stat_free(ZStream_val(vzs));
ZStream_val(vzs) = NULL;
}
static struct custom_operations camlzip_stream_ops = {
"camlzip_stream_ops", &camlzip_free_stream, NULL, NULL, NULL, NULL
};
static value camlzip_new_stream(void)
{
value res = caml_alloc((sizeof(z_stream) + sizeof(value) - 1) / sizeof(value),
Abstract_tag);
value res = caml_alloc_custom(&camlzip_stream_ops, sizeof(z_streamp), 0, 1);
ZStream_val(res) = caml_stat_alloc(sizeof(z_stream));
ZStream_val(res)->zalloc = NULL;
ZStream_val(res)->zfree = NULL;
ZStream_val(res)->opaque = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment