diff options
author | Jun Kuriyama <kuriyama@FreeBSD.org> | 2010-11-01 13:52:47 +0000 |
---|---|---|
committer | Jun Kuriyama <kuriyama@FreeBSD.org> | 2010-11-01 13:52:47 +0000 |
commit | bbde95d76e924079abf71a36821e75acfe25c286 (patch) | |
tree | 2f5563e28e40099d2a6f22ca49a549ea80b7fc48 /misc/amanda-perl-wrapper | |
parent | 1bd12469d8f88f0d2d17c2188470d9964fc4fb52 (diff) | |
download | ports-bbde95d76e924079abf71a36821e75acfe25c286.tar.gz ports-bbde95d76e924079abf71a36821e75acfe25c286.zip |
Notes
Diffstat (limited to 'misc/amanda-perl-wrapper')
-rw-r--r-- | misc/amanda-perl-wrapper/Makefile | 39 | ||||
-rw-r--r-- | misc/amanda-perl-wrapper/files/perl-amanda.c.in | 24 | ||||
-rw-r--r-- | misc/amanda-perl-wrapper/pkg-descr | 1 |
3 files changed, 64 insertions, 0 deletions
diff --git a/misc/amanda-perl-wrapper/Makefile b/misc/amanda-perl-wrapper/Makefile new file mode 100644 index 000000000000..32e62baa9174 --- /dev/null +++ b/misc/amanda-perl-wrapper/Makefile @@ -0,0 +1,39 @@ +# New ports collection makefile for: amanda-perl-wrapper +# Date created: 1 Nov 2010 +# Whom: Jun Kuriyama <kuriyama@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= amanda-perl-wrapper +PORTVERSION= 1.00 +CATEGORIES= misc perl5 +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= kuriyama@FreeBSD.org +COMMENT= Perl wrapper to use with Amanda (with libthr.so.* linked) + +USE_PERL5_RUN= yes +SUB_FILES= perl-amanda.c +SUB_LIST= PREFIX=${LOCALBASE} +PLIST_FILES= bin/perl-amanda +WRKSRC= ${WRKDIR} + +do-fetch: + @${DO_NADA} + +pre-build: apply-slist + +do-build: + cd ${WRKSRC} && ${CC} -o perl-amanda perl-amanda.c + +do-install: + ${INSTALL_PROGRAM} ${WRKDIR}/perl-amanda ${PREFIX}/bin/ + +.include <bsd.port.pre.mk> + +LIBTHR!= ${LS} /lib/libthr.so.* | ${TAIL} -1 +SUB_LIST+= LIBTHR=${LIBTHR_CMD} + +.include <bsd.port.post.mk> diff --git a/misc/amanda-perl-wrapper/files/perl-amanda.c.in b/misc/amanda-perl-wrapper/files/perl-amanda.c.in new file mode 100644 index 000000000000..6b7d6ebb89d0 --- /dev/null +++ b/misc/amanda-perl-wrapper/files/perl-amanda.c.in @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +int +main(int argc, char *const argv[], char *const envp[]) +{ + int i, len = 0; + char **argv2 = malloc(sizeof(char*) * (argc + 1)); + argv2[0] = "%%LOCALBASE%%/bin/perl"; + for (i = 1; i < argc + 1; i++) { + argv2[i] = argv[i]; + } + for (i = 0; envp[i]; i++) { + len++; + } + char **envp2 = malloc(sizeof(char*) * (len + 2)); + envp2[0] = "LD_PRELOAD=%%LIBTHR%%"; + /* Copy last null, too. */ + for (i = 0; i < len + 1; i++) { + envp2[i + 1] = envp[i]; + } + return execve(argv2[0], argv2, envp2); +} diff --git a/misc/amanda-perl-wrapper/pkg-descr b/misc/amanda-perl-wrapper/pkg-descr new file mode 100644 index 000000000000..f7d10a867873 --- /dev/null +++ b/misc/amanda-perl-wrapper/pkg-descr @@ -0,0 +1 @@ +Simple wrapper for perl5 with LD_PRELOAD=libthr. |