1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:24:39 -07:00

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
This commit is contained in:
Rob Pike 2009-04-17 19:39:45 -07:00
parent 45ed7297e8
commit bfd5ede78d
3 changed files with 11 additions and 2 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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