Tuesday, June 10, 2008

Compiling GNU Screen, irssi and Emacs on Solaris with Sun Studio 12

Screen, Emacs and irssi aren't included in Solaris, and the Sun Freeware versions tend to be out of date. Blastwave usually pulls in too many depends. You can compile screen, irssi and emacs without any additional depends on SXCE 90 and you get to use SS12.

Here's how you compile them on SXCE 90 using Sun Studio 12.

  1. Install Sun Studio 12. If you have SXCE, just use the Developer Tools installer from the DVD.
  2. Export a PATH that includes Sun Studio (you can also just export CC):
    PATH=/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ucb:/usr/sbin:/opt/SUNWspro/bin
    export PATH
  3. Download and untar the sources
  4. ./configure --prefix=/usr/local; gmake; su; gmake install
If you're compiling screen, it will fail. It's because it assumes you're using Solaris 9 or older / no setenv.
Look for the offending line:

# if defined(linux) || defined(__convex__) || (BSD >= 199103)
setenv(var, value, 1);
# else
setenv(var, value);
# endif /* linux || convex || BSD >= 199103 */
#endif /* USESETENV */

Just replace setenv(var, value); to use 3 parameters: setenv(var, value, 1);


Better yet (pkgsrc):

  1. Index: misc.c
  2. --- misc.c.orig 2003-12-05 14:45:41 +0100
  3. +++ misc.c 2006-07-13 18:00:46 +0200
  4. @@ -613,7 +613,7 @@
  5. */
  6. # endif /* NEEDSETENV */
  7. #else /* USESETENV */
  8. -# if defined(linux) || defined(__convex__) || (BSD >= 199103)
  9. +# if defined(linux) || defined(__convex__) || (BSD >= 199103) || defined(__sun)
  10. setenv(var, value, 1);
  11. # else
  12. setenv(var, value);

Now screen will compile. You can also make packages.

Other software such as top, smartctl (smartmontools) and so on all compiles cleanly without the need for 3rd party depends.

1 comments:

Anonymous said...

I much prefer this method:

# if defined(linux) || defined(__convex__) || (BSD >= 199103) || defined(__sun)
setenv(var, value, 1);
# else
setenv(var, value);
# endif /* linux || convex || BSD >= 199103 */
#endif /* USESETENV */