31 March 2017

p9p

System: Microsoft Windows 10 Home Edition
CPUs: Intel(R) Celeron(R) CPU N3060 @1.60GHz
64-bit Operating System, x64-based processor
Deps: plan9port-20140306.tgz, weirdx-1.0.32.tar.gz,
jre-8u121-windows-x64.exe

WSL installation of plan9port.

https://code.google.com/archive/p/plan9port/downloads
plan9port-20140306.tgz

Extract the above download for example with 7-Zip (64-bit x64).

Rename the directory to 'plan9' and move via the command-line the directory to /usr/local.

root@LAPTOP-5CMN50N0:~# cd /mnt/c/Users/Eric/Downloads
root@LAPTOP-5CMN50N0:/mnt/c/Users/Eric/Downloads# mv plan9 /usr/local
root@LAPTOP-5CMN50N0:/mnt/c/Users/Eric/Downloads# cd $HOME
root@LAPTOP-5CMN50N0:~#

Install your compiler toolchain.

root@LAPTOP-5CMN50N0:/~# apt-get install bison flex gcc m4 make

...

root@LAPTOP-5CMN50N0:~#

Install a window manager and p9p dependencies.

root@LAPTOP-5CMN50N0:~# apt-get blackbox libbz2-dev libfontconfig1-dev menu xorg-dev

...

root@LAPTOP-5CMN50N0:/~#

Change ownership, check permissions, and install.

root@LAPTOP-5CMN50N0:~# cd /usr/local/plan9
root@LAPTOP-5CMN50N0:/usr/local/plan9# set -e
root@LAPTOP-5CMN50N0:/usr/local/plan9# chown -R root:root .
root@LAPTOP-5CMN50N0:/usr/local/plan9# find -L . \
> \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
>  -o -perm 511 \) -exec chmod 755 {} \; -o \
> \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
> -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
root@LAPTOP-5CMN50N0:/usr/local/plan9# ./INSTALL
+ Mailing list: http://groups.google.com/group/plan9port-dev
+ Issue tracker: http://code.swtch.com/plan9port/issues/
+ Submitting changes: http://swtch.com/go/codereview
* Resetting /usr/local/plan9/config
* Compiler version:
        gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
* Running on Linux: checking for NPTL...
        NPTL found.
        fontsrv dependencies found.
* Building mk...
>>> pwd
>>> cd /usr/local/plan9/src/lib9
9c dirread.c
   fchdir(oldwd);
         ^
  fchdir(oldwd);
        ^
>>> cd /usr/local/plan9/src/lib9
9c readcons.c
     write(fd, "\n", 1);
          ^
     write(fd, "\n", 1);
          ^
>>> pwd
>>> pwd
>>> pwd
* Building everything (be patient)...
>>> cd /usr/local/plan9/src/lib9; mk all
9c  dirread.c
   fchdir(oldwd);
         ^
  fchdir(oldwd);
        ^
>>> cd /usr/local/plan9/src/lib9; mk all
9c  readcons.c
     write(fd, "\n", 1);
          ^
     write(fd, "\n", 1);
          ^
>>> cd /usr/local/plan9/src/libthread; mk all
9c -o exec.o  -I. exec.c
    chdir(dir); /* best effort */
         ^
>>> cd /usr/local/plan9/src/cmd; mk all
9c  dd.c
   read(ibf, ibuf, ibs);
       ^
>>> cd /usr/local/plan9/src/cmd; mk all
9c  fortune.c
   read(ix, off, sizeof(off));
       ^
>>> cd /usr/local/plan9/src/cmd; mk all
9c  tar.c
   chdir(origdir);  /* for correctness & profiling */
        ^
>>> cd /usr/local/plan9/src/cmd/9660; mk all
9c  unix.c
  ftruncate(fd, size);
           ^
>>> cd /usr/local/plan9/src/cmd/9pfuse; mk all
9c  fuse.c
  writev(fusefd, vec, nvec);
        ^
>>> cd /usr/local/plan9/src/cmd/db; mk all
9c  trcrun.c
   read(0, buf, 100);
       ^
