View | Details | Raw Unified | Return to bug 282123
Collapse All | Expand All

(-)b/devel/ocaml-magic/Makefile (-1 / +5 lines)
Lines 1-6 Link Here
1
PORTNAME=	magic
1
PORTNAME=	magic
2
PORTVERSION=	0.7.3
2
PORTVERSION=	0.7.3
3
PORTREVISION=	6
3
PORTREVISION=	7
4
CATEGORIES=	devel
4
CATEGORIES=	devel
5
MASTER_SITES=	SF/ocaml-${PORTNAME}/ocaml-${PORTNAME}/0.7
5
MASTER_SITES=	SF/ocaml-${PORTNAME}/ocaml-${PORTNAME}/0.7
6
PKGNAMEPREFIX=	ocaml-
6
PKGNAMEPREFIX=	ocaml-
Lines 28-33 EXAMPLESDIR= ${OCAML_EXAMPLESDIR}/${PORTNAME} Link Here
28
28
29
OPTIONS_DEFINE=	DOCS EXAMPLES
29
OPTIONS_DEFINE=	DOCS EXAMPLES
30
30
31
post-install:
32
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/${OCAML_SITELIBDIR}/magic/dllmagic_stubs.so
33
31
post-install-DOCS-on:
34
post-install-DOCS-on:
32
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
35
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
33
	${INSTALL_DATA} ${WRKSRC}/doc/html/* ${STAGEDIR}${DOCSDIR}
36
	${INSTALL_DATA} ${WRKSRC}/doc/html/* ${STAGEDIR}${DOCSDIR}
Lines 35-39 post-install-DOCS-on: Link Here
35
post-install-EXAMPLES-on:
38
post-install-EXAMPLES-on:
36
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
39
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
37
	${INSTALL_DATA} ${WRKSRC}/examples/* ${STAGEDIR}${EXAMPLESDIR}
40
	${INSTALL_DATA} ${WRKSRC}/examples/* ${STAGEDIR}${EXAMPLESDIR}
41
	${STRIP_CMD} ${STAGEDIR}${EXAMPLESDIR}/file
38
42
39
.include <bsd.port.mk>
43
.include <bsd.port.mk>
(-)b/devel/ocaml-magic/files/patch-src_magic__stubs.c (-1 / +114 lines)
Added Link Here
0
- 
1
--- src/magic_stubs.c.orig	2008-03-23 20:39:45 UTC
2
+++ src/magic_stubs.c
3
@@ -53,7 +53,7 @@ static void raise_magic_failure(const char * msg)
4
 {
5
   static value * exn = NULL;
6
   if (exn == NULL) exn = caml_named_value("Magic.Failure");
7
-  raise_with_string(*exn, (char *) msg);
8
+  caml_raise_with_string(*exn, (char *) msg);
9
 }
10
 
11
 /* [raise_on_error] raises an exception according to the error that
12
@@ -73,20 +73,20 @@ static void raise_on_error(const char* fname, const ma
13
   if (err_magic != NULL) {
14
     /* libmagic error */
15
     if ((errmsg = malloc(flen + strlen(err_magic) + 1)) == NULL)
16
-      raise_out_of_memory();
17
+      caml_raise_out_of_memory();
18
     if (exn == NULL) exn = caml_named_value("Magic.Failure");
19
     strcpy(errmsg, fname);
20
     strcpy(errmsg + flen, err_magic);
21
-    verrmsg = copy_string(errmsg);
22
+    verrmsg = caml_copy_string(errmsg);
23
     free(errmsg); /* err_magic is freed by magic_close */
24
-    raise_with_arg(*exn, verrmsg);
25
+    caml_raise_with_arg(*exn, verrmsg);
26
   }
