From e852a8e8b609bcd2cce1747fb4d6645d4620504a Mon Sep 17 00:00:00 2001 From: Ram Kromberg Date: Wed, 31 Aug 2016 07:55:40 +0300 Subject: plan9port: 2015-06-29 -> 2015-11-10 --- pkgs/tools/system/plan9port/builder.sh | 2 +- pkgs/tools/system/plan9port/default.nix | 33 ++-- pkgs/tools/system/plan9port/sam_chord_9front.patch | 215 +++++++++++++++++++++ 3 files changed, 238 insertions(+), 12 deletions(-) create mode 100644 pkgs/tools/system/plan9port/sam_chord_9front.patch diff --git a/pkgs/tools/system/plan9port/builder.sh b/pkgs/tools/system/plan9port/builder.sh index 15fcdcf6c9dd..6085e6f841ac 100644 --- a/pkgs/tools/system/plan9port/builder.sh +++ b/pkgs/tools/system/plan9port/builder.sh @@ -5,7 +5,7 @@ export PLAN9_TARGET=$PLAN9 configurePhase() { - echo CFLAGS=\"-I${fontconfig_dev}/include -I${libXt_dev}/include\" > LOCAL.config + echo CFLAGS=\"-I${fontconfig_dev}/include -I${libXt_dev}/include -I${freetype_dev}/include\" > LOCAL.config echo X11=\"${libXt_dev}/include\" >> LOCAL.config for f in `grep -l -r /usr/local/plan9`; do diff --git a/pkgs/tools/system/plan9port/default.nix b/pkgs/tools/system/plan9port/default.nix index 6d2581550a45..f7668e1374af 100644 --- a/pkgs/tools/system/plan9port/default.nix +++ b/pkgs/tools/system/plan9port/default.nix @@ -1,26 +1,35 @@ -{stdenv, fetchgit, which, libX11, libXt, fontconfig +{ stdenv, fetchgit, which, libX11, libXt, fontconfig, freetype , xproto ? null , xextproto ? null , libXext ? null # For building web manuals -, perl ? null }: +, perl ? null +, samChordingSupport ? true #from 9front +}: stdenv.mkDerivation rec { - name = "plan9port-2015-06-29"; + name = "plan9port-2015-11-10"; src = fetchgit { # Latest, same as on github, google code is old url = "https://plan9port.googlesource.com/plan9"; - rev = "71de840"; - sha256 = "002ma7h7z3wii520dhijikwdc679hpwn0jv5a0c8g299drvzq2wx"; + rev = "0d2dfbc"; + sha256 = "1h16wvps4rfkjim2ihkmniw8wzl7yill5910larci1c70x6zcicf"; }; - patches = [ ./fontsrv.patch ]; - postPatch = - '' - substituteInPlace src/cmd/acme/acme.c \ - --replace /lib/font/bit $out/plan9/font - ''; + patches = [ + ./fontsrv.patch + ] ++ stdenv.lib.optionals samChordingSupport [ ./sam_chord_9front.patch ]; + + postPatch = '' + #hardcoded path + substituteInPlace src/cmd/acme/acme.c \ + --replace /lib/font/bit $out/plan9/font + #deprecated flags + find . -type f \ + -exec sed -i -e 's/_SVID_SOURCE/_DEFAULT_SOURCE/g' {} \; \ + -exec sed -i -e 's/_BSD_SOURCE/_DEFAULT_SOURCE/g' {} \; + ''; builder = ./builder.sh; @@ -35,6 +44,7 @@ stdenv.mkDerivation rec { libXt xextproto libXext + freetype #fontsrv wants ft2build.h. provides system fonts for acme and sam. ]; enableParallelBuilding = true; @@ -49,4 +59,5 @@ stdenv.mkDerivation rec { libXt_dev = libXt.dev; fontconfig_dev = fontconfig.dev; + freetype_dev = freetype.dev; } diff --git a/pkgs/tools/system/plan9port/sam_chord_9front.patch b/pkgs/tools/system/plan9port/sam_chord_9front.patch new file mode 100644 index 000000000000..8920770e810a --- /dev/null +++ b/pkgs/tools/system/plan9port/sam_chord_9front.patch @@ -0,0 +1,215 @@ +diff -r -c p9p/src/cmd/sam/xec.c p9p-patched/src/cmd/sam/xec.c +*** p9p/src/cmd/sam/xec.c 2016-04-18 21:07:22.000000000 +0300 +--- p9p-patched/src/cmd/sam/xec.c 2016-08-31 06:35:26.910876148 +0300 +*************** +*** 277,282 **** +--- 277,283 ---- + else + while(n++ && undo(FALSE)) + ; ++ moveto(f, f->dot.r); + return TRUE; + } + +diff -r -c p9p/src/cmd/samterm/flayer.c p9p-patched/src/cmd/samterm/flayer.c +*** p9p/src/cmd/samterm/flayer.c 2016-04-18 21:07:22.000000000 +0300 +--- p9p-patched/src/cmd/samterm/flayer.c 2016-08-31 06:46:19.441411045 +0300 +*************** +*** 254,274 **** + int + flselect(Flayer *l) + { +- int ret; + if(l->visible!=All) + flupfront(l); +! frselect(&l->f, mousectl); +! ret = 0; +! if(l->f.p0==l->f.p1){ +! if(mousep->msec-l->clickf.p0+l->origin==l->p0){ +! ret = 1; + l->click = 0; +! }else +! l->click = mousep->msec; +! }else +! l->click = 0; + l->p0 = l->f.p0+l->origin, l->p1 = l->f.p1+l->origin; +! return ret; + } + + void +--- 254,271 ---- + int + flselect(Flayer *l) + { + if(l->visible!=All) + flupfront(l); +! if(l->f.p0==l->f.p1) +! if(mousep->msec-l->clickf.p0+l->origin==l->p0 && +! l->f.p0==frcharofpt(&l->f, mousep->xy)){ + l->click = 0; +! return 1; +! } +! l->click = mousep->msec; +! frselect(&l->f, mousectl); + l->p0 = l->f.p0+l->origin, l->p1 = l->f.p1+l->origin; +! return 0; + } + + void +diff -r -c p9p/src/cmd/samterm/main.c p9p-patched/src/cmd/samterm/main.c +*** p9p/src/cmd/samterm/main.c 2016-04-18 21:07:22.000000000 +0300 +--- p9p-patched/src/cmd/samterm/main.c 2016-08-31 06:52:05.670322598 +0300 +*************** +*** 23,33 **** + char hostlock = 1; + char hasunlocked = 0; + int maxtab = 8; +- int chord; + int autoindent; + +- #define chording 0 /* code here for reference but it causes deadlocks */ +- + void + notifyf(void *a, char *msg) + { +--- 23,30 ---- +*************** +*** 39,45 **** + void + threadmain(int argc, char *argv[]) + { +! int i, got, scr, w; + Text *t; + Rectangle r; + Flayer *nwhich; +--- 36,42 ---- + void + threadmain(int argc, char *argv[]) + { +! int i, got, scr, chord; + Text *t; + Rectangle r; + Flayer *nwhich; +*************** +*** 84,89 **** +--- 81,87 ---- + startnewfile(Tstartcmdfile, &cmd); + + got = 0; ++ chord = 0; + if(protodebug) print("loop\n"); + for(;;got = waitforio()){ + if(hasunlocked && RESIZED()) +*************** +*** 108,163 **** + continue; + } + nwhich = flwhich(mousep->xy); +! scr = which && ptinrect(mousep->xy, which->scroll); + if(mousep->buttons) + flushtyping(1); +! if(chording && chord==1 && !mousep->buttons) + chord = 0; +! if(chording && chord) + chord |= mousep->buttons; +! else if(mousep->buttons&1){ +! if(nwhich){ +! if(nwhich!=which) +! current(nwhich); +! else if(scr) +! scroll(which, 1); +! else{ +! t=(Text *)which->user1; +! if(flselect(which)){ +! outTsl(Tdclick, t->tag, which->p0); +! t->lock++; +! }else if(t!=&cmd) +! outcmd(); +! if(mousep->buttons&1) +! chord = mousep->buttons; + } + } + }else if((mousep->buttons&2) && which){ + if(scr) + scroll(which, 2); + else + menu2hit(); +! }else if((mousep->buttons&4)){ + if(scr) +! scroll(which, 3); + else + menu3hit(); + } + mouseunblock(); + } +- if(chording && chord){ +- t = (Text*)which->user1; +- if(!t->lock && !hostlock){ +- w = which-t->l; +- if(chord&2){ +- cut(t, w, 1, 1); +- chord &= ~2; +- }else if(chord&4){ +- paste(t, w); +- chord &= ~4; +- } +- } +- } + } + } + +--- 106,159 ---- + continue; + } + nwhich = flwhich(mousep->xy); +! scr = which && (ptinrect(mousep->xy, which->scroll) || +! mousep->buttons&(8|16)); + if(mousep->buttons) + flushtyping(1); +! if((mousep->buttons&1)==0) + chord = 0; +! if(chord && which && which==nwhich){ + chord |= mousep->buttons; +! t = (Text *)which->user1; +! if(!t->lock){ +! int w = which-t->l; +! if(chord&2){ +! cut(t, w, 1, 1); +! chord &= ~2; +! } +! if(chord&4){ +! paste(t, w); +! chord &= ~4; + } + } ++ }else if(mousep->buttons&(1|8)){ ++ if(scr) ++ scroll(which, (mousep->buttons&8) ? 4 : 1); ++ else if(nwhich && nwhich!=which) ++ current(nwhich); ++ else{ ++ t=(Text *)which->user1; ++ if(flselect(which)){ ++ outTsl(Tdclick, t->tag, which->p0); ++ t->lock++; ++ }else if(t!=&cmd) ++ outcmd(); ++ if(mousep->buttons&1) ++ chord = mousep->buttons; ++ } + }else if((mousep->buttons&2) && which){ + if(scr) + scroll(which, 2); + else + menu2hit(); +! }else if(mousep->buttons&(4|16)){ + if(scr) +! scroll(which, (mousep->buttons&16) ? 5 : 3); + else + menu3hit(); + } + mouseunblock(); + } + } + } + -- cgit 1.4.1