summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Fabbro <bicatali@gentoo.org>2008-11-05 21:45:11 +0000
committerSebastien Fabbro <bicatali@gentoo.org>2008-11-05 21:45:11 +0000
commitaf86dd199f1a52256d137f0f40ff0c7fec33c8fc (patch)
tree2d6022e4bc2b16656130c012e36030e4e3f1a1ea /x11-libs/xpa
parentInitial import (diff)
downloadhistorical-af86dd199f1a52256d137f0f40ff0c7fec33c8fc.tar.gz
historical-af86dd199f1a52256d137f0f40ff0c7fec33c8fc.tar.bz2
historical-af86dd199f1a52256d137f0f40ff0c7fec33c8fc.zip
Initial import
Package-Manager: portage-2.2_rc11/cvs/Linux 2.6.25-gentoo-r7 x86_64
Diffstat (limited to 'x11-libs/xpa')
-rw-r--r--x11-libs/xpa/ChangeLog11
-rw-r--r--x11-libs/xpa/Manifest16
-rw-r--r--x11-libs/xpa/files/xpa-2.1.8-ds9-5.4.patch865
-rw-r--r--x11-libs/xpa/files/xpa-2.1.8-makefile.patch84
-rw-r--r--x11-libs/xpa/metadata.xml21
-rw-r--r--x11-libs/xpa/xpa-2.1.8.ebuild54
6 files changed, 1051 insertions, 0 deletions
diff --git a/x11-libs/xpa/ChangeLog b/x11-libs/xpa/ChangeLog
new file mode 100644
index 000000000000..0db5f9ea37d4
--- /dev/null
+++ b/x11-libs/xpa/ChangeLog
@@ -0,0 +1,11 @@
+# ChangeLog for x11-libs/xpa
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/xpa/ChangeLog,v 1.1 2008/11/05 21:45:11 bicatali Exp $
+
+*xpa-2.1.8 (05 Nov 2008)
+
+ 05 Nov 2008; Sébastien Fabbro <bicatali@gentoo.org>
+ +files/xpa-2.1.8-ds9-5.4.patch, +files/xpa-2.1.8-makefile.patch,
+ +metadata.xml, +xpa-2.1.8.ebuild:
+ Initial import
+
diff --git a/x11-libs/xpa/Manifest b/x11-libs/xpa/Manifest
new file mode 100644
index 000000000000..3a2c24293520
--- /dev/null
+++ b/x11-libs/xpa/Manifest
@@ -0,0 +1,16 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+AUX xpa-2.1.8-ds9-5.4.patch 22521 RMD160 b18fb640ba926b67629edbb021b32bf3939bc4f2 SHA1 d77879237e3a660d85903251a0b44ede54936c5a SHA256 e8e728278c12cf7cd7a0a60c93f59b9f16ca2627ce6141a4413e71f7c6321436
+AUX xpa-2.1.8-makefile.patch 2594 RMD160 5930d2488812dd0ea8d1201d6be27c3a41bacba1 SHA1 d0635220d44c1fb2692517a0ea70fb965be0bcb1 SHA256 24c4470674e4ada96f73461aef267e8fe02846b872c068cdd542e5c24890ee17
+DIST xpa-2.1.8.tar.gz 826515 RMD160 27e6fabcb6be85325f0ac651361b2be7c1051537 SHA1 9825212d8e3f8a15a540786c76c139e1e6224220 SHA256 b035852d0ae49b21eabed93c901c41510bd82499ac3defe6678a1d5d9209420a
+EBUILD xpa-2.1.8.ebuild 1278 RMD160 649ede44a8b6ea6b6cb04756d5bc4130d39a8448 SHA1 09ded9af6305a5cdd3353a967ff490e4311cb8d0 SHA256 94e6a80f9cdf4c92c0ea93b0eed6df735fcd8570d4507e18a901bdd03e1ebcea
+MISC ChangeLog 401 RMD160 041963733f897713cb53e156baf6aefb2a6aa43f SHA1 2a3f7489dd39d48d40af20679c17dc81efb16fec SHA256 af89822cd57774ba94e7ceed010387aaa1c9fccf7ce532d8b6a58bb2e303ed88
+MISC metadata.xml 978 RMD160 92fca1899fdb0be60fc1f08634381b6144fee371 SHA1 8d1644a55513098f37c47c26ecf3e82a6ec4f47b SHA256 bb79d6f09644c16651bd89152d4e8b0f628abbcbbad06cbd5c94f4bcbf6b2c6a
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.9 (GNU/Linux)
+
+iEYEARECAAYFAkkSE/AACgkQ1ycZbhPLE2DfXgCgjsAWjnXGHh3z6pUd1b7Eg5S+
+72MAni5PV6y+oZp1Vg30f6LCHjAdtA/S
+=aKnD
+-----END PGP SIGNATURE-----
diff --git a/x11-libs/xpa/files/xpa-2.1.8-ds9-5.4.patch b/x11-libs/xpa/files/xpa-2.1.8-ds9-5.4.patch
new file mode 100644
index 000000000000..50a9cabebd55
--- /dev/null
+++ b/x11-libs/xpa/files/xpa-2.1.8-ds9-5.4.patch
@@ -0,0 +1,865 @@
+--- xpa-2.1.8.orig/configure.ac 2007-04-04 15:09:51.000000000 +0100
++++ xpa-2.1.8/configure.ac 2007-12-18 20:09:26.000000000 +0000
+@@ -41,7 +41,7 @@
+
+ AC_C_CONST
+
+-AC_CHECK_FUNCS(strchr memcpy snprintf atexit)
++AC_CHECK_FUNCS(strchr memcpy snprintf atexit setenv posix_spawn)
+
+ AC_CHECK_FUNC(connect)
+ if test $ac_cv_func_connect = no; then
+@@ -60,7 +60,7 @@
+ AC_MSG_CHECKING(for threaded xpans)
+ AC_ARG_ENABLE(threaded-xpans, [ --enable-threaded-xpans build threaded xpans],
+ [fun_ok=$enableval], [fun_ok=no])
+-if test "$fun_ok" != "no"; then
++if test "$fun_ok" = "yes"; then
+ AC_MSG_RESULT($fun_ok)
+ AC_CHECK_LIB(pthread, pthread_create, have_pthread=yes)
+ if test x"${have_pthread}" = x"yes"; then
+@@ -78,7 +78,7 @@
+ AC_MSG_CHECKING(for shared library build)
+ AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries],
+ [fun_ok=$enableval], [fun_ok=no])
+-if test "$fun_ok" != "no"; then
++if test "$fun_ok" = "yes"; then
+ fpic="yes"
+ DOSHARED=shlib
+ AC_SUBST(DOSHARED)
+@@ -93,8 +93,16 @@
+ AC_SUBST(LLIB)
+ AC_MSG_RESULT($fun_ok)
+
++AC_MSG_CHECKING(for request to use posix_spawn)
++AC_ARG_ENABLE(posix_spawn, [ --enable-posix_spawn use posix_spawn() if available],
++ [fun_ok=$enableval], [fun_ok=no])
++AC_MSG_RESULT($fun_ok)
++if test "$fun_ok" = "yes"; then
++ AC_CHECK_FUNCS(posix_spawn)
++fi
++
+ AC_PATH_XTRA
+-if test x"${have_x}" != "xno"; then
++if test x"${have_x}" = "xyes"; then
+ AC_DEFINE(HAVE_XT)
+ fi
+
+--- xpa-2.1.8.orig/launch.c 2006-01-27 16:51:02.000000000 +0000
++++ xpa-2.1.8/launch.c 2007-12-18 20:09:26.000000000 +0000
+@@ -1,35 +1,9 @@
+ /*
+- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
++ * Copyright (c) 1999-2007 Smithsonian Astrophysical Observatory
+ */
+
+ #include <launch.h>
+
+-#define LAUNCHARGS 1024
+-
+-/* we one of these must be defined ... */
+-#if !defined(USE_PIPE) && !defined(USE_WAITPID)
+-#define USE_PIPE 1
+-#endif
+-/* ... but not both */
+-#if defined(USE_PIPE) && defined(USE_WAITPID)
+-#error "USE_PIPE and USE_WAITPID are mutually exclusive"
+-#endif
+-
+-#ifdef USE_WAITPID
+-#define WAIT_TRIES 100
+-#define WAIT_MSEC 5000
+-#endif
+-
+-#ifndef WAIT_MSEC
+-#define WAIT_MSEC 5000
+-#endif
+-
+-static pid_t _launchpid=0;
+-
+-/* spawnvp seems to be broken on cygwin as of 1/06, so just use fork/exec */
+-#if HAVE_CYGWIN
+-#define HAVE_CYGWIN_USE_SPAWNVP 0
+-#endif
+ /*
+ *----------------------------------------------------------------------------
+ *
+@@ -40,96 +14,104 @@
+ *----------------------------------------------------------------------------
+ */
+
+-#if HAVE_CYGWIN||HAVE_MINGW32
++static pid_t pid=0;
+
++/* wait for child process to start, using waitpid() */
+ #ifdef ANSI_FUNC
+-static int launch_win32(char *cmdstring, int attach, char **stdfiles)
++static int launch_pipes(int *pipes, int flag)
+ #else
+-static int launch_win32(cmdstring, attach, stdfiles)
+- char *cmdstring;
+- int attach;
+- char **stdfiles;
++static int launch_pipes(pipes, flag)
++ int *pipes;
++ int flag;
+ #endif
+ {
+- int i, j;
+- int len;
+- int got;
+- int status;
+- char *argv[LAUNCHARGS+1];
+- char *path=NULL;
+- char *s=NULL, *t=NULL;
+- struct timeval tv;
+-
+- /* for now, we can't support stdfiles */
+- if( stdfiles )
+- return(-1);
+-
+- /* package up the arguments for new process */
+- t = (char *)xstrdup(cmdstring);
+- for(i=0, got=0, s=(char *)strtok(t, " \t"); s;
+- i++, s=(char *)strtok(NULL," \t")){
+- if( i < LAUNCHARGS ){
+- /* save argument */
+- argv[i] = xstrdup(s);
+- /* change back special char to spaces, if necessary */
+- len = strlen(argv[i]);
+- for(j=0; j<len; j++){
+- if( argv[i][j] == LAUNCH_SPACE){
+- argv[i][j] = ' ';
+- }
+- }
+- argv[i+1] = NULL;
+- /* save program name */
+- if( i == 0 ) path = (char *)argv[i];
+- got++;
+- }
++ int i;
++ char tbuf[SZ_LINE];
++ if( pipes ){
++ for(i=0; i<4; i++){
++ pipes[i] = -1;
++ }
++ if( (pipe(&pipes[0]) < 0) || (pipe(&pipes[2]) < 0) ) return -1;
++ if( flag ){
++#if HAVE_SETENV
++ snprintf(tbuf, SZ_LINE-1, "%d,%d,%d,%d",
++ pipes[0], pipes[1], pipes[2], pipes[3]);
++ setenv("LAUNCH_PIPES", tbuf, 1);
++#else
++ snprintf(tbuf, SZ_LINE-1, "LAUNCH_PIPES=%d,%d,%d,%d",
++ pipes[0], pipes[1], pipes[2], pipes[3]);
++ putenv(xstrdup(tbuf));
++#endif
+ }
+- if( t ) xfree(t);
+- if( attach )
+- i = _P_WAIT;
+- else
+- i = _P_NOWAIT;
+- if((status = spawnvp(i, path, (void *)argv)) != -1){
+- status = 0;
+- /* wait for child to start */
+- tv.tv_sec = 0;
+- tv.tv_usec = WAIT_MSEC;
+- xselect(1, NULL, NULL, NULL, &tv);
+ }
+- for(i=0; i<got; i++)
+- if( argv[i] ) xfree((char *)argv[i]);
+- return(status);
++ return 0;
+ }
+
++#ifdef ANSI_FUNC
++static int cleanup_pipes(int *pipes)
++#else
++static int cleanup_pipes(pipes)
++ int *pipes;
+ #endif
++{
++ if( pipes ){
++ /* close child pipes */
++ close(pipes[1]);
++ close(pipes[2]);
++ /* move parent write into slot 1 */
++ pipes[1] = pipes[3];
++ /* set unused pipes to impossible value */
++ pipes[2] = -1;
++ pipes[3] = -1;
++ }
++ return 0;
++}
+
+-/*
+- *----------------------------------------------------------------------------
+- *
+- *
+- * Public Routines and Data
+- *
+- *
+- *----------------------------------------------------------------------------
+- */
+-
+-/*
+- *
+- * launchpid() -- return pid of last launched process
+- *
+- */
++#if LAUNCH_USE_WAITPID
++/* wait for child process to start, using waitpid() */
+ #ifdef ANSI_FUNC
+-pid_t launchpid(void)
++static int launch_waitstart(pid_t pid)
+ #else
+-pid_t launchpid()
++static int launch_waitstart(pid)
++ pid_t pid;
+ #endif
+ {
+- return _launchpid;
++ int i, got;
++ int status=0;
++ struct timeval tv;
++ /* wait up to LAUNCH_WAIT_TRIES millisec to make sure the child started,
++ but if we get an error, we can exit immediately */
++ for(i=0; i<LAUNCH_WAIT_TRIES; i++){
++ errno = 0;
++ got=waitpid(pid, &status, WNOHANG);
++ /* look for error termination */
++ if( (got < 0) || ((got == 0) && xerrno) ){
++ got = -1;
++ /* make sure status shows error */
++ if( status == 0 )
++ status = -1;
++ break;
+ }
+-
+-#if HAVE_MINGW32==0
++ /* look for normal termination */
++ else if( got > 0 ){
++ break;
++ }
++ /* no termination, sleep and wait some more */
++ else{
++ tv.tv_sec = 0;
++ tv.tv_usec = LAUNCH_WAIT_MSEC;
++ xselect(1, NULL, NULL, NULL, &tv);
++ }
++ }
++ /* no termination means the child is still running */
++ if( got == 0 ) status = 0;
++ /* return the news */
++ return status;
++}
++#endif
+
+ /*
++ * standard unix version of launch:
+ * adapted from the system() code in:
+ * W. Richard Stevens
+ * "Advanced Programming in the Unix Environment"
+@@ -137,71 +119,86 @@
+ * p. 314
+ */
+ #ifdef ANSI_FUNC
+-int launch(char *cmdstring, int attach, char **stdfiles)
++static int launch_fork_exec(char *cmdstring, int attach,
++ char **stdfiles, int *pipes)
+ #else
+-int launch(cmdstring, attach, stdfiles)
++ static int launch_fork_exec(cmdstring, attach, stdfiles, pipes)
+ char *cmdstring;
+ int attach;
+ char **stdfiles;
++ int *pipes;
+ #endif
+ {
+ int status;
+- pid_t pid;
++ int tpipes[4];
+ struct sigaction ignore, saveintr, savequit;
+ sigset_t chldmask, savemask;
+-#ifdef USE_PIPE
++#if LAUNCH_USE_PIPE
+ int fd[2];
+ #endif
+
+ /* return false if no command is specified */
+- if( !cmdstring || !*cmdstring )
+- return(-1);
++ if( !cmdstring || !*cmdstring ) return -1;
+
+ ignore.sa_handler = SIG_IGN; /* ignore SIGINT and SIGQUIT */
+ sigemptyset(&ignore.sa_mask);
+ ignore.sa_flags = 0;
+ if (sigaction(SIGINT, &ignore, &saveintr) < 0)
+- return(-1);
++ return -1;
+ if (sigaction(SIGQUIT, &ignore, &savequit) < 0)
+- return(-1);
++ return -1;
+
+ sigemptyset(&chldmask); /* now block SIGCHLD */
+ sigaddset(&chldmask, SIGCHLD);
+ if (sigprocmask(SIG_BLOCK, &chldmask, &savemask) < 0)
+- return(-1);
++ return -1;
+
+-#if HAVE_CYGWIN_USE_SPAWNVP
+- /* if we are on the Cygwin platform, use fork/exec only if we are
+- redirecting stdfiles. Otherwise use spawnvp(), which works better. */
+- if( stdfiles ){
+-#endif
+-
+-#ifdef USE_PIPE
++#if LAUNCH_USE_PIPE
+ /* open a pipe so parent can hear if the child fails to exec */
+ if( !attach ){
+ if( pipe(fd) < 0 )
+- return(-1);
++ return -1;
+ xfcntl(fd[0], F_SETFD, FD_CLOEXEC);
+ xfcntl(fd[1], F_SETFD, FD_CLOEXEC);
+ }
+ #endif
+
++ /* create temp ipc pipes if necessary */
++ if( pipes ){
++ if( launch_pipes(tpipes, 0) < 0 ) return -1;
++ }
++
+ /* start new process */
+ if( (pid = fork()) < 0 ){
+-#ifdef USE_PIPE
++#if LAUNCH_USE_PIPE
+ if( !attach ){
+ close(fd[0]);
+ close(fd[1]);
+ }
+ #endif
++ if( pipes ){
++ close(tpipes[0]);
++ close(tpipes[1]);
++ close(tpipes[2]);
++ close(tpipes[3]);
++ }
+ status = -1; /* ERROR: probably out of processes */
+-
+ } else if( pid == 0 ){ /* child */
+ int i, j, len;
+- char *argv[LAUNCHARGS+1];
++ char *argv[LAUNCH_ARGS+1];
+ char *path=NULL;
+ char *s=NULL, *t=NULL;
+
++ /* reset pipes, if necessary */
++ if( pipes ){
++ /* close parent's read/write pipes */
++ close(tpipes[0]);
++ close(tpipes[3]);
++ /* change child's stdin/stdout to use the passed pipes to parent */
++ dup2(tpipes[2], 0); close(tpipes[2]);
++ dup2(tpipes[1], 1); close(tpipes[1]);
++ }
++
+ /* close and reopen stdio files, if necessary */
+ if( stdfiles ){
+ for(i=0; i<3; i++){
+@@ -241,7 +238,7 @@
+ sigaction(SIGQUIT, &savequit, NULL);
+ sigprocmask(SIG_SETMASK, &savemask, NULL);
+ }
+-#ifdef USE_PIPE
++#if LAUNCH_USE_PIPE
+ /* child closes reader -- only writes status */
+ else{
+ close(fd[0]);
+@@ -252,7 +249,7 @@
+ t = (char *)xstrdup(cmdstring);
+ for(i=0, s=(char *)strtok(t, " \t"); s;
+ i++, s=(char *)strtok(NULL," \t")){
+- if( i < LAUNCHARGS ){
++ if( i < LAUNCH_ARGS ){
+ /* save argument */
+ argv[i] = xstrdup(s);
+ /* change back special char to spaces, if necessary */
+@@ -278,7 +275,7 @@
+ /* start up the new program */
+ if( execvp(path, argv) ){
+ status = 127;
+-#ifdef USE_PIPE
++#if LAUNCH_USE_PIPE
+ if( !attach ){
+ write(fd[1], &status, 4);
+ close(fd[1]);
+@@ -287,7 +284,6 @@
+ _exit(status); /* exec error */
+ }
+ } else { /* parent */
+- _launchpid = pid;
+ /* wait for program termination from attached process */
+ if( attach ){
+ while( waitpid(pid, &status, 0) < 0 ){
+@@ -298,38 +294,10 @@
+ }
+ }
+ else{
+-#ifdef USE_WAITPID
+- int i, got;
+- struct timeval tv;
+- /* we wait up to WAIT_TRIES millisecs to make sure the child started;
+- but if we get an error, we can exit immediately */
+- for(i=0; i<WAIT_TRIES; i++){
+- errno = 0;
+- got=waitpid(pid, &status, WNOHANG);
+- /* look for error termination */
+- if( (got < 0) || ((got == 0) && xerrno) ){
+- got = -1;
+- /* make sure status shows error */
+- if( status == 0 )
+- status = -1;
+- break;
+- }
+- /* look for normal termination */
+- else if( got > 0 ){
+- break;
+- }
+- /* no termination, sleep and wait some more */
+- else{
+- tv.tv_sec = 0;
+- tv.tv_usec = WAIT_MSEC;
+- xselect(1, NULL, NULL, NULL, &tv);
+- }
+- }
+- /* no termination means the child is still running */
+- if( got == 0 )
+- status = 0;
++#if LAUNCH_USE_WAITPID
++ status = launch_waitstart(pid);
+ #endif
+-#ifdef USE_PIPE
++#if LAUNCH_USE_PIPE
+ close(fd[1]);
+ if( read(fd[0], &status, 4) == 0 ){
+ status = 0;
+@@ -339,37 +307,321 @@
+ }
+ }
+
+-#if HAVE_CYGWIN_USE_SPAWNVP
++ /* cleanup temp ipc pipes and move into user space */
++ if( pipes ){
++ cleanup_pipes(tpipes);
++ pipes[0] = tpipes[0];
++ pipes[1] = tpipes[1];
++ }
++
++ /* restore previous signal actions & reset signal mask */
++ if( sigaction(SIGINT, &saveintr, NULL) < 0 ) return -1;
++ if( sigaction(SIGQUIT, &savequit, NULL) < 0 ) return -1;
++ if( sigprocmask(SIG_SETMASK, &savemask, NULL) < 0 ) return -1;
++
++ /* return the news */
++ return status;
++}
++
++#if HAVE_POSIX_SPAWN
++
++extern char **environ;
++
++/* spawn calls POSIX posix_spawn */
++#ifdef ANSI_FUNC
++static int launch_posix_spawn(char *cmdstring, int attach,
++ char **stdfiles, int *pipes)
++#else
++ static int launch_posix_spawn(cmdstring, attach, stdfiles, pipes)
++ char *cmdstring;
++ int attach;
++ char **stdfiles;
++ int *pipes;
++#endif
++{
++ int i, j, len;
++ int status=0;
++ int got=0;
++ int tpipes[4];
++ char *argv[LAUNCH_ARGS+1];
++ char *path=NULL;
++ char *s=NULL, *t=NULL;
++ posix_spawn_file_actions_t act;
++ posix_spawn_file_actions_t *pact=NULL;
++
++ /* return false if no command is specified */
++ if( !cmdstring || !*cmdstring )
++ return -1;
++
++ /* create temp ipc pipes if necessary */
++ if( pipes ){
++ if( launch_pipes(tpipes, 1) < 0 ) return -1;
++ }
++
++ /* package up the arguments for new process */
++ t = (char *)xstrdup(cmdstring);
++ for(i=0, s=(char *)strtok(t, " \t"); s;
++ i++, s=(char *)strtok(NULL," \t")){
++ if( i < LAUNCH_ARGS ){
++ /* save argument */
++ argv[i] = xstrdup(s);
++ /* change back special char to spaces, if necessary */
++ len = strlen(argv[i]);
++ for(j=0; j<len; j++){
++ if( argv[i][j] == LAUNCH_SPACE){
++ argv[i][j] = ' ';
++ }
++ }
++ /* last arg is always a NULL */
++ argv[i+1] = NULL;
++ /* save program name */
++ if( i == 0 ) path = argv[i];
++ /* inc arg count */
++ got++;
+ }
+- /* for Cygwin, call their spawnvp() routine instead of fork()/exec() */
++ }
++ if( t ) xfree(t);
++ /* arrange stdfiles files, if necessary */
++ if( stdfiles ){
++ if( posix_spawn_file_actions_init(&act) != 0)
++ return -1;
++ /* stdin */
++ if(stdfiles[0] &&
++ posix_spawn_file_actions_addopen(&act, 0, stdfiles[0], O_RDONLY, 0))
++ return -1;
++ /* stdout */
++ if(stdfiles[1] &&
++ posix_spawn_file_actions_addopen(&act, 1, stdfiles[1], O_CREAT|O_WRONLY|O_TRUNC, 0600))
++ return -1;
++ /* stderr */
++ if(stdfiles[2] &&
++ posix_spawn_file_actions_addopen(&act, 2, stdfiles[2], O_CREAT|O_WRONLY|O_TRUNC, 0600))
++ return -1;
++ pact = &act;
++ }
++ /* start the new process */
++ if( (status = posix_spawnp(&pid, path, pact, NULL, argv, environ)) )
++ return status;
++ /* wait for program termination from attached process */
++ if( attach ){
++ while( waitpid(pid, &status, 0) < 0 ){
++ if( xerrno != EINTR ){
++ status = -1; /* error other than EINTR from waitpid() */
++ break;
++ }
++ }
++ }
++#if BIG_DELAY_WHEN_USING_THIS
++ /* wait for child process to start */
+ else{
+- status = launch_win32(cmdstring, attach, stdfiles);
++ status = launch_waitstart(pid);
++ }
++#endif
++ /* clean up */
++ if( stdfiles ) posix_spawn_file_actions_destroy(&act);
++ /* cleanup temp ipc pipes and move into user space */
++ if( pipes ){
++ cleanup_pipes(tpipes);
++ pipes[0] = tpipes[0];
++ pipes[1] = tpipes[1];
++ }
++ for(i=0; i<got; i++){
++ if( argv[i] ) xfree((char *)argv[i]);
++ }
++ /* return status */
++ return status;
+ }
++
+ #endif
+
+- /* restore previous signal actions & reset signal mask */
+- if( sigaction(SIGINT, &saveintr, NULL) < 0 )
+- return(-1);
+- if( sigaction(SIGQUIT, &savequit, NULL) < 0 )
+- return(-1);
+- if( sigprocmask(SIG_SETMASK, &savemask, NULL) < 0 )
+- return(-1);
++#if HAVE_SPAWNVP
++
++#ifdef ANSI_FUNC
++static int launch_spawnvp(char *cmdstring, int attach,
++ char **stdfiles, int *pipes)
++#else
++ static int launch_spawnvp(cmdstring, attach, stdfiles, pipes)
++ char *cmdstring;
++ int attach;
++ char **stdfiles;
++ int *pipes;
++#endif
++{
++ int i, j;
++ int len;
++ int got;
++ int status;
++ int tpipes[4];
++ char *argv[LAUNCH_ARGS+1];
++ char *path=NULL;
++ char *s=NULL, *t=NULL;
++ struct timeval tv;
++
++ /* return false if no command is specified */
++ if( !cmdstring || !*cmdstring ) return -1;
++
++ /* for now, we can't support stdfiles */
++ if( stdfiles ) return -1;
+
+- return(status);
++ /* create temp ipc pipes if necessary */
++ if( pipes ){
++ if( launch_pipes(tpipes, 1) < 0 ) return -1;
++ }
++
++ /* package up the arguments for new process */
++ t = (char *)xstrdup(cmdstring);
++ for(i=0, got=0, s=(char *)strtok(t, " \t"); s;
++ i++, s=(char *)strtok(NULL," \t")){
++ if( i < LAUNCH_ARGS ){
++ /* save argument */
++ argv[i] = xstrdup(s);
++ /* change back special char to spaces, if necessary */
++ len = strlen(argv[i]);
++ for(j=0; j<len; j++){
++ if( argv[i][j] == LAUNCH_SPACE){
++ argv[i][j] = ' ';
++ }
+ }
++ /* last arg is always a NULL */
++ argv[i+1] = NULL;
++ /* save program name */
++ if( i == 0 ) path = (char *)argv[i];
++ /* inc arg count */
++ got++;
++ }
++ }
++ if( t ) xfree(t);
++ if( attach )
++ i = _P_WAIT;
++ else
++ i = _P_NOWAIT;
++ if((status = spawnvp(i, path, (void *)argv)) != -1){
++ status = 0;
++ /* wait for child to start */
++ tv.tv_sec = 0;
++ tv.tv_usec = LAUNCH_WAIT_MSEC;
++ xselect(1, NULL, NULL, NULL, &tv);
++ }
++ /* clean up */
++ for(i=0; i<got; i++){
++ if( argv[i] ) xfree((char *)argv[i]);
++ }
++ /* cleanup temp ipc pipes and move into user space */
++ if( pipes ){
++ cleanup_pipes(tpipes);
++ pipes[0] = tpipes[0];
++ pipes[1] = tpipes[1];
++ }
++ return status;
++}
++
++#endif
+
++/*
++ *----------------------------------------------------------------------------
++ *
++ *
++ * Public Routines and Data
++ *
++ *
++ *----------------------------------------------------------------------------
++ */
++
++/*
++ *
++ * LaunchPid() -- return pid of last launched process
++ *
++ */
++#ifdef ANSI_FUNC
++pid_t LaunchPid(void)
+ #else
++pid_t LaunchPid()
++#endif
++{
++ return pid;
++}
+
+ #ifdef ANSI_FUNC
+-int launch(char *cmdstring, int attach, char **stdfiles)
++int Launch(char *cmdstring, int attach, char **stdfiles, int *pipes)
+ #else
+-int launch(cmdstring, attach, stdfiles)
++int Launch(cmdstring, attach, stdfiles, piles)
+ char *cmdstring;
+ int attach;
+ char **stdfiles;
++ int *pipes;
+ #endif
+ {
+- return launch_win32(cmdstring, attach, stdfiles);
++ static int which_launch=0;
++ static int which_debug=0;
++ char *s=NULL;
++
++ /* return false if no command is specified */
++ if( !cmdstring || !*cmdstring ) return -1;
++
++ /* sanity check: don't specify stdfiles and pipes simultaneously */
++ if( stdfiles && pipes ){
++ fprintf(stderr,
++ "ERROR: stdfiles and pipes are mutually exclusive in Launch()\n");
++ return -1;
+ }
+
++ /* if pipes are specified, we don't attach */
++ if( pipes ) attach = 0;
++
++ /* determine launch method */
++ if( !which_launch ){
++ which_launch = LAUNCH_DEFAULT_WHICH;
++ if( (s=getenv("LAUNCH_ROUTINE")) ){
++ /* fork_exec */
++ if( !strncasecmp(s, "f", 1) ){
++ which_launch = 1;
++ if( *s == 'F' ) which_debug = 1;
++ }
++ /* posix_spawn */
++ else if( !strncasecmp(s, "p", 1) ){
++ which_launch = 2;
++ if( *s == 'P' ) which_debug = 1;
++ }
++ /* spawnvp */
++ else if( !strncasecmp(s, "s", 1) ){
++ which_launch = 3;
++ if( *s == 'S' ) which_debug = 1;
++ }
++ else if( *s == 'V' ) {
++ which_debug = 1;
++ }
++ }
++ }
++ /* call the correct launch method */
++ switch(which_launch){
++ case 1:
++ if( which_debug ) fprintf(stderr, "launch_fork_exec: %s\n", cmdstring);
++ return launch_fork_exec(cmdstring, attach, stdfiles, pipes);
++ break;
++ case 2:
++#if HAVE_POSIX_SPAWN
++ if( which_debug ) fprintf(stderr, "launch_posix_spawn: %s\n", cmdstring);
++ return launch_posix_spawn(cmdstring, attach, stdfiles, pipes);
++#else
++ fprintf(stderr, "ERROR: posix_spawn() not available on this host\n");
++ exit(1);
+ #endif
++ break;
++ case 3:
++#if HAVE_SPAWNVP
++ if( which_debug ) fprintf(stderr, "launch_spawnvp: %s\n", cmdstring);
++ return launch_spawnvp(cmdstring, attach, stdfiles, pipes);
++#else
++ fprintf(stderr, "ERROR: spawnvp() not available on this host\n");
++ exit(1);
++#endif
++ break;
++ default:
++ if( which_debug ) fprintf(stderr, "launch_fork_exec: %s\n", cmdstring);
++ return launch_fork_exec(cmdstring, attach, stdfiles, pipes);
++ break;
++ }
++ /* can't happen */
++ return -1;
++}
++
+--- xpa-2.1.8.orig/launch.h 2006-01-27 16:25:08.000000000 +0000
++++ xpa-2.1.8/launch.h 2007-12-18 20:09:26.000000000 +0000
+@@ -30,17 +30,54 @@
+ #if HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
++#if HAVE_POSIX_SPAWN
++#include <spawn.h>
++#endif
+ #include <xport.h>
+ #include <word.h>
+ #include <xalloc.h>
+ #include <prsetup.h>
+
++#define LAUNCH_ARGS 1024
++
+ #define LAUNCH_SPACE '\001'
+
++/* for fork/exec, one of these is required to specify the technique to be used
++ by the parent when determining if the child started successfully */
++#if !defined(LAUNCH_USE_PIPE) && !defined(LAUNCH_USE_WAITPID)
++#define LAUNCH_USE_PIPE 1
++#endif
++/* ... but not both */
++#if defined(LAUNCH_USE_PIPE) && defined(LAUNCH_USE_WAITPID)
++#error "LAUNCH_USE_PIPE and LAUNCH_USE_WAITPID are mutually exclusive"
++#endif
++
++#ifndef LAUNCH_WAIT_TRIES
++#define LAUNCH_WAIT_TRIES 100
++#endif
++#ifndef LAUNCH_WAIT_MSEC
++#define LAUNCH_WAIT_MSEC 5000
++#endif
++
++#if HAVE_MINGW32|HAVE_CYGWIN
++#define HAVE_SPAWNVP 1
++#endif
++
++#if HAVE_MINGW32
++/* for now, ensure that MinGW utilizes spawnvp() */
++#define LAUNCH_DEFAULT_WHICH 3
++#elif HAVE_POSIX_SPAWN
++/* use posix_spawn if possible (required for OS X 10.5) */
++#define LAUNCH_DEFAULT_WHICH 2
++#else
++/* use our home-grown version */
++#define LAUNCH_DEFAULT_WHICH 1
++#endif
++
+ _PRbeg
+
+-int launch _PRx((char *cmdstring, int wait, char **stdfiles));
+-pid_t launchpid _PRx((void));
++int Launch _PRx((char *cmdstring, int wait, char **stdfiles, int *pipes));
++pid_t LaunchPid _PRx((void));
+
+ _PRend
+
+--- xpa-2.1.8.orig/xpa.c 2007-03-21 16:29:18.000000000 +0000
++++ xpa-2.1.8/xpa.c 2007-12-18 20:09:26.000000000 +0000
+@@ -684,7 +684,7 @@
+ if((*nscmd != '\0') && ((mtype == XPA_UNIX) || LOCALIP(xnsip)) ){
+ FPRINTF((stderr, "%sLaunching: %s\n", _sp, nscmd));
+ #if USE_LAUNCH
+- if( launch(nscmd, 0, NULL) != 0 )
++ if( Launch(nscmd, 0, NULL, NULL) != 0 )
+ goto nons;
+ #else
+ if( system(nscmd) != 0 )
+--- xpa-2.1.8.orig/xpap.h 2006-01-27 16:13:28.000000000 +0000
++++ xpa-2.1.8/xpap.h 2007-12-18 20:09:26.000000000 +0000
+@@ -15,7 +15,9 @@
+ #endif
+
+ /* avoid use of system -- its not secure */
++#if USE_SPAWN == 0
+ #define USE_LAUNCH 1
++#endif
+
+ #if HAVE_UNISTD_H
+ #include <unistd.h>
diff --git a/x11-libs/xpa/files/xpa-2.1.8-makefile.patch b/x11-libs/xpa/files/xpa-2.1.8-makefile.patch
new file mode 100644
index 000000000000..290309662bb5
--- /dev/null
+++ b/x11-libs/xpa/files/xpa-2.1.8-makefile.patch
@@ -0,0 +1,84 @@
+--- Makefile.in.orig 2008-11-03 12:05:33.000000000 +0000
++++ Makefile.in 2008-11-03 12:07:48.000000000 +0000
+@@ -28,6 +28,11 @@
+
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
++bindir = @bindir@
++libdir = @libdir@
++datadir = @datadir@
++mandir = @mandir@
++includedir = @includedir@
+
+ # The following definition can be set to non-null for special systems
+ # like AFS with replication. It allows the pathnames used for installation
+@@ -37,19 +42,19 @@
+ INSTALL_ROOT =
+
+ # Directory in which to install the .a or .so binary for the XPA library:
+-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
++LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir)
+
+ # Directory in which to install the program wish:
+-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
++BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir)
+
+ # Directory in which to install the include file xpa.h:
+-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include
++INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir)
+
+ # Top-level directory for manual entries:
+-MAN_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/man
++MAN_INSTALL_DIR = $(INSTALL_ROOT)$(mandir)
+
+ # Top-level directory for share entries:
+-MAN_SHARE_DIR = $(INSTALL_ROOT)$(prefix)/share/xpa
++MAN_SHARE_DIR = $(INSTALL_ROOT)$(datadir)/xpa
+
+ # Platform-specific X compiler flags (include file specifications)
+ X_CFLAGS = @X_CFLAGS@
+@@ -175,7 +180,7 @@
+ $(RANLIB) $(LIB)
+
+ shlib: $(LIB)
+- @(rm -rf lib$(PACKAGE).tmp; mkdir lib$(PACKAGE).tmp; \
++ @(rm -rf lib$(PACKAGE).tmp; mkdir -p lib$(PACKAGE).tmp; \
+ (cd lib$(PACKAGE).tmp && ar x ../lib$(PACKAGE).a); \
+ rm -f lib$(PACKAGE).tmp/xt*.o; \
+ rm -f lib$(PACKAGE).tmp/tcl*.o; \
+@@ -184,7 +189,7 @@
+ rm -rf lib$(PACKAGE).tmp)
+
+ tclxpa: $(LIB)
+- @(rm -rf libtclxpa.tmp; mkdir libtclxpa.tmp; \
++ @(rm -rf libtclxpa.tmp; mkdir -p libtclxpa.tmp; \
+ (cd libtclxpa.tmp && ar x ../lib$(PACKAGE).a); \
+ rm -f libtclxpa.tmp/xt*.o; \
+ CC='$(CC)' CXX=$(CXX) \
+@@ -259,7 +264,7 @@
+ do \
+ if [ ! -d $$i ] ; then \
+ echo "Making directory $$i"; \
+- mkdir $$i; \
++ mkdir -p $$i; \
+ chmod 755 $$i; \
+ else true; \
+ fi; \
+@@ -281,7 +286,7 @@
+ install-man:
+ @if [ ! -d $(MAN_INSTALL_DIR) ] ; then \
+ echo "Making directory $(MAN_INSTALL_DIR)"; \
+- mkdir $(MAN_INSTALL_DIR); \
++ mkdir -p $(MAN_INSTALL_DIR); \
+ chmod 755 $(MAN_INSTALL_DIR); \
+ else true; \
+ fi;
+@@ -292,7 +297,7 @@
+ M="$(MAN_INSTALL_DIR)/man$$E"; \
+ if [ ! -d $$M ] ; then \
+ echo "Making directory $$M"; \
+- mkdir $$M; \
++ mkdir -p $$M; \
+ chmod 755 $$M; \
+ else true; \
+ fi; \
diff --git a/x11-libs/xpa/metadata.xml b/x11-libs/xpa/metadata.xml
new file mode 100644
index 000000000000..7fd414fb5f89
--- /dev/null
+++ b/x11-libs/xpa/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>bicatali@gentoo.org</email>
+ <name>Sébastien Fabbro</name>
+ <description>Feel free to take over</description>
+</maintainer>
+<longdescription lang="en">
+ The XPA messaging system provides seamless communication between many
+ kinds of Unix programs, including X programs and Tcl/Tk programs.
+ It also provides an easy way for users to communicate with these
+ XPA-enabled programs by executing XPA client commands in the shell or
+ by utilizing such commands in scripts. Because XPA works both at the
+ programming level and the shell level, it is a powerful tool for
+ unifying any analysis environment: users and programmers have great
+ flexibility in choosing the best level or levels at which to access
+ XPA services, and client access can be extended or modified easily
+ at any time.
+</longdescription>
+</pkgmetadata>
diff --git a/x11-libs/xpa/xpa-2.1.8.ebuild b/x11-libs/xpa/xpa-2.1.8.ebuild
new file mode 100644
index 000000000000..cad6ee4a8a18
--- /dev/null
+++ b/x11-libs/xpa/xpa-2.1.8.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/xpa/xpa-2.1.8.ebuild,v 1.1 2008/11/05 21:45:11 bicatali Exp $
+
+EAPI=2
+inherit eutils autotools
+
+DESCRIPTION="Messaging system providing communication between programs"
+HOMEPAGE="http://hea-www.harvard.edu/RD/xpa"
+SRC_URI="http://hea-www.harvard.edu/saord/download/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+RDEPEND="dev-lang/tcl
+ x11-libs/libXt"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-ds9-5.4.patch
+ epatch "${FILESDIR}"/${P}-makefile.patch
+ eautoconf
+}
+
+src_configure() {
+ econf \
+ --enable-shared \
+ --enable-threaded-xpans \
+ --with-x \
+ --with-tcl \
+ --with-threads
+}
+
+src_compile() {
+ emake shlib tclxpa || die "emake failed"
+}
+
+src_install () {
+ emake INSTALL_ROOT="${D}" install || die "emake install failed"
+ dosym libtclxpa.so.1.0 /usr/$(get_libdir)/libtclxpa.so
+ insinto /usr/$(get_libdir)/tclxpa
+ doins pkgIndex.tcl
+ mv "${D}"/usr/$(get_libdir)/libtclxpa* "${D}"/usr/$(get_libdir)/tclxpa/
+
+ dodoc README
+ if use doc; then
+ cd doc
+ insinto /usr/share/doc/${PF}
+ doins *.pdf || die
+ insinto /usr/share/doc/${PF}/html
+ doins *.html || die
+ fi
+}