shithub: mc

Download patch

ref: 40503a54ab7d481d67807eb35b2c359379a8415a
parent: 22f8aa508f0313cadc30f941f99fe5f0eb5b155f
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Mar 20 16:10:14 EDT 2018

Add -T to use *only* the passed sytem tags.

--- a/lib/std/cmp.myr
+++ b/lib/std/cmp.myr
@@ -10,7 +10,7 @@
 		`After
 	;;
 
-	generic numcmp		: (a : @a, b : @a -> order)
+	generic numcmp		: (a : @a, b : @a -> order) :: numeric @a
 	const strcmp		: (a : byte[:], b : byte[:] -> order)
 	const strncmp		: (a : byte[:], b : byte[:], n : size -> order)
 	const strcasecmp	: (a : byte[:], b : byte[:] -> order)
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -29,6 +29,7 @@
 		.opts = [
 			[.opt='j', .arg="jobs", .desc="build with at most 'jobs' jobs"],
 			[.opt='t', .arg="tag", .desc="build with specified systag"],
+			[.opt='T', .arg="tag", .desc="build with only the specified systag"],
 			[.opt='S', .desc="generate assembly when building"],
 			[.opt='I', .arg="inc", .desc="add 'inc' to your include path"],
 			[.opt='R', .arg="runsrc", .desc="source to compile and run"],
@@ -51,6 +52,7 @@
 		| ('I', arg):	std.slpush(&bld.opt_incpaths, arg)
 		| ('B', arg):	bld.opt_instbase = arg
 		| ('t', tag):	std.slpush(&tags, tag)
+		| ('T', tag):	std.slpush(&bld.opt_alltags, tag)
 		| ('j', arg):	bld.opt_maxproc = std.getv(std.intparse(arg), 1)
 		| ('R', arg):	runsrc = arg
 		| ('o', arg):	bld.opt_objdir = arg
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -10,6 +10,7 @@
 	var opt_runtime		: byte[:]
 	var opt_genasm		: bool
 	var opt_incpaths	: byte[:][:]
+	var opt_alltags		: byte[:][:]
 	var opt_mcflags		: byte[:][:]
 	var opt_museflags	: byte[:][:]
 	var opt_ldflags		: byte[:][:]
@@ -48,6 +49,7 @@
 var opt_mcflags		= [][:]
 var opt_museflags	= [][:]
 var opt_ldflags		= [][:]
+var opt_alltags		= [][:]
 var opt_objdir		= "obj"
 var opt_genasm  	= false
 var opt_silent		= false
--- a/mbld/syssel.myr
+++ b/mbld/syssel.myr
@@ -142,27 +142,32 @@
 }
 
 const addsysattrs = {b, tags
-	std.htput(b.tags, opt_sys, opt_sysvers)
+	if opt_alltags.len > 0
+		for t : opt_alltags
+			tag(b, t)
+		;;
+	else
+		std.htput(b.tags, opt_sys, opt_sysvers)
 
-	match opt_sys
-	| "freebsd":	tag(b, "posixy")
-	| "netbsd":	tag(b, "posixy")
-	| "openbsd":	tag(b, "posixy")
-	| "osx":	tag(b, "posixy")
-	| "linux":	tag(b, "posixy")
-	| "plan9":
-	| unknown:	std.fatal("unknown system \"{}\"\n", unknown)
-	;;
+		match opt_sys
+		| "freebsd":	tag(b, "posixy")
+		| "netbsd":	tag(b, "posixy")
+		| "openbsd":	tag(b, "posixy")
+		| "osx":	tag(b, "posixy")
+		| "linux":	tag(b, "posixy")
+		| "plan9":
+		| unknown:	std.fatal("unknown system \"{}\"\n", unknown)
+		;;
 
-	match opt_arch
-	| "x64":	tag(b, "x64")
-	| unknown:	std.fatal("unknown architecture {}\n", unknown)
+		match opt_arch
+		| "x64":	tag(b, "x64")
+		| unknown:	std.fatal("unknown architecture {}\n", unknown)
+		;;
+		for t : tags
+			tag(b, t)
+		;;
+		loadtagfile(b, "bld.tag")
 	;;
-	for t : tags
-		tag(b, t)
-	;;
-
-	loadtagfile(b, "bld.tag")
 }
 
 const loadtagfile = {b, tagfile