9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul+plan9@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] p9p mk issue
Date: Wed, 21 Nov 2007 10:01:07 -0800	[thread overview]
Message-ID: <20071121180107.531D55B2E@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Wed, 21 Nov 2007 11:01:10 EST." <20071121160100.1BBBD1E8C22@holo.morphisms.net>


> > >> Don't laugh but I am trying to use identical mkfiles on
> > >> FreeBSD & plan9 for some programs and it seems this is
> > >> impossible.
> > 
> > For now I just changed default MKSHELL to rc in src/cmd/mk.
> > What I was really arguing for was for simplifying MKSHELL
> > semantics or getting rid of it altogether since it only
> > exists in p9p mk.
> 
> if you want to use rc in both places, then setting MKSHELL=rc is enough.
> the plan 9 mk will ignore it.

Yeah that is one solution except that pretty much every
mkfile will need this line and I hate having to litter
mkfiles.

> MKSHELL is here to stay.  the unix versions of mk have 
> traditionally used sh not rc, and there are users who
> depend on that.  
> 
> also, while using sh by default is a little annoying,
> it simplifies the plan9port build process considerably,
> since rc doesn't have to get bootstrapped just to get
> mk running.

OK, how about this?  If env. var MKSHELL is set to rc, then
set the default value of make variable MKSHELL to rc else to
sh.  You get exactly the same effect as now and I get what I
want by setting MKSHELL env. var to rc.

I just reran $PLAN9/INSTALL with this change and it works
like before (as expected).

diff -r 976b3130f4f8 src/cmd/mk/shell.c
--- a/src/cmd/mk/shell.c	Wed Nov 07 17:30:51 2007 -0500
+++ b/src/cmd/mk/shell.c	Wed Nov 21 09:38:50 2007 -0800
@@ -5,7 +5,7 @@ static Shell *shells[] = {
 	&shshell
 };
 
-Shell *shelldefault = &shshell;
+Shell *shelldefault;
 
 Shell *shellt;
 Word *shellcmd;
@@ -41,6 +41,10 @@ void
 void
 initshell(void)
 {
+	if(shelldefault == nil){
+		char* sh = getenv("MKSHELL");
+		shelldefault = sh && strcmp(sh, "rc") == 0? &rcshell : &shshell;
+	}
 	shellcmd = stow(shelldefault->name);
 	shellt = shelldefault;
 	setvar("MKSHELL", shellcmd);


  reply	other threads:[~2007-11-21 18:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-20 21:01 Bakul Shah
2007-11-20 21:08 ` Pietro Gagliardi
2007-11-20 21:44 ` Pietro Gagliardi
2007-11-20 22:20   ` Jeff Sickel
2007-11-20 22:48     ` Bakul Shah
2007-11-21  7:44       ` John Stalker
2007-11-21 16:01       ` Russ Cox
2007-11-21 18:01         ` Bakul Shah [this message]
2007-11-21 19:57           ` Pietro Gagliardi
2007-11-22 15:47           ` Russ Cox
2007-11-22 17:43             ` Bakul Shah
2007-11-22 18:20               ` Martin Neubauer
2007-11-22 19:48               ` Russ Cox
2007-11-30 18:01                 ` Bakul Shah
2007-11-30 19:01                   ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071121180107.531D55B2E@mail.bitblocks.com \
    --to=bakul+plan9@bitblocks.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).