diff options
author | marcus <marcus@FreeBSD.org> | 2009-05-04 03:57:43 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2009-05-04 03:57:43 +0800 |
commit | 8bd37f5ba1e2e02f0e496ae48d484705abe1a802 (patch) | |
tree | bf494248e38559467dadaf35b7cc13fb28f7fcb3 /x11 | |
parent | a75af75cf8acea035e83949dcf15cef74b052833 (diff) | |
download | freebsd-ports-graphics-8bd37f5ba1e2e02f0e496ae48d484705abe1a802.tar.gz freebsd-ports-graphics-8bd37f5ba1e2e02f0e496ae48d484705abe1a802.tar.zst freebsd-ports-graphics-8bd37f5ba1e2e02f0e496ae48d484705abe1a802.zip |
Add support for reading a terminal's cwd on recent versions of FreeBSD.
This allows one to open a new tab or terminal from an existing terminal,
and inherit the cwd in the new tab/terminal.
Diffstat (limited to 'x11')
-rw-r--r-- | x11/gnome-terminal/Makefile | 4 | ||||
-rw-r--r-- | x11/gnome-terminal/files/patch-config.h.in | 12 | ||||
-rw-r--r-- | x11/gnome-terminal/files/patch-configure | 82 | ||||
-rw-r--r-- | x11/gnome-terminal/files/patch-configure.ac | 13 | ||||
-rw-r--r-- | x11/gnome-terminal/files/patch-src_terminal-screen.c | 95 |
5 files changed, 206 insertions, 0 deletions
diff --git a/x11/gnome-terminal/Makefile b/x11/gnome-terminal/Makefile index 40fd84898d2..025de1770f2 100644 --- a/x11/gnome-terminal/Makefile +++ b/x11/gnome-terminal/Makefile @@ -8,6 +8,7 @@ PORTNAME= gnome-terminal PORTVERSION= 2.26.1 +PORTREVISION= 1 CATEGORIES= x11 gnome MASTER_SITES= GNOME DIST_SUBDIR= gnome2 @@ -26,4 +27,7 @@ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ GCONF_SCHEMAS= gnome-terminal.schemas +post-patch: + @${TOUCH} -f ${WRKSRC}/aclocal.m4 + .include <bsd.port.mk> diff --git a/x11/gnome-terminal/files/patch-config.h.in b/x11/gnome-terminal/files/patch-config.h.in new file mode 100644 index 00000000000..1617731fa99 --- /dev/null +++ b/x11/gnome-terminal/files/patch-config.h.in @@ -0,0 +1,12 @@ +--- config.h.in.orig 2009-05-03 15:26:39.000000000 -0400 ++++ config.h.in 2009-05-03 15:26:55.000000000 -0400 +@@ -24,6 +24,9 @@ + /* Define to 1 if you have the <inttypes.h> header file. */ + #undef HAVE_INTTYPES_H + ++/* Define if you have the kinfo_getfile function */ ++#undef HAVE_KINFO_GETFILE ++ + /* Define if your <locale.h> file defines LC_MESSAGES. */ + #undef HAVE_LC_MESSAGES + diff --git a/x11/gnome-terminal/files/patch-configure b/x11/gnome-terminal/files/patch-configure new file mode 100644 index 00000000000..45c9382369e --- /dev/null +++ b/x11/gnome-terminal/files/patch-configure @@ -0,0 +1,82 @@ +--- configure.orig 2009-05-03 15:26:45.000000000 -0400 ++++ configure 2009-05-03 15:27:01.000000000 -0400 +@@ -15099,6 +15099,79 @@ GLIB_GENMARSHAL="$($PKG_CONFIG --variabl + GLIB_MKENUMS="$($PKG_CONFIG --variable=glib_mkenums glib-2.0)" + + ++{ echo "$as_me:$LINENO: checking for kinfo_getfile in -lutil" >&5 ++echo $ECHO_N "checking for kinfo_getfile in -lutil... $ECHO_C" >&6; } ++if test "${ac_cv_lib_util_kinfo_getfile+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lutil $LIBS" ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char kinfo_getfile (); ++int ++main () ++{ ++return kinfo_getfile (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest$ac_exeext && ++ $as_test_x conftest$ac_exeext; then ++ ac_cv_lib_util_kinfo_getfile=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_cv_lib_util_kinfo_getfile=no ++fi ++ ++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_kinfo_getfile" >&5 ++echo "${ECHO_T}$ac_cv_lib_util_kinfo_getfile" >&6; } ++if test $ac_cv_lib_util_kinfo_getfile = yes; then ++ LIBS="${LIBS} -lutil" ++ ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_KINFO_GETFILE 1 ++_ACEOF ++ ++else ++ : ++fi ++ ++ + # Extract the first word of "gtk-builder-convert", so it can be a program name with args. + set dummy gtk-builder-convert; ac_word=$2 + { echo "$as_me:$LINENO: checking for $ac_word" >&5 diff --git a/x11/gnome-terminal/files/patch-configure.ac b/x11/gnome-terminal/files/patch-configure.ac new file mode 100644 index 00000000000..131e4c85b69 --- /dev/null +++ b/x11/gnome-terminal/files/patch-configure.ac @@ -0,0 +1,13 @@ +--- configure.ac.orig 2009-05-03 15:25:26.000000000 -0400 ++++ configure.ac 2009-05-03 15:26:34.000000000 -0400 +@@ -96,6 +96,10 @@ AC_SUBST([GLIB_GENMARSHAL]) + GLIB_MKENUMS="$($PKG_CONFIG --variable=glib_mkenums glib-2.0)" + AC_SUBST([GLIB_MKENUMS]) + ++AC_CHECK_LIB(util, kinfo_getfile, ++ [LIBS="${LIBS} -lutil" ++ AC_DEFINE(HAVE_KINFO_GETFILE, 1, [Define if you have the kinfo_getfile function])], [:]) ++ + AC_PATH_PROG([GTK_BUILDER_CONVERT],[gtk-builder-convert],[false]) + if test "$GTK_BUILDER_CONVERT" = "false"; then + AC_MSG_ERROR([gtk-builder-convert not found]) diff --git a/x11/gnome-terminal/files/patch-src_terminal-screen.c b/x11/gnome-terminal/files/patch-src_terminal-screen.c new file mode 100644 index 00000000000..2403403806e --- /dev/null +++ b/x11/gnome-terminal/files/patch-src_terminal-screen.c @@ -0,0 +1,95 @@ +--- src/terminal-screen.c.orig 2009-05-03 15:29:53.153369000 -0400 ++++ src/terminal-screen.c 2009-05-03 15:30:35.000000000 -0400 +@@ -18,6 +18,15 @@ + + #include <config.h> + ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#include <sys/param.h> ++#include <sys/user.h> ++#ifdef HAVE_KINFO_GETFILE ++#include <libutil.h> ++#endif ++#endif + #include <string.h> + #include <stdlib.h> + #include <unistd.h> +@@ -1744,10 +1753,22 @@ terminal_screen_get_dynamic_icon_title ( + char* + terminal_screen_get_current_dir (TerminalScreen *screen) + { ++#ifndef __FreeBSD__ + static const char patterns[][18] = { + "/proc/%d/cwd", /* Linux */ + "/proc/%d/path/cwd", /* Solaris >= 10 */ + }; ++#else ++#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104) ++ struct kinfo_file *freep, *kif; ++#ifndef HAVE_KINFO_GETFILE ++ size_t len; ++ int name[4]; ++#else ++ int cnt; ++#endif /* HAVE_KINFO_GETFILE */ ++#endif /* __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104) */ ++#endif /* __FreeBSD__ */ + TerminalScreenPrivate *priv = screen->priv; + int fgpid; + guint i; +@@ -1767,6 +1788,7 @@ terminal_screen_get_current_dir (Termina + if (fgpid == -1) + return g_strdup (priv->initial_working_directory); + ++#ifndef __FreeBSD__ + /* Try to get the working directory using various OS-specific mechanisms */ + for (i = 0; i < G_N_ELEMENTS (patterns); ++i) + { +@@ -1804,6 +1826,45 @@ terminal_screen_get_current_dir (Termina + return working_dir; + } + } ++#else ++#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104) ++#ifndef HAVE_KINFO_GETFILE ++ name[0] = CTL_KERN; ++ name[1] = KERN_PROC; ++ name[2] = KERN_PROC_FILEDESC; ++ name[3] = fgpid; ++ ++ if (sysctl (name, 4, NULL, &len, NULL, 0) < 0) ++ return g_strdup (priv->initial_working_directory); ++ freep = kif = g_malloc (len); ++ if (sysctl (name, 4, kif, &len, NULL, 0) < 0) ++ { ++ g_free (freep); ++ return g_strdup (priv->initial_working_directory); ++ } ++#else ++ freep = kinfo_getfile (fgpid, &cnt); ++#endif /* HAVE_KINFO_GETFILE */ ++ ++#ifndef HAVE_KINFO_GETFILE ++ for (i = 0; i < len / sizeof (*kif); i++, kif++) ++ { ++ if (kif->kf_structsize != sizeof (*kif)) ++ continue; ++#else ++ for (i = 0; i < cnt; i++) ++ { ++ kif = &freep[i]; ++#endif /* HAVE_KINFO_GETFILE */ ++ if (kif->kf_fd == KF_FD_TYPE_CWD) ++ { ++ g_free (freep); ++ return g_strdup (kif->kf_path); ++ } ++ } ++ g_free (freep); ++#endif /* __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104) */ ++#endif /* __FreeBSD__ */ + + return g_strdup (priv->initial_working_directory); + } |