aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-04-17 19:39:45 -0700
committerRob Pike <r@golang.org>2009-04-17 19:39:45 -0700
commitbfd5ede78def5e6fe0d0f6f9169daed6deee2d91 (patch)
tree18ba948edb8376fe9d2d2d7618d045a5d806a0db /src
parent45ed7297e85bc9bd50c0a1dfae3c6ea3fe997070 (diff)
downloadgo-bfd5ede78def5e6fe0d0f6f9169daed6deee2d91.tar.xz
add -P pkgdir option to 6l to have it look first in pkgdir for a package.
this allows gotest to find the locally built package when doing make gotest without this option, one would have to say make install gotest which kinda defeats the purpose based on discussions with rsc. R=ken,rsc DELTA=12 (10 added, 1 deleted, 1 changed) OCL=27606 CL=27606
Diffstat (limited to 'src')
-rw-r--r--src/cmd/6l/l.h1
-rw-r--r--src/cmd/6l/obj.c11
-rwxr-xr-xsrc/cmd/gotest/gotest1
3 files changed, 11 insertions, 2 deletions
diff --git a/src/cmd/6l/l.h b/src/cmd/6l/l.h
index 2d3cd535a1..8479156463 100644
--- a/src/cmd/6l/l.h
+++ b/src/cmd/6l/l.h
@@ -288,6 +288,7 @@ EXTERN vlong INITDAT;
EXTERN int32 INITRND;
EXTERN vlong INITTEXT;
EXTERN char* INITENTRY; /* entry point */
+EXTERN char* PKGDIR;
EXTERN Biobuf bso;
EXTERN int32 bsssize;
EXTERN int cbc;
diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c
index 3a4208cd22..b65c7f313b 100644
--- a/src/cmd/6l/obj.c
+++ b/src/cmd/6l/obj.c
@@ -87,6 +87,7 @@ main(int argc, char *argv[])
INITDAT = -1;
INITRND = -1;
INITENTRY = 0;
+ PKGDIR = nil;
ARGBEGIN {
default:
@@ -122,6 +123,11 @@ main(int argc, char *argv[])
if(a)
INITRND = atolwhex(a);
break;
+ case 'P':
+ a = ARGF();
+ if(a)
+ PKGDIR = a;
+ break;
case 'x': /* produce export table */
doexp = 1;
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
@@ -684,9 +690,10 @@ addlib(char *src, char *obj)
}
if(search) {
- // try dot and then try goroot.
- // going to have to do better (probably a command line flag) later.
+ // try dot, -P "pkgdir", and then goroot.
snprint(pname, sizeof pname, ".%s", name);
+ if(access(pname, AEXIST) < 0 && PKGDIR != nil)
+ snprint(pname, sizeof pname, "%s/%s", PKGDIR, name);
if(access(pname, AEXIST) < 0)
snprint(pname, sizeof pname, "%s/pkg/%s", goroot, name);
strcpy(name, pname);
diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest
index 2cb08c5290..12db03bf30 100755
--- a/src/cmd/gotest/gotest
+++ b/src/cmd/gotest/gotest
@@ -13,6 +13,7 @@ GC=${GC:-${O}g}
GL=${GL:-${O}l}
export GC GL
GC="$GC -I _obj"
+GL="$GL -P _obj"
gofiles=""
loop=true