Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Sep 2021 21:38:55 GMT
From:      "Jason W. Bacon" <jwb@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: c68b6dc6448c - main - biology/emboss: Add "emboss" command in ${LOCALBASE}/bin
Message-ID:  <202109242138.18OLctS6031614@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jwb:

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

commit c68b6dc6448c618b79c8d1800d25b789b1b01a90
Author:     Jason W. Bacon <jwb@FreeBSD.org>
AuthorDate: 2021-09-24 21:34:20 +0000
Commit:     Jason W. Bacon <jwb@FreeBSD.org>
CommitDate: 2021-09-24 21:34:20 +0000

    biology/emboss: Add "emboss" command in ${LOCALBASE}/bin
    
    Standard emboss commands are installed under a special prefix because
    of multiple conflicts.  The emboss command turns the standard commands
    into subcommands, so no special PATH is needed.
    
        /usr/local/emboss/bin/needle [args]
    
    can be run as
    
        emboss needle [args]
---
 biology/emboss/Makefile       |  6 ++++-
 biology/emboss/distinfo       |  2 +-
 biology/emboss/files/emboss.c | 59 +++++++++++++++++++++++++++++++++++++++++++
 biology/emboss/pkg-plist      |  1 +
 4 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/biology/emboss/Makefile b/biology/emboss/Makefile
index 24862d3e1732..fed3bdc4df4e 100644
--- a/biology/emboss/Makefile
+++ b/biology/emboss/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	emboss
 PORTVERSION=	6.6.0
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	biology
 MASTER_SITES=	ftp://emboss.open-bio.org/pub/EMBOSS/
 DISTNAME=	${PORTNAME:tu}-${PORTVERSION}
@@ -50,6 +50,9 @@ CONFIG_FILE=	${WRKSRC}/emboss/emboss.default.template
 post-patch:
 	@${REINPLACE_CMD} -e 's/-liconv/${ICONV_LIB}/' ${WRKSRC}/configure
 
+post-build:
+	${CC} -DEMBOSS_PREFIX="\"${PREFIX}\"" ${FILESDIR}/emboss.c -o ${WRKDIR}/emboss
+
 pre-install:
 	@ ${REINPLACE_CMD} -e 's#%%DATADIR%%#${PREFIX}/share/${PORTNAME:tu}#' ${CONFIG_FILE}
 
@@ -57,5 +60,6 @@ post-install:
 	@${MKDIR} ${STAGEDIR}${LOCALBASE}/bin
 	${INSTALL_SCRIPT} ${WRKDIR}/emboss-shell ${STAGEDIR}${LOCALBASE}/bin
 	${INSTALL_DATA} ${CONFIG_FILE} ${STAGEDIR}${DATADIR}
+	${INSTALL_PROGRAM} ${WRKDIR}/emboss ${STAGEDIR}${LOCALBASE}/bin
 
 .include <bsd.port.mk>
diff --git a/biology/emboss/distinfo b/biology/emboss/distinfo
index ea7511984c28..a8e5c23c1cc6 100644
--- a/biology/emboss/distinfo
+++ b/biology/emboss/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1630940920
+TIMESTAMP = 1632518858
 SHA256 (emboss/EMBOSS-6.6.0.tar.gz) = 7184a763d39ad96bb598bfd531628a34aa53e474db9e7cac4416c2a40ab10c6e
 SIZE (emboss/EMBOSS-6.6.0.tar.gz) = 117962028
diff --git a/biology/emboss/files/emboss.c b/biology/emboss/files/emboss.c
new file mode 100644
index 000000000000..1b6f1deca5df
--- /dev/null
+++ b/biology/emboss/files/emboss.c
@@ -0,0 +1,59 @@
+/***************************************************************************
+ *  Description:
+ *      Wrapper to turn emboss commands into subcommands.  The emboss suite
+ *      contains executables that conflict with multiple other software
+ *      packages and therefore cannot be safely installed directly under a
+ *      standard prefix.  This wrapper can be installed under the standard
+ *      PATH and used to to execute emboss commands installed under a
+ *      private prefix, without altering PATH, activating a special
+ *      environment, opening a container, etc.  This sub-command paradigm
+ *      is already familiar to bioinformaticians thanks to other suites
+ *      like samtools, bedtools, etc.
+ *
+ *      Example:
+ *
+ *          emboss seqret args
+ *
+ *      instead of one of the following:
+ *
+ *          prefix/bin/seqret args
+ *
+ *          env PATH=prefix/bin:$PATH seqret args
+ *
+ *          conda activate emboss
+ *          seqret args
+ *
+ *  Arguments:
+ *      The full emboss command you would use if it were in PATH.
+ *
+ *  Compile with EMBOSS_PREFIX set to the parent of the bin directory
+ *  containing the emboss binaries.
+ *
+ *  History: 
+ *  Date        Name        Modification
+ *  2021-09-13  Jason Bacon Begin
+ ***************************************************************************/
+
+#include <stdio.h>
+#include <sysexits.h>
+#include <limits.h>
+#include <unistd.h>
+
+#ifndef EMBOSS_PREFIX
+#define EMBOSS_PREFIX   "/usr/local/emboss"
+#endif
+
+int     main(int argc,char *argv[])
+
+{
+    char    cmd[PATH_MAX + 1];
+    
+    if ( argc < 2 )
+    {
+        fprintf(stderr, "Usage: %s emboss-command [args]\n", argv[0]);
+        return EX_USAGE;
+    }
+
+    snprintf(cmd, PATH_MAX, "%s/bin/%s", EMBOSS_PREFIX, argv[1]);
+    execv(cmd, argv + 1);
+}
diff --git a/biology/emboss/pkg-plist b/biology/emboss/pkg-plist
index 281c02c28196..f2b9e61952fd 100644
--- a/biology/emboss/pkg-plist
+++ b/biology/emboss/pkg-plist
@@ -77,6 +77,7 @@ bin/edamisid
 bin/edamname
 bin/edialign
 bin/einverted
+%%LOCALBASE%%/bin/emboss
 %%LOCALBASE%%/bin/emboss-shell
 bin/embossdata
 bin/embossupdate



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109242138.18OLctS6031614>