--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/tmux/Makefile Tue Sep 17 16:15:04 2013 -0700
@@ -0,0 +1,64 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+#
+
+include ../../make-rules/shared-macros.mk
+
+COMPONENT_NAME= tmux
+COMPONENT_VERSION= 1.8
+COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_PROJECT_URL= http://tmux.sourceforge.net
+COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH= \
+ sha256:2565b65f80bf1d683032c75704a9619e6734fd21586c72768ef27427ba9e23e5
+COMPONENT_ARCHIVE_URL= http://sourceforge.net/projects/tmux/files/tmux/$(COMPONENT_SRC)/$(COMPONENT_ARCHIVE)
+COMPONENT_BUGDB= utility/tmux
+
+include ../../make-rules/prep.mk
+include ../../make-rules/configure.mk
+include ../../make-rules/ips.mk
+
+CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
+CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)"
+
+# nroff does not work with -mandoc using groff
+MANDIR_PREFORMATED= $(PROTO_DIR)/usr/share/man/cat1
+COMPONENT_POST_INSTALL_ACTION += \
+ /usr/bin/groff -Tascii -mandoc $(SOURCE_DIR)/tmux.1>tmux.1.mod ; \
+ mkdir -p $(MANDIR_PREFORMATED) ; \
+ $(MV) tmux.1.mod $(MANDIR_PREFORMATED)/tmux.1
+
+# Enable ASLR for this component
+ASLR_MODE = $(ASLR_ENABLE)
+
+# common targets
+build: $(BUILD_64)
+
+install: $(INSTALL_64)
+
+test: $(NO_TESTS)
+
+BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS)
+
+include ../../make-rules/depend.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/tmux/patches/client.c.patch Tue Sep 17 16:15:04 2013 -0700
@@ -0,0 +1,56 @@
+In-House Patch. Submitted to upstream, but not accepted yet.
+Check for flock(), which is available on BSD and not on Solaris.
+Instead use fnctl() on Solaris. Also check if cfmakeraw(), which
+is not available on Solaris, so manually change the termios
+structure, the same way cfmakeraw does.
+
+--- tmux-1.8/client.c.orig 2013-08-13 12:42:26.447337127 -0700
++++ tmux-1.8/client.c 2013-08-13 12:44:09.044164126 -0700
+@@ -74,16 +74,30 @@
+ client_get_lock(char *lockfile)
+ {
+ int lockfd;
++#ifdef F_SETLK
++ struct flock lock;
++#endif
+
+ if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)
+ fatal("open failed");
+
++#ifdef F_SETLK
++ if (fcntl(lockfd, F_SETLK, &lock) == -1 && errno == EAGAIN) {
++ while (fcntl(lockfd, F_SETLKW, &lock) == -1 && errno == EINTR)
++ /* nothing */;
++ close(lockfd);
++ return(-1);
++ }
++#elif LOCK_EX
+ if (flock(lockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
+ while (flock(lockfd, LOCK_EX) == -1 && errno == EINTR)
+ /* nothing */;
+ close(lockfd);
+ return (-1);
+ }
++#else
++#error "You need locking support."
++#endif
+
+ return (lockfd);
+ }
+@@ -244,7 +258,15 @@
+ strerror(errno));
+ return (1);
+ }
+- cfmakeraw(&tio);
++#ifdef HAVE_CFMAKERAW
++ cfmakeraw(&tio);
++#else
++ tio.c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
++ tio.c_oflag &= ~OPOST;
++ tio.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
++ tio.c_cflag &= ~(CSIZE|PARENB);
++ tio.c_cflag |= CS8;
++#endif
+ tio.c_iflag = ICRNL|IXANY;
+ tio.c_oflag = OPOST|ONLCR;
+ #ifdef NOKERNINFO
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/tmux/patches/server-client.c.patch Tue Sep 17 16:15:04 2013 -0700
@@ -0,0 +1,13 @@
+In-House patch. Submitted to upstream, but not accepted yet.
+Added errno.h to remove compile error of defininig extern int errno without including errno.h.
+
+--- tmux-1.8/server-client.c.orig 2013-08-13 12:42:15.161702456 -0700
++++ tmux-1.8/server-client.c 2013-08-13 12:44:32.917403564 -0700
+@@ -25,6 +25,7 @@
+ #include <string.h>
+ #include <time.h>
+ #include <unistd.h>
++#include <errno.h>
+
+ #include "tmux.h"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/tmux/resolve.deps Tue Sep 17 16:15:04 2013 -0700
@@ -0,0 +1,3 @@
+library/libevent
+shell/ksh93
+system/library
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/tmux/tmux.license Tue Sep 17 16:15:04 2013 -0700
@@ -0,0 +1,14 @@
+
+ Copyright (c) 2007 Nicholas Marriott <[email protected]>
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/tmux/tmux.p5m Tue Sep 17 16:15:04 2013 -0700
@@ -0,0 +1,43 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+#
+#
+<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
+#
+set name=pkg.fmri \
+ value=pkg:/terminal/tmux@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="tmux - terminal multiplexer"
+set name=pkg.description \
+ value="tmux(1) is a terminal multiplexer that enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached."
+set name=com.oracle.info.tpno value=14287
+set name=info.classification \
+ value="org.opensolaris.category.2008:Applications/System Utilities"
+set name=com.oracle.info.description value="the tmux terminal multiplexer"
+#
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2013/270
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+#
+file usr/bin/$(MACH64)/tmux path=usr/bin/tmux
+file path=usr/share/man/cat1/tmux.1
+license tmux.license license=MIT