diff options
author | kuriyama <kuriyama@FreeBSD.org> | 2010-11-01 21:52:47 +0800 |
---|---|---|
committer | kuriyama <kuriyama@FreeBSD.org> | 2010-11-01 21:52:47 +0800 |
commit | 974d3305409a59fa9ecde779cc4da48b66c31554 (patch) | |
tree | dbe4d8f46888d65063f2dfadbb6e9b7cdcf66596 /misc | |
parent | 938fe7091f556ffc08fbb7dc00b96c6824bb79dd (diff) | |
download | freebsd-ports-gnome-974d3305409a59fa9ecde779cc4da48b66c31554.tar.gz freebsd-ports-gnome-974d3305409a59fa9ecde779cc4da48b66c31554.tar.zst freebsd-ports-gnome-974d3305409a59fa9ecde779cc4da48b66c31554.zip |
Simple wrapper for perl5 with LD_PRELOAD=libthr for amanda 3.*.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/Makefile | 1 | ||||
-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 |
4 files changed, 65 insertions, 0 deletions
diff --git a/misc/Makefile b/misc/Makefile index 821c8fc62056..08847bc2aae4 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -9,6 +9,7 @@ SUBDIR += airoflash SUBDIR += alevt SUBDIR += amanda-client + SUBDIR += amanda-perl-wrapper SUBDIR += amanda-server SUBDIR += amanda25-client SUBDIR += amanda25-server 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. |