From nobody Mon Oct 21 11:31:50 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XXCnf3WZPz5Ysc4; Mon, 21 Oct 2024 11:31:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XXCnf34Z1z46Tj; Mon, 21 Oct 2024 11:31:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729510310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j8hmE8QNmUDei1pA/Ug4hTN7uXxkea2+CQ/KbX08Jcw=; b=FktmHOYhrySF5m8yK9shoDOsAuJxq9mAo8Y9HAa5SWUbgWDv2VZX4eQrhN1c4wln80hDCv 4qmW6BFtI65ro4WJQzFUOOG4eCpIRpQGgHaDZKT0l2I8SsMmT+qCH0yEAVyZst5BYcJ5eC C92/aMR6x7cFCUwmsGhWPl9eTsMk2DYggszDOqcAIhCVfbTdmNhoYlUlPs/pXp1ySP6kgH 7fxi5KpaINHS+BJKQK4QYk6qhDTdgDfOBbjli0vnIUWfIm5EyfFPA91KBix589uupRHJsW gvWXgDTW4aj9llU5uXTD3L5V1aSakuDOn3hteAVA4AyCZ40T2xPRoNLJ6EXYeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729510310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j8hmE8QNmUDei1pA/Ug4hTN7uXxkea2+CQ/KbX08Jcw=; b=IOy2CgcIOGklHRlxOkzaqDH/QS0YoUE7ud5X0e9CmxWmlTHWmBRfwlovl1G+bGKA72rJYx LPolNNDfRJPZ4jNm1GLuUEk3G1hK/iqN+7N06M6hWE1Dhksovf6bAN4j276OYSI7HsqfOg JMBcEx9UjOZ2o6m3Ieb+XZjKAhv9APD/ZZnhMT4AucltYFZw5E29PAOmbsoGb4dgQ5lC2h PjIQlOE0HXjBonKE8oTOzkiXJNfLtVL3p9AqALu//L1+xpotrRQlBrZJeZwU6ME8JmN+yr Ift5A10pMLx1Quayu0ZlXwXL7jPD4Bbq5Ebj95DsP84TmNHQMj1BoovFUZjxhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729510310; a=rsa-sha256; cv=none; b=rl4L70JJB82DUl7QQVD+aEuzuEAh/rGpw0RcmNKy6FGplx0/rOwWqL6752oRY8Zb6Is4PE cM5HarsZ29lXQuOJVsUHpdShqz6R2ZKj7PrKi178xkn0F92BbzRY3UAx7hj/u1T5biaTfH NWL3AfupiZ9GA+eRdaptWTJwZDAkR/RTEkDRSGKqTz8AyWMRmEKxdGxxoHSF7wmMfugxJN KmisDHhJ5iAVvOeWzjMfD+Rjky3wIq0C1bYxuhXNxG7cPsS+5UrTern8RppRYSCOThJ94c 6QovayFCqWXCbH/XbUSP6m4RqC+Six3LH9eRbnuElXxFvKPZ7XCpNQd/FVARmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XXCnf2Z8wzSnW; Mon, 21 Oct 2024 11:31:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49LBVoB7051233; Mon, 21 Oct 2024 11:31:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LBVomX051230; Mon, 21 Oct 2024 11:31:50 GMT (envelope-from git) Date: Mon, 21 Oct 2024 11:31:50 GMT Message-Id: <202410211131.49LBVomX051230@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 88b3e57d14fb - main - devel/ocaml-magic: Strip binaries List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88b3e57d14fb0ca185e2600f7c55b835b1ecddea Auto-Submitted: auto-generated The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/ports/commit/?id=88b3e57d14fb0ca185e2600f7c55b835b1ecddea commit 88b3e57d14fb0ca185e2600f7c55b835b1ecddea Author: Benjamin Jacobs AuthorDate: 2024-06-09 12:04:01 +0000 Commit: Li-Wen Hsu CommitDate: 2024-10-21 11:30:43 +0000 devel/ocaml-magic: Strip binaries While at it, patch to use the CAML_NAME_SPACE identifiers of the OCaml C-API, as the support for the legacy identifiers has been dropped from OCaml 5. PR: 282123 --- devel/ocaml-magic/Makefile | 6 +- devel/ocaml-magic/files/patch-src_magic__stubs.c | 114 +++++++++++++++++++++++ 2 files changed, 119 insertions(+), 1 deletion(-) diff --git a/devel/ocaml-magic/Makefile b/devel/ocaml-magic/Makefile index 376198661680..e9a7c2df003b 100644 --- a/devel/ocaml-magic/Makefile +++ b/devel/ocaml-magic/Makefile @@ -1,6 +1,6 @@ PORTNAME= magic PORTVERSION= 0.7.3 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= devel MASTER_SITES= SF/ocaml-${PORTNAME}/ocaml-${PORTNAME}/0.7 PKGNAMEPREFIX= ocaml- @@ -28,6 +28,9 @@ EXAMPLESDIR= ${OCAML_EXAMPLESDIR}/${PORTNAME} OPTIONS_DEFINE= DOCS EXAMPLES +post-install: + @${STRIP_CMD} ${STAGEDIR}${PREFIX}/${OCAML_SITELIBDIR}/magic/dllmagic_stubs.so + post-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/doc/html/* ${STAGEDIR}${DOCSDIR} @@ -35,5 +38,6 @@ post-install-DOCS-on: post-install-EXAMPLES-on: @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} ${INSTALL_DATA} ${WRKSRC}/examples/* ${STAGEDIR}${EXAMPLESDIR} + ${STRIP_CMD} ${STAGEDIR}${EXAMPLESDIR}/file .include diff --git a/devel/ocaml-magic/files/patch-src_magic__stubs.c b/devel/ocaml-magic/files/patch-src_magic__stubs.c new file mode 100644 index 000000000000..38e313e916d4 --- /dev/null +++ b/devel/ocaml-magic/files/patch-src_magic__stubs.c @@ -0,0 +1,114 @@ +--- src/magic_stubs.c.orig 2008-03-23 20:39:45 UTC ++++ src/magic_stubs.c +@@ -53,7 +53,7 @@ static void raise_magic_failure(const char * msg) + { + static value * exn = NULL; + if (exn == NULL) exn = caml_named_value("Magic.Failure"); +- raise_with_string(*exn, (char *) msg); ++ caml_raise_with_string(*exn, (char *) msg); + } + + /* [raise_on_error] raises an exception according to the error that +@@ -73,20 +73,20 @@ static void raise_on_error(const char* fname, const ma + if (err_magic != NULL) { + /* libmagic error */ + if ((errmsg = malloc(flen + strlen(err_magic) + 1)) == NULL) +- raise_out_of_memory(); ++ caml_raise_out_of_memory(); + if (exn == NULL) exn = caml_named_value("Magic.Failure"); + strcpy(errmsg, fname); + strcpy(errmsg + flen, err_magic); +- verrmsg = copy_string(errmsg); ++ verrmsg = caml_copy_string(errmsg); + free(errmsg); /* err_magic is freed by magic_close */ +- raise_with_arg(*exn, verrmsg); ++ caml_raise_with_arg(*exn, verrmsg); + } + else { + /* System error */ + const int err = magic_errno(cookie); + int len = 80; /* buffer length */ + +- if ((errmsg = malloc(len)) == NULL) raise_out_of_memory(); ++ if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory(); + strcpy(errmsg, fname); + #ifdef HAVE_STRERROR_R + /* Allocate buffer [errmsg] until there is enough space for the +@@ -95,15 +95,15 @@ static void raise_on_error(const char* fname, const ma + /* Reallocate to a bigger size -- no need to keep the contents */ + len *= 2; + free(errmsg); +- if ((errmsg = malloc(len)) == NULL) raise_out_of_memory(); ++ if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory(); + strcpy(errmsg, fname); + } + #else + strncat(errmsg, strerror(err), len - flen - 1); + #endif +- verrmsg = copy_string(errmsg); ++ verrmsg = caml_copy_string(errmsg); + free(errmsg); +- raise_sys_error(verrmsg); ++ caml_raise_sys_error(verrmsg); + } + + CAMLreturn0; +@@ -147,7 +147,7 @@ static struct custom_operations cookie_ops = { + /* deserialize */ custom_deserialize_default + }; + +-#define ALLOC_COOKIE alloc_custom(&cookie_ops, sizeof(magic_t), \ ++#define ALLOC_COOKIE caml_alloc_custom(&cookie_ops, sizeof(magic_t), \ + sizeof(magic_t), 40 * sizeof(magic_t)) + + /* +@@ -169,22 +169,22 @@ CAMLprim value ocaml_magic_open(value flags) + else { + const int err = errno; /* save it */ + +- if ((errmsg = malloc(len)) == NULL) raise_out_of_memory(); ++ if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory(); + strcpy(errmsg, "Magic.create: "); /* 14 chars */ + #ifdef HAVE_STRERROR_R + /* No cookie yet, so one cannot use the above generic err fun */ + while(strerror_r(err, errmsg + 14, len - 14) < 0) { + len *= 2; + free(errmsg); +- if ((errmsg = malloc(len)) == NULL) raise_out_of_memory(); ++ if ((errmsg = malloc(len)) == NULL) caml_raise_out_of_memory(); + strcpy(errmsg, "Magic.create: "); + } + #else + strncat(errmsg, strerror(err), len - 15); + #endif +- verrmsg = copy_string(errmsg); ++ verrmsg = caml_copy_string(errmsg); + free(errmsg); +- raise_sys_error(verrmsg); ++ caml_raise_sys_error(verrmsg); + } + } + CAMLreturn(c); +@@ -207,11 +207,11 @@ CAMLprim value ocaml_magic_file(value c, value fname) + const char * ans; + const magic_t cookie = COOKIE_VAL(c); + +- if (cookie == NULL) invalid_argument("Magic.file"); ++ if (cookie == NULL) caml_invalid_argument("Magic.file"); + if ((ans = magic_file(cookie, String_val(fname))) == NULL) { + raise_on_error("Magic.file: ", cookie); + } +- CAMLreturn(copy_string(ans)); ++ CAMLreturn(caml_copy_string(ans)); + } + + CAMLprim value ocaml_magic_buffer(value c, value buf, value len) +@@ -224,7 +224,7 @@ CAMLprim value ocaml_magic_buffer(value c, value buf, + if ((ans = magic_buffer(cookie, String_val(buf), Int_val(len))) + == NULL) + raise_on_error("Magic.buffer: ", cookie); +- CAMLreturn(copy_string(ans)); ++ CAMLreturn(caml_copy_string(ans)); + } + +