ref: 96da70b6356fc720eec5469d251c8031f24313ea
parent: 04c7c7f5989f7521ca68c8604b5b98b3bd4502bb
author: Ori Bernstein <[email protected]>
date: Fri May 15 07:24:01 EDT 2015
Don't hardcode paths. Plan 9 needs them to be configured differently.
--- a/configure
+++ b/configure
@@ -52,7 +52,10 @@
echo "const Ascmd = [\"as\", \"-g\"]" >> mbld/config.myr
echo "const Directlib = false" >> mbld/config.myr
echo "const Runtime = \"_myrrt.o\"" >> mbld/config.myr
+# paths to install to
echo "const Manpath = \"share/man/man\"" >> mbld/config.myr
+echo "const Binpath = \"bin\"" >> mbld/config.myr
+echo "const Libpath = \"lib/myr\"" >> mbld/config.myr
case $OS in
*Linux*)
echo '#define Symprefix ""' >> config.h
--- a/mbld/config+plan9-x64.myr
+++ b/mbld/config+plan9-x64.myr
@@ -1,5 +1,5 @@
pkg config =
- const Instroot = "/amd64"
+ const Instroot = "/"
const Sys = "Plan9"
const Objsuffix = ".6"
const Linkcmd = ["6l", "-lo"]
@@ -7,5 +7,8 @@
const Ascmd = ["6a"]
const Directlib = true
const Runtime = "_myrrt.6"
- const Manpath = "man/"
+
+ const Manpath = "man"
+ const Binpath = "amd64/bin"
+ const Libpath = "amd64/lib/myr"
;;
--- a/mbld/install.myr
+++ b/mbld/install.myr
@@ -28,11 +28,11 @@
for tn in b.all
match gettarg(b.targs, tn)
| `Bin bt:
- movefile(b, delete, bt.dir, bt.name, opt_instroot, opt_destdir, "bin", 0o755)
+ movefile(b, delete, bt.dir, bt.name, opt_instroot, opt_destdir, config.Binpath, 0o755)
| `Lib lt:
- movefile(b, delete, lt.dir, lt.name, opt_instroot, opt_destdir, "lib/myr", 0o644)
+ movefile(b, delete, lt.dir, lt.name, opt_instroot, opt_destdir, config.Libpath, 0o644)
libarchive = std.fmt("lib%s.a", lt.name)
- movefile(b, delete, lt.dir, libarchive, opt_instroot, opt_destdir, "lib/myr", 0o644)
+ movefile(b, delete, lt.dir, libarchive, opt_instroot, opt_destdir, config.Libpath, 0o644)
std.slfree(libarchive)
| `Gen gt:
/* nothing to do */
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -13,10 +13,10 @@
typedef unsigned long long uvlong;
typedef struct Srcloc Srcloc;
-
typedef struct Bitset Bitset;
-typedef struct Htab Htab;
typedef struct Optctx Optctx;
+typedef struct Strbuf Strbuf;
+typedef struct Htab Htab;
typedef struct Str Str;
typedef struct Tok Tok;
@@ -70,6 +70,12 @@
#define Zloc ((Srcloc){-1, 0})
+struct Strbuf {
+ char *buf;
+ size_t sz;
+ size_t len;
+};
+
struct Srcloc {
int line;
int file;
@@ -625,6 +631,12 @@
size_t max(size_t a, size_t b);
size_t min(size_t a, size_t b);
size_t align(size_t sz, size_t a);
+
+/* string buffer */
+Strbuf *mksb();
+char *sbfin(Strbuf *sb);
+void sbputs(Strbuf *sb, char *s);
+void sbputb(Strbuf *sb, char b);
/* suffix replacement */
char *swapsuffix(char *buf, size_t sz, char *s, char *suf, char *swap);