ref: e9f4727e6dbe517ea9a8f381e45f71137cbbf9ab
parent: 44dc8c62e81aae1adf3f91f5c78e421c98079116
author: Ori Bernstein <[email protected]>
date: Mon Dec 22 14:01:00 EST 2014
Use the right 'ar' command on plan9.
--- a/configure
+++ b/configure
@@ -35,21 +35,20 @@
echo export INST_ROOT=$prefix > config.mk
echo '#define Instroot "'$prefix'"' > config.h
+echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
+echo '#define Linkcmd {"ar", "-rcs", NULL}' >> config.h
+echo '#define Defaultasm Gnugas' >> config.h
case $OS in
*Linux*)
- echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
echo '#define Symprefix ""' >> config.h
echo '#define Defaultasm Gnugas' >> config.h
echo 'export SYS=linux' >> config.mk
;;
*Darwin*)
- echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
echo '#define Symprefix "_"' >> config.h
- echo '#define Defaultasm Gnugas' >> config.h
echo 'export SYS=osx' >> config.mk
;;
*FreeBSD*)
- echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
echo '#define Symprefix ""' >> config.h
echo '#define Defaultasm Gnugas' >> config.h
echo 'export SYS=freebsd' >> config.mk
--- a/mkfile
+++ b/mkfile
@@ -43,6 +43,7 @@
config.h:
echo '#define Instroot "'/'"' > config.h
echo '#define Asmcmd {"6a", "-o", NULL}' >> config.h
+ echo '#define Linkcmd {"ar", "ru", NULL}' >> config.h
echo '#define Symprefix "_"' >> config.h
echo '#define Defaultasm Plan9' >> config.h
--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -26,7 +26,7 @@
/* binaries we call out to */
char *mc = "6m";
char *as[] = Asmcmd;
-char *ar = "ar";
+char *ar[] = Linkcmd;
char *ld = "ld";
char *muse = "muse";
char *runtime = Instroot "/lib/myr/_myrrt.o";
@@ -361,8 +361,8 @@
args = NULL;
nargs = 0;
snprintf(buf, sizeof buf, "lib%s.a", libname);
- lappend(&args, &nargs, strdup(ar));
- lappend(&args, &nargs, strdup("-rcs"));
+ for (i = 0; ar[i]; i++)
+ lappend(&args, &nargs, strdup(ar[i]));
lappend(&args, &nargs, strdup(buf));
for (i = 0; i < nfiles; i++) {
if (hassuffix(files[i], ".myr"))
@@ -505,7 +505,7 @@
case 'A': as[0] = ctx.optarg; break;
case 'M': muse = ctx.optarg; break;
case 'L': ld = ctx.optarg; break;
- case 'R': ar = ctx.optarg; break;
+ case 'R': ar[0] = ctx.optarg; break;
case 'r':
if (!strcmp(ctx.optarg, "none"))
runtime = NULL;