diff --git a/pkgs/development/tools/misc/xxgdb/default.nix b/pkgs/development/tools/misc/xxgdb/default.nix new file mode 100644 index 000000000000..fc0a38ee7499 --- /dev/null +++ b/pkgs/development/tools/misc/xxgdb/default.nix @@ -0,0 +1,43 @@ +{ lib, stdenv, fetchurl, imake, xlibsWrapper, gccmakedep, libXaw }: + +stdenv.mkDerivation rec { + pname = "xxgdb"; + version = "1.12"; + + src = fetchurl { + url = "http://deb.debian.org/debian/pool/main/x/xxgdb/xxgdb_${version}.orig.tar.gz"; + sha256 = "0jwazg99wk2l7r390ggw0yr8xipl07bp0qynni141xss530i6d1a"; + }; + + patches = [ + # http://zhu-qy.blogspot.com.es/2012/11/slackware-14-i-still-got-xxgdb-all-ptys.html + ./xxgdb-pty.patch + ]; + + nativeBuildInputs = [ imake gccmakedep ]; + buildInputs = [ xlibsWrapper libXaw ]; + + preConfigure = '' + mkdir build + xmkmf + ''; + + makeFlags = [ + "DESTDIR=build" + ]; + + postInstall = '' + # Fix up install paths + shopt -s globstar + mv build/**/bin $out/bin + + install -D xxgdb.1 $out/share/man/man1/xxgdb.1 + ''; + + meta = with lib; { + description = "A simple but powerful graphical interface to gdb"; + license = licenses.mit; + maintainers = with maintainers; [ angustrau ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/tools/misc/xxgdb/xxgdb-pty.patch b/pkgs/development/tools/misc/xxgdb/xxgdb-pty.patch new file mode 100644 index 000000000000..735bb1b0b5fc --- /dev/null +++ b/pkgs/development/tools/misc/xxgdb/xxgdb-pty.patch @@ -0,0 +1,84 @@ +--- xxgdb-1.12-org/calldbx.c 2012-10-26 17:17:49.810750909 -0700 ++++ xxgdb-1.12/calldbx.c 2012-10-26 17:53:59.209918816 -0700 +@@ -69,6 +69,12 @@ + * create_io_window(): create an io window for gdb to use + */ + ++#ifdef linux ++#ifndef _GNU_SOURCE ++#define _GNU_SOURCE ++#endif ++#endif ++ + #include + #include + #include +@@ -126,6 +132,13 @@ + { + int master; + ++#ifdef _POSIX_SOURCE ++ if ((master = posix_openpt (O_RDWR|O_NOCTTY)) < 0) { ++ perror("posix_openpt failed:"); ++ } else { ++ return master; ++ } ++#else + #ifdef SVR4 /* (MJH) Use STREAMS */ + + if((master = open(MASTER_CLONE, O_RDWR)) < 0) +@@ -152,6 +165,7 @@ + } + #endif + #endif /* SVR4 */ ++#endif /* _POSIX_SOURCE */ + + #ifdef GDB + fprintf(stderr, "xxgdb: all ptys in use\n"); +@@ -167,7 +181,28 @@ + { + int slave; + +-#ifdef SVR4 /* (MJH) */ ++#ifdef _POSIX_SOURCE ++ char *slave_name = ptsname (master); ++ if (slave_name == NULL) { ++ perror ("Pseudo-tty slave"); ++ exit (2); ++ } // end if ++ if (grantpt (master) < 0) { ++ perror ("grantpt error"); ++ exit (3); ++ } ++ if (unlockpt (master) < 0) { ++ perror ("unlockpt error"); ++ exit (4); ++ } ++ if ((slave = open (slave_name, O_RDWR)) < 0) { ++ perror (slave_name); ++ exit (5); ++ } // end if ++ return slave; ++#else ++#ifdef SVR4 ++ /* (MJH) */ + char *slave_name = "unknown"; + extern char *ptsname(int master); + void (*handler)(); +@@ -194,6 +229,7 @@ + } + return slave; + #endif /* SVR4 */ ++#endif /* _POSIX_SOURCE */ + } + + #ifdef CREATE_IO_WINDOW +@@ -230,7 +266,7 @@ + { + /* child */ + /* printf("xterm xterm -l -e xxgdbiowin\n");*/ +- if (execlp("xterm", "xterm", "-e", "xxgdbiowin", 0)) ++ if (execlp("xterm", "xterm", "-e", "xxgdbiowin", NULL)) + { + printf("exec of 'xterm -e xxgdbiowin' fails\n"); + unlink("/tmp/iowindowtty"); diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 066abf31ea47..c0f726d02c12 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14488,6 +14488,8 @@ in xxdiff-tip = xxdiff; + xxgdb = callPackage ../development/tools/misc/xxgdb { }; + yaml2json = callPackage ../development/tools/yaml2json { }; yams = callPackage ../applications/audio/yams { };