Any chance to see colour output from CMake-based installations?

Ryan Schmidt ryandesign at macports.org
Fri Jul 5 19:55:23 PDT 2013


On Jul 5, 2013, at 19:53, Mojca Miklavec wrote:

> Just a follow-up question then. Is the "MacPorts could fool its
> subservient programs into thinking they're running in a terminal" part
> something trivial or something complex to implement?
> 
> If it is trivial to do, I would like to run it locally from time to
> time. If it is complex, I will simply forget the matter.

I Googled for how to determine if a command line program should output color, and the method I saw described most often is that the program should check whether output is going to a tty, and if so, then check how many colors the terminal supports.

In MacPorts, AFAIK programs are not connected to a tty; they're connected to a pipe.

I don't know how you would go about changing MacPorts to connect programs to a tty instead of a pipe, and as I said, doing so would probably confuse some build systems that would then logically expect a user to be interacting with that tty and for that user to be able to interactively answer configuration questions. See for example the configuration output of perl5.12. which begins:


First let's make sure your kit is complete.  Checking...
Locating common programs...
Checking compatibility between /bin/echo and builtin echo (if any)...
Symbolic links are supported.
Checking how to test for symbolic links...
You can test for symbolic links with 'test -h'.
Good, your tr supports [:lower:] and [:upper:] to convert case.
Using [:upper:] and [:lower:] to convert case.
3b1   		catamount   	dynixptx   	hpux   		lynxos   	next_4   	riscos   	super-ux   	uts   
aix   		convexos   	epix   		i386   		midnightbsd   	nonstopux   	sco   		svr4   		uwin   
aix_3   	cxux   		esix4   	interix   	mips   		openbsd   	sco_2_3_0   	svr5   		vmesa   
aix_4   	cygwin   	fps   		irix_4   	mirbsd   	opus   		sco_2_3_1   	ti1500   	vos   
altos486   	darwin   	freebsd   	irix_5   	mpc   		os2   		sco_2_3_2   	titanos   
amigaos   	dcosx   	genix   	irix_6   	mpeix   	os390   	sco_2_3_3   	ultrix_4   
apollo   	dec_osf   	gnu   		irix_6_0   	ncr_tower   	os400   	sco_2_3_4   	umips   
atheos   	dgux   		gnukfreebsd   	irix_6_1   	netbsd   	posix-bc   	solaris_2   	unicos   
aux_3   	dos_djgpp   	gnuknetbsd   	isc   		newsos4   	powerux   	stellar   	unicosmk   
beos   		dragonfly   	greenhills   	isc_2   	next_3   	qnx   		sunos_4_0   	unisysdynix   
bsdos   	dynix   	haiku   	linux   	next_3_0   	rhapsody   	sunos_4_1   	utekv   
Which of these apply, if any? [darwin]  
Operating system name? [darwin]  
Operating system version? [12.4.0]  
Installation prefix to use? (~name ok) [/opt/local]  
AFS does not seem to be running...
What installation prefix should I use for installing files? (~name ok) [/opt/local]  
Build Perl for SOCKS? [n]  
Use the PerlIO abstraction layer? [y]  
Getting the current patchlevel...
Build a threading Perl? [y]  
Use which C compiler? [/usr/bin/clang]  


Since configuration output is not connected to a tty, it uses the default values for each configuration question. But if you go into the source directory and manually run "sudo sh Configure" from your terminal (i.e. from a tty) you'll be interactively prompted for answers:


Beginning of configuration questions for perl5.
 
Checking echo to see how to suppress newlines...
...using \c
The star should be here-->*
 
First let's make sure your kit is complete.  Checking...
Looks good...
 
 
Would you like to see the instructions? [n]





More information about the macports-dev mailing list