git: c521cf238c0a - main - devel/ocaml-magic-mime: New port

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sun, 28 Jun 2026 22:09:34 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c521cf238c0aa4083b059084b2e305aa246462f7

commit c521cf238c0aa4083b059084b2e305aa246462f7
Author:     Benjamin Jacobs <freebsd@dev.thsi.be>
AuthorDate: 2026-06-28 20:58:45 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2026-06-28 22:08:54 +0000

    devel/ocaml-magic-mime: New port
    
    This OCaml library provides lookup functions to map a filename to a
    MIME type (based on the extension of the file), and conversely from a
    MIME type to a list of file extensions. As the database is bundled
    inside an OCaml module, the lookups do not access the filesystem.
    
    WWW: https://github.com/mirage/ocaml-magic-mime
---
 devel/Makefile                   |  1 +
 devel/ocaml-magic-mime/Makefile  | 30 ++++++++++++++++++++++++++++++
 devel/ocaml-magic-mime/distinfo  |  3 +++
 devel/ocaml-magic-mime/pkg-descr |  4 ++++
 devel/ocaml-magic-mime/pkg-plist | 19 +++++++++++++++++++
 5 files changed, 57 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index b136c6ff6a37..173f26eb06c2 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1810,6 +1810,7 @@
     SUBDIR += ocaml-lwt
     SUBDIR += ocaml-lwt_log
     SUBDIR += ocaml-magic
+    SUBDIR += ocaml-magic-mime
     SUBDIR += ocaml-mtime
     SUBDIR += ocaml-ocamlbuild
     SUBDIR += ocaml-ocplib-endian
diff --git a/devel/ocaml-magic-mime/Makefile b/devel/ocaml-magic-mime/Makefile
new file mode 100644
index 000000000000..fdec01296c39
--- /dev/null
+++ b/devel/ocaml-magic-mime/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	magic-mime
+DISTVERSION=	1.3.1
+CATEGORIES=	devel
+MASTER_SITES=	https://github.com/mirage/ocaml-${PORTNAME}/releases/download/v${DISTVERSION}/
+PKGNAMEPREFIX=	ocaml-
+
+MAINTAINER=	freebsd@dev.thsi.be
+COMMENT=	Embedded MIME type database for OCaml
+WWW=		https://github.com/mirage/ocaml-magic-mime
+
+LICENSE=	ISCL
+LICENSE_FILE=	${WRKSRC}/LICENSE.md
+
+USES=		ocaml:dune tar:tbz
+
+DOCSDIR=	${OCAML_DOCSDIR}/${PORTNAME}
+PORTDOCS=	CHANGES.md LICENSE.md README.md
+
+OPTIONS_DEFINE=	DOCS
+
+post-patch:
+	@${REINPLACE_CMD} \
+		-e "s/(version v.*)/(version ${DISTVERSION})/" \
+		${WRKSRC}/dune-project
+
+post-install:
+	${STRIP_CMD} \
+		${STAGEDIR}${PREFIX}/${OCAML_SITELIBDIR}/magic-mime/magic_mime_library.cmxs
+
+.include <bsd.port.mk>
diff --git a/devel/ocaml-magic-mime/distinfo b/devel/ocaml-magic-mime/distinfo
new file mode 100644
index 000000000000..5d62983ac147
--- /dev/null
+++ b/devel/ocaml-magic-mime/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1752073001
+SHA256 (magic-mime-1.3.1.tbz) = e0234d03625dba1efac58e57e387672d75a5e9a621ff49acfe0f609c00f13b08
+SIZE (magic-mime-1.3.1.tbz) = 13405
diff --git a/devel/ocaml-magic-mime/pkg-descr b/devel/ocaml-magic-mime/pkg-descr
new file mode 100644
index 000000000000..a2d6a2978597
--- /dev/null
+++ b/devel/ocaml-magic-mime/pkg-descr
@@ -0,0 +1,4 @@
+This OCaml library provides lookup functions to map a filename to a
+MIME type (based on the extension of the file), and conversely from a
+MIME type to a list of file extensions. As the database is bundled
+inside an OCaml module, the lookups do not access the filesystem.
diff --git a/devel/ocaml-magic-mime/pkg-plist b/devel/ocaml-magic-mime/pkg-plist
new file mode 100644
index 000000000000..fb714cd2362b
--- /dev/null
+++ b/devel/ocaml-magic-mime/pkg-plist
@@ -0,0 +1,19 @@
+%%OCAML_SITELIBDIR%%/magic-mime/META
+%%OCAML_SITELIBDIR%%/magic-mime/dune-package
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime.cmi
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime.cmt
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime.cmti
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime.cmx
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime.ml
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime.mli
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime_library.a
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime_library.cma
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime_library.cmxa
+%%OCAML_SITELIBDIR%%/magic-mime/magic_mime_library.cmxs
+%%OCAML_SITELIBDIR%%/magic-mime/mime_types.cmi
+%%OCAML_SITELIBDIR%%/magic-mime/mime_types.cmt
+%%OCAML_SITELIBDIR%%/magic-mime/mime_types.cmti
+%%OCAML_SITELIBDIR%%/magic-mime/mime_types.cmx
+%%OCAML_SITELIBDIR%%/magic-mime/mime_types.ml
+%%OCAML_SITELIBDIR%%/magic-mime/mime_types.mli
+%%OCAML_SITELIBDIR%%/magic-mime/opam