>>> cd /usr/local/plan9/src/cmd/eqn; mk all
9c  input.c
   fgets(ebuf, sizeof ebuf, curfile->fin);
        ^
>>> cd /usr/local/plan9/src/cmd/fossil; mk all
9c  flfmt.c
{
        echo '#!/usr/local/plan9/bin/rc'
        echo '# THIS FILE IS AUTOMATICALLY GENERATED'
        echo '# FROM /usr/local/plan9/src/cmd/fossil/conf.rc.  DO NOT EDIT.'
        echo
        sed 1d conf.rc
} >o.conf && chmod +x o.conf
>>> cd /usr/local/plan9/src/cmd/grap; mk all
9c  main.c
  mkstemp(tempfile);
         ^
>>> cd /usr/local/plan9/src/cmd/grap; mk all
9c  input.c
  fgets(ebuf, sizeof ebuf, curfile->fin);
       ^
  system(shellbuf);
        ^
>>> cd /usr/local/plan9/src/cmd/graph; mk all
9c  graph.c
   scanf("%[\"]",junk);
        ^
>>> cd /usr/local/plan9/src/cmd/map; mk all
9c  map.c
   fscanf(ifile,"%[^\n]",lbl+1);
         ^
>>> cd /usr/local/plan9/src/cmd/map; mk all
9c  symbol.c
    fscanf(sf,"%*[^\n]");
          ^
>>> cd /usr/local/plan9/src/cmd/page; mk all
9c  view.c
   mkstemp(name);
          ^
  pipe(pfd);
      ^
>>> cd /usr/local/plan9/src/cmd/pic; mk all
9c  input.c
  fgets(ebuf, sizeof ebuf, curfile->fin);
       ^
  system(shellbuf);
        ^
>>> cd libplot
9c  machdep.c
  read(fd, v, size);
      ^
>>> cd libplot
9c  ppause.c
  read(0, aa, 4);
      ^
>>> cd /usr/local/plan9/src/cmd/postscript/common; mk all
9c -c -Dplan9 misc.c
  write(fd_out, buf, count);
       ^
>>> cd /usr/local/plan9/src/cmd/rio; mk all
9c -I/usr/include -DDEBUG -DSHAPE -DDEBUG_EV -DDEBUG main.c
   system("xsetroot -solid grey30");
         ^
>>> cd /usr/local/plan9/src/cmd/tapefs; mk all
9c  tarfs.c
  read(tapefile, dblock.tbuf, cnt);
      ^
>>> cd /usr/local/plan9/src/cmd/tapefs; mk all
9c  tpfs.c
  read(tapefile, dir, sizeof dir);
      ^
  read(tapefile, buffer, cnt);
      ^
>>> cd /usr/local/plan9/src/cmd/tapefs; mk all
9c  cpiofs.c
  read(tapefile, dblock.tbuf, cnt);
      ^
>>> cd /usr/local/plan9/src/cmd/tapefs; mk all
9c  tapfs.c
  read(tapefile, dir, sizeof dir);
      ^
  read(tapefile, buffer, cnt);
      ^
>>> cd /usr/local/plan9/src/cmd/tpic; mk all
9c  input.c
  fgets(ebuf, sizeof ebuf, curfile->fin);
       ^
  system(shellbuf);
        ^
>>> cd /usr/local/plan9/src/cmd/troff; mk all
9c -DUNICODE -DFONTDIR="troff/font" -DNTERMDIR="troff/term/tab." -DTEXHYPHENS="#9/lib/hyphen.tex" -DALTHYPHENS="lib/hyphen.tex" -DDWBHOME="#9/" n1.c
  system(sybuf);
        ^
>>> cd /usr/local/plan9/src/cmd/troff; mk all
9c -DUNICODE -DTDEVNAME="utf" n10.c
  fscanf(fp, "%s", cmd); /* should be device name... */
        ^
   fscanf(fp, "%s", cmd);
         ^
   fscanf(fp, " %[^\n]", opt);
         ^
  read(2, &junk, 1);
      ^