27
   else  {
28
     /* System error */
29
     const int err = magic_errno(cookie);
30
     int len = 80;  /* buffer length */
31
 
32
-    if ((errmsg = malloc(len)) == NULL) raise_out_of_memory();
33
+    if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory();
34
     strcpy(errmsg, fname);
35
 #ifdef HAVE_STRERROR_R
36
     /* Allocate buffer [errmsg] until there is enough space for the
37
@@ -95,15 +95,15 @@ static void raise_on_error(const char* fname, const ma
38
       /* Reallocate to a bigger size -- no need to keep the contents */
39
       len *= 2;
40
       free(errmsg);
41
-      if ((errmsg = malloc(len)) == NULL) raise_out_of_memory();
42
+      if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory();
43
       strcpy(errmsg, fname);
44
     }
45
 #else
46
     strncat(errmsg, strerror(err), len - flen - 1);
47
 #endif
48
-    verrmsg = copy_string(errmsg);
49
+    verrmsg = caml_copy_string(errmsg);
50
     free(errmsg);
51
-    raise_sys_error(verrmsg);
52
+    caml_raise_sys_error(verrmsg);
53
   }
54
 
55
   CAMLreturn0;
56
@@ -147,7 +147,7 @@ static struct custom_operations cookie_ops = {
57
     /* deserialize */ custom_deserialize_default
58
 };
59
 
60
-#define ALLOC_COOKIE alloc_custom(&cookie_ops, sizeof(magic_t), \
61
+#define ALLOC_COOKIE caml_alloc_custom(&cookie_ops, sizeof(magic_t), \
62
                      sizeof(magic_t), 40 * sizeof(magic_t))
63
 
64
 /*
65
@@ -169,22 +169,22 @@ CAMLprim value ocaml_magic_open(value flags)
66
     else {
67
       const int err = errno; /* save it */
68
 
69
-      if ((errmsg = malloc(len)) == NULL) raise_out_of_memory();
70
+      if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory();
71
       strcpy(errmsg, "Magic.create: "); /* 14 chars */
72
 #ifdef HAVE_STRERROR_R
73
       /* No cookie yet, so one cannot use the above generic err fun */
74
       while(strerror_r(err, errmsg + 14, len - 14) < 0) {
75
         len *= 2;
76
         free(errmsg);
77
-        if ((errmsg = malloc(len)) == NULL) raise_out_of_memory();
78
+        if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory();
79
         strcpy(errmsg, "Magic.create: ");
80
       }
81
 #else
82
       strncat(errmsg, strerror(err), len - 15);
83
 #endif
84
-      verrmsg = copy_string(errmsg);
85
+      verrmsg = caml_copy_string(errmsg);
86
       free(errmsg);
87
-      raise_sys_error(verrmsg);
88
+      caml_raise_sys_error(verrmsg);
89
     }
90
   }
91
   CAMLreturn(c);
92
@@ -207,11 +207,11 @@ CAMLprim value ocaml_magic_file(value c, value fname)
93
   const char * ans;
94
   const magic_t cookie = COOKIE_VAL(c);
95
 
96
-  if (cookie == NULL) invalid_argument("Magic.file");
97
+  if (cookie == NULL) caml_invalid_argument("Magic.file");
98
   if ((ans = magic_file(cookie, String_val(fname))) == NULL) {
99
     raise_on_error("Magic.file: ", cookie);
100
   }
101
-  CAMLreturn(copy_string(ans));
102
+  CAMLreturn(caml_copy_string(ans));
103
 }
104
 
105
 CAMLprim value ocaml_magic_buffer(value c, value buf, value len)
106
@@ -224,7 +224,7 @@ CAMLprim value ocaml_magic_buffer(value c, value buf, 
107
   if ((ans = magic_buffer(cookie, String_val(buf), Int_val(len)))
108
       == NULL)
109
     raise_on_error("Magic.buffer: ", cookie);
110
-  CAMLreturn(copy_string(ans));
111
+  CAMLreturn(caml_copy_string(ans));
112
 }
113
 
114
 

Return to bug 282123