biology/ucsc-userapps: Add "kent" command in ${PREFIX}/bin

Standard kent userapps commands are installed under ${PREFIX}/userapps
because of multiple conflicts.  The kent command turns the standard
commands into subcommands, so no special PATH is needed.

    /usr/local/ucsc-userapps/bin/bigWigToBedGraph [args]

can be run as

    kent bigWigToBedGraph [args]
This commit is contained in:
Jason W. Bacon 2021-09-24 16:53:30 -05:00
parent c68b6dc644
commit d94f19ab9f
3 changed files with 63 additions and 0 deletions

View File

@ -2,6 +2,7 @@
PORTNAME= ucsc-userapps
DISTVERSION= 414
PORTREVISION= 1
CATEGORIES= biology perl5 python
MASTER_SITES= http://hgdownload.cse.ucsc.edu/admin/exe/userApps.archive/
DISTNAME= userApps.v${PORTVERSION}.src
@ -57,6 +58,7 @@ do-build:
@(cd ${WRKSRC}/kent/src/jkOwnLib && ${DO_MAKE_BUILD})
@(cd ${WRKSRC}/kent/src/hg/lib && ${DO_MAKE_BUILD})
@(cd ${WRKSRC}/kent/src/utils && ${DO_MAKE_BUILD})
${CC} -DUCSC_PREFIX="\"${PREFIX}/userapps\"" ${FILESDIR}/kent.c -o ${WRKDIR}/kent
do-install:
@${MKDIR} ${WRKSRC}/scripts ${WRKSRC}/binaries
@ -71,5 +73,6 @@ do-install:
${STAGEDIR}${PREFIX}/userapps/bin
${INSTALL_SCRIPT} ${WRKDIR}/ucsc-shell \
${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKDIR}/kent ${STAGEDIR}${LOCALBASE}/bin
.include <bsd.port.mk>

View File

@ -0,0 +1,59 @@
/***************************************************************************
* Description:
* Wrapper to turn ucsc kent commands into subcommands. The kent 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 kent 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:
*
* kent bigWigToBedGraph args
*
* instead of one of the following:
*
* prefix/bin/bigWigToBedGraph args
*
* env PATH=prefix/bin:$PATH bigWigToBedGraph args
*
* conda activate kent
* bigWigToBedGraph args
*
* Arguments:
* The full kent utils command you would use if it were in PATH.
*
* Compile with UCSC_PREFIX set to the parent of the bin directory
* containing the kent binaries.
*
* History:
* Date Name Modification
* 2021-09-13 Jason Bacon Begin
***************************************************************************/
#include <stdio.h>
#include <sysexits.h>
#include <limits.h>
#include <unistd.h>
#ifndef UCSC_PREFIX
#define UCSC_PREFIX "/usr/local/userapps"
#endif
int main(int argc,char *argv[])
{
char cmd[PATH_MAX + 1];
if ( argc < 2 )
{
fprintf(stderr, "Usage: %s UCSC-userapps-command [args]\n", argv[0]);
return EX_USAGE;
}
snprintf(cmd, PATH_MAX, "%s/bin/%s", UCSC_PREFIX, argv[1]);
execv(cmd, argv + 1);
}

View File

@ -1,3 +1,4 @@
bin/kent
bin/ucsc-shell
userapps/bin/aNotB
userapps/bin/addCols