shithub: mc

Download patch

ref: 6126262772590d74d00325f6c33c7ab5c6ba3987
parent: a6b13e22bbb7cbeeae4cffa335ac04065a90f6db
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Apr 13 20:17:46 EDT 2015

Fix installing manpages.

--- a/genbootstrap.sh
+++ b/genbootstrap.sh
@@ -2,6 +2,7 @@
 
 export MYR_MUSE=../muse/muse
 export MYR_MC=../6/6m
+export MYR_RT=../rt/_myrrt.o
 mbld clean
 # The generated shell script should be a compatible bourne
 # shell script.
--- a/mbld/install.myr
+++ b/mbld/install.myr
@@ -29,18 +29,18 @@
 	for tn in b.all
 		match gettarg(b.targs, tn)
 		| `Bin bt:
-			movefile(delete, bt.name, opt_instroot, opt_destdir, "bin", 0o755)
+			movefile(b, delete, bt.dir, bt.name, opt_instroot, opt_destdir, "bin", 0o755)
 		| `Lib lt:
-			movefile(delete, lt.name, opt_instroot, opt_destdir, "lib/myr", 0o644)
+			movefile(b, delete, lt.dir, lt.name, opt_instroot, opt_destdir, "lib/myr", 0o644)
 			libarchive = std.fmt("lib%s.a", lt.name)
-			movefile(delete, libarchive, opt_instroot, opt_destdir, "lib/myr", 0o644)
+			movefile(b, delete, lt.dir, libarchive, opt_instroot, opt_destdir, "lib/myr", 0o644)
 			std.slfree(libarchive)
 		| `Gen gt:
 			/* nothing to do (?) */
-		| `Man mans:
+		| `Man mt:
 			/* FIXME: figure out man section by number */
-			for m in mans
-				moveman(delete, m)
+			for m in mt.pages
+				moveman(b, delete, mt.dir, m)
 			;;
 		| `Test tt:	/* nothing */
 		;;
@@ -49,9 +49,10 @@
 }
 
 
-const movefile = {delete, file, instdir, destdir, prefix, perm
+const movefile = {b, delete, dir, file, instdir, destdir, prefix, perm
 	var path
 
+	setdir(b, dir)
 	path = std.pathjoin([destdir, instdir, prefix, file][:])
 	if delete
 		std.put("\tdelete %s\n", path)
@@ -73,7 +74,7 @@
 	std.slfree(path)
 }
 
-const moveman = {delete, man
+const moveman = {b, delete, dir, man
 	var sect, manrel
 
 	match std.strrfind(man, ".")
@@ -87,6 +88,6 @@
 	;;
 
 	manrel = std.fmt("%s%s", opt_manpath, man[sect:])
-	movefile(delete, man, opt_instroot, opt_destdir, manrel, 0o644)
+	movefile(b, delete, dir, man, opt_instroot, opt_destdir, manrel, 0o644)
 	std.slfree(manrel)
 }
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -75,11 +75,13 @@
 	opt_destdir = std.getenvv("DESTDIR", "")
 	opt_mc = std.getenvv("MYR_MC", "6m")
 	opt_muse = std.getenvv("MYR_MUSE", "muse")
+	opt_runtime = std.getenvv("MYR_RT", "")
+	if opt_runtime.len == 0
+		opt_runtime = std.pathjoin([opt_instroot, "lib/myr", config.Runtime][:]) 
+	;;
 
 	sysarchstr = std.fmt("+%s-%s", opt_sys, opt_arch)
 	sysstr = std.fmt("+%s", opt_sys)
 	archstr = std.fmt("+%s", opt_arch)
-
-	opt_runtime = std.pathjoin([opt_instroot, "lib/myr", config.Runtime][:]) 
 }
 
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -132,7 +132,13 @@
 
 /* mantarget: anontarget */
 const mantarget = {b, p
-	addtarg(p, b, "__man__", `Man anontarget(p, "man"))
+	var targ
+
+	targ = std.mk([
+		.dir=std.sldup(p.fdir),
+		.pages=anontarget(p, "man")
+	])
+	addtarg(p, b, "__man__", `Man targ)
 }
 
 /* subtarget : anontarget */
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -16,16 +16,12 @@
 		arch	: byte[:]
 	;;
 
-
-	type depgraph = struct
-		roots	: byte[:][:]
-		deps	: std.htab(byte[:], byte[:][:])#
-		libs	: std.htab(byte[:], byte[:][:])#
-		input	: std.htab(byte[:], byte[:])#
-		sources	: std.htab(byte[:], bool)#
-		updated	: std.htab(byte[:], bool)#
-		seen	: std.htab(byte[:], bool)#
-		done	: std.htab(byte[:], bool)#
+	type targ = union
+		`Bin	myrtarg#
+		`Lib	myrtarg#
+		`Test	myrtarg#
+		`Gen	gentarg#
+		`Man	mantarg#
 	;;
 
 	type myrtarg = struct
@@ -49,11 +45,19 @@
 		done	: bool
 	;;
 
-	type targ = union
-		`Bin	myrtarg#
-		`Lib	myrtarg#
-		`Test	myrtarg#
-		`Gen	gentarg#
-		`Man	byte[:][:]
+	type mantarg = struct
+		dir	: byte[:]
+		pages	: byte[:][:]
+	;;
+
+	type depgraph = struct
+		roots	: byte[:][:]
+		deps	: std.htab(byte[:], byte[:][:])#
+		libs	: std.htab(byte[:], byte[:][:])#
+		input	: std.htab(byte[:], byte[:])#
+		sources	: std.htab(byte[:], bool)#
+		updated	: std.htab(byte[:], bool)#
+		seen	: std.htab(byte[:], bool)#
+		done	: std.htab(byte[:], bool)#
 	;;
 ;;