>>> cd /usr/local/plan9/src/cmd/troff; mk all
9c -DUNICODE t11.c
    fscanf(fin, "%d", &Inch);
          ^
    fscanf(fin, "%d", &Hor);
          ^
    fscanf(fin, "%d", &Vert);
          ^
    fscanf(fin, "%d", &Unitwidth);
          ^
    fscanf(fin, "%d", &nfonts);
          ^
     fscanf(fin, "%s", s);
           ^
    fscanf(fin, "%s", ftemp->longname);
          ^
    fscanf(fin, "%d", &ftemp->spacewidth);
          ^
    fscanf(fin, "%d", &ftemp->defaultwidth);
          ^
>>> cd /usr/local/plan9/src/cmd/vbackup; mk all
9c  vnfs.c
vnfs.c:313:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  h->len = *(u32int*)(h->h+SessidSize);
  ^
>>> cd /usr/local/plan9/src/cmd/venti/srv; mk all
9c  fixarenas.c
   pwrite(sb->fd, p, len, offset - sb->r0);
         ^
* Installing everything in /usr/local/plan9/bin...                                                                       
* Cleaning up...
* Renaming hard-coded /usr/local/plan9 paths...
* Building web manual...
    /usr/local/plan9/dist mk man                                                      
* Done.
* Add these to your profile environment.
        PLAN9=/usr/local/plan9 export PLAN9
        PATH=$PATH:$PLAN9/bin export PATH
root@LAPTOP-5CMN50N0:/usr/local/plan9#

Strip your files.

root@LAPTOP-5CMN50N0:/usr/local/plan9# find . | xargs file | \
> grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | \
> xargs strip --strip-unneeded 2> /dev/null || true
root@LAPTOP-5CMN50N0:/usr/local/plan9# exit

http://www.jcraft.com/weirdx/
weirdx-1.0.32.tar.gz

Extract the above download for example with 7-Zip (64-bit x64).

Rename the directory to 'weirdx' and move it.

C:\Users\Eric\Downloads>MOVE weirdx C:\
              1 dir(s) moved.

C:\Users\Eric\Downloads>EXIT

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
jre-8u121-windows-x64.exe

Run the jre8 installer.

Start WeirdX.

C:\Users\Eric>CD \weirdx\misc

C:\weirdx\misc>weirdx-Java2.bat

C:\weirdx\misc>java -classpath ".;.\weirdx.jar" com.jcraft.weirdx.WeirdX

Export variables to your shell and start blackbox.

root@LAPTOP-5CMN50N0:~# export DISPLAY=localhost:2.0
root@LAPTOP-5CMN50N0:~# export PLAN9=/usr/local/plan9
root@LAPTOP-5CMN50N0:~# export MANPATH=$MANPATH:$PLAN9/man
root@LAPTOP-5CMN50N0:~# export PATH=$PATH:$PLAN9/bin
root@LAPTOP-5CMN50N0:~# blackbox &
1 [12]
root@LAPTOP-5CMN50N0:~# blackbox: managing screen 0 using TrueColor visual 0x20, depth 16
blackbox: [stylesdir/stylesmenu] error, '/root/.blackbox/styles' does not exist

root@LAPTOP-5CMN50N0:~#

Start 9term.

root@LAPTOP-5CMN50N0:~# 9term &
[2] 14
root@LAPTOP-5CMN50N0:~# ioctl TIOCSCTTY: Operation not permitted

root@LAPTOP-5CMN50N0:~#

When you finish with your 9term session and exit blackbox, you
can open another Windows Command Prompt, run tasklist.exe,
find the jave.exe PID and kill that process, which closes the
WeirdX window.

Running 9term in WeirdX the highlighting and cutting of text is awkward.

The bash output starting 9term as 'ioctl TIOCSCTTY: Operation not permitted' occurs
irrespective of whether one uses vcxsrv-64.1.19.2.0.installer.exe or WeirdX, though in
the former 9term and acme function properly; VcXsrv uses the variable DISPLAY=:0.

A WSL screenshot is available of p9p's rio running in VcXsrv.

NB: 9term running bash outputs what appears to be some escape sequences when executing,
e.g., the Unix utility 'ls', using p9p's rc shell doesn't result in that output, and the rc shell can be
run in an xterminal loaded in WeirdX (with or without a window manager).

This was just a test today of the WSL (Win10 AU) compiler toolchain.