www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Versioning (for Mac)

reply Ant <duitoolkit yahoo.ca> writes:
Anders F Björklund changed dool to compile (and run unittest!)
on the Mac (darwin).

He changed all "version(linux)" to "version(Unix)"
but this makes the drawin version incompatible with
the DMD/linux version

Can we leave the "version(linux)" on the code
and put on the header 
version(Unix)
{
	version = linux;
}
?
perhaps the correct would be:
change all "version(linux)" to "version(CommonUnix)"
and add at the top:
version(linux)	version=CommonUnix;
version(Unix)	version=CommonUnix;
this would allow versioning for specific flavor of unix.
I'm trying this one.




this on DMD/linux prints:
in linux
in Win32


version(linux)
{
	version = Win32;
}
version(Win32)
{
	version = linux;
}

void main()
{
	version(linux) 
	{
		printf("in linux\n");
	}
	version(Win32)
	{
		printf("in Win32\n");
	}
}


Ant
Dec 05 2004
next sibling parent reply John Reimer <brk_6502 yahoo.com> writes:
Ant wrote:
 Anders F Björklund changed dool to compile (and run unittest!)
 on the Mac (darwin).
 
 He changed all "version(linux)" to "version(Unix)"
 but this makes the drawin version incompatible with
 the DMD/linux version
 
I'm really thinking that we should decide on this one before everybody starts doing their own thing. Wasn't there a discussion about version(Unix) and version(Posix) earlier? Unix is a tradmarked name. Is it safe to use it, or even accurate to use it anymore? Linux and Win32, and Windows work fine because they are references to specific OS's. Unix is not or, at least, not in the context it's being used here and other places. It's a reference to a general set of proprietary OS's that have a similar lineage, but sometimes significantly different implementations even in API. If this is the case, doesn't it makes sense to aim for a common API? The Posix standard was designed for that purpose, I believe - to bring disparate Unix-clone systems together. If any systems needs access to OS-specific features, an independent moniker should be coined for them anyway... much like linux, Win32, or Windows. Does this make any sense? I believe version(Posix) or (POSIX) is an acceptable scheme for referring to Unix-clones that share a common API, unless somebody can convince me otherwise. Later, John
Dec 05 2004
next sibling parent John Reimer <brk_6502 yahoo.com> writes:
John Reimer wrote:
 Ant wrote:
 
 Anders F Björklund changed dool to compile (and run unittest!)
 on the Mac (darwin).

 He changed all "version(linux)" to "version(Unix)"
 but this makes the drawin version incompatible with
 the DMD/linux version
I'm really thinking that we should decide on this one before everybody starts doing their own thing. Wasn't there a discussion about version(Unix) and version(Posix) earlier? Unix is a tradmarked name. Is it safe to use it, or even accurate to use it anymore? Linux and Win32, and Windows work fine because they are references to specific OS's. Unix is not or, at least, not in the context it's being used here and other places. It's a reference to a general set of proprietary OS's that have a similar lineage, but sometimes significantly different implementations even in API. If this is the case, doesn't it makes sense to aim for a common API? The Posix standard was designed for that purpose, I believe - to bring disparate Unix-clone systems together. If any systems needs access to OS-specific features, an independent moniker should be coined for them anyway... much like linux, Win32, or Windows. Does this make any sense? I believe version(Posix) or (POSIX) is an acceptable scheme for referring to Unix-clones that share a common API, unless somebody can convince me otherwise. Later, John
Unless of course, Win32, Windows, Linux, and, dare I say, POSIX are trademarked too! Ha, ha. Perhaps the trademark isn't a good reason to base the argument on then. The other reason is still a valid consideration, though. :-)
Dec 05 2004
prev sibling next sibling parent Ant <duitoolkit yahoo.ca> writes:
On Sun, 05 Dec 2004 23:39:36 -0800, John Reimer wrote:

 Ant wrote:
 Anders F Björklund changed dool to compile (and run unittest!)
 on the Mac (darwin).
 
 He changed all "version(linux)" to "version(Unix)"
 but this makes the drawin version incompatible with
 the DMD/linux version
 
I'm really thinking that we should decide on this one before everybody starts doing their own thing.
Let's decide then.
 Wasn't there a discussion about 
 version(Unix) and version(Posix) earlier?
While we wait I'm defining a "CommonUnix".
 
 Does this make any sense?  I believe version(Posix) or (POSIX) is an 
 acceptable scheme for referring to Unix-clones that share a common API, 
 unless somebody can convince me otherwise.
I like that. Later I can easelly change CommonUnix to Posix. Ant
Dec 05 2004
prev sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
John Reimer wrote:

 I'm really thinking that we should decide on this one before everybody 
 starts doing their own thing.  Wasn't there a discussion about 
 version(Unix) and version(Posix) earlier? 
There was. Not that anything was "decided" or anything...
 Unix is a tradmarked name. Is 
 it safe to use it, or even accurate to use it anymore?  Linux and Win32, 
 and Windows work fine because they are references to specific OS's.  
Unix trademark is up in court, since Apple used it in their advertising. I think Windows trademark was up in the Lindows case, and that they won? Either way: "Windows is a registered trademark of Microsoft Corporation" "UNIX is a registered trademark of The Open Group" Win32 is also a trademark, why some GNU projects use "Woe32" instead. As you know, Linux is just a kernel (and registered by Linus Torvalds) But I won't go into that whole Linux debate. (search for GNU/Linux...) For now it just stands for: whatever configuration that DMD supports.
 The Posix standard was designed for that purpose, I believe - to bring 
 disparate Unix-clone systems together.  If any systems needs access to 
 OS-specific features, an independent moniker should be coined for them 
 anyway... much like linux, Win32, or Windows.
I like "Posix" too. My vote is on this, for a new one. Have no idea about the difference between the current versions in D : Win32 and Windows ? Is there one ?
 Does this make any sense?  I believe version(Posix) or (POSIX) is an 
 acceptable scheme for referring to Unix-clones that share a common API, 
 unless somebody can convince me otherwise.
I just used "Unix" since it was already defined in GDC... There is a version(GNU) which is similar to DigitalMars. If one needs to separate out GDC specifically, that is. --anders
Dec 06 2004
prev sibling next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Ant wrote:

 Anders F Björklund changed dool to compile
 (and run unittest!) on the Mac (darwin).
dui will come too, once all the dependencies are fixed... BTW; It only does GTK+ 1.x native, so GTK+ 2.x is in X11
 He changed all "version(linux)" to "version(Unix)"
 but this makes the drawin version incompatible with
 the DMD/linux version
However, it still works with GDC running on Linux The idea was that both "linux" and "darwin" are Unix.
 Can we leave the "version(linux)" on the code
 and put on the header 
 version(Unix)
 {
 	version = linux;
 }
 ?
Something like that could work, although it quickly gets boring to add such version hacks to every file... The compiler should define a common name for them. (the above code also has them flipped the wrong way)
 perhaps the correct would be:
 change all "version(linux)" to "version(CommonUnix)"
 and add at the top:
 version(linux)	version=CommonUnix;
 version(Unix)	version=CommonUnix;
What I (implicitly) used in the code was: version(linux) version=Unix; version(darwin) version=Unix; Which works better than copying/pasting...
 this would allow versioning for specific flavor of unix.
 I'm trying this one.
My "Unix" *was* that CommonUnix. Mac OS X is "darwin". You could also call it "Posix" or "POSIX" or whatever... --anders
Dec 06 2004
parent reply Ant <duitoolkit yahoo.ca> writes:
On Mon, 06 Dec 2004 09:13:26 +0100, Anders F Björklund wrote:

 Ant wrote:
 
 Anders F Björklund changed dool to compile
 (and run unittest!) on the Mac (darwin).
dui will come too, once all the dependencies are fixed...
:) what dependencies? This way of communicating is slow... check my other post. let us know if it works. Ant (it's late here, see you tomorrow)
Dec 06 2004
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Ant wrote:

dui will come too, once all the dependencies are fixed...
:) what dependencies?
Oh, just the usual library dependencies for GTK+ : * GNU make (the system one is somewhat old) - pkg-config - fontconfig * GNU libiconv (the system one is not enough) * GNU libintl (the system one is not enough) - glib 2.2.x * Pango * ATK - GTK+ 2.4.x Current "native" Mac libraries are GTK+ 1.x only... (i.e. the ones building binaries not requiring X11) http://gtk-osx.sourceforge.net/ Building from scratch, since it's somewhat problematic to mix several gcc compilers and Fink run-time libraries. Mostly a proof-of-concept, it won't be useful until it runs *without* requiring the user to install X11 first ? http://www.apple.com/macosx/features/x11/download/ Apple does ship a XFree86 4.3 version with Panther, and there's commercial ones too. But it's not really native... The only other dependancy for DUI seems to be dool (?), and that has been taken care of, as discussed earlier. --anders PS. OpenGL runs fine by itself, though. Not tested from DUI, but tested using the GLUT gears and the libSDL bindings.
Dec 06 2004
prev sibling parent reply Ant <duitoolkit yahoo.ca> writes:
On Mon, 06 Dec 2004 02:04:30 -0500, Ant wrote:

 
 Anders F Björklund changed dool to compile (and run unittest!)
 on the Mac (darwin).
 
 He changed all "version(linux)" to "version(Unix)"
 but this makes the drawin version incompatible with
 the DMD/linux version
So I did it: defined on top of each dool module (where necessary): version(linux) { version=CommonUnix; } version(darwin) // I'm not sure; should it be Unix instead of darwin? { version=CommonUnix; } replaced all version(linux) by version(CommonUnix) added dool/system/drawin.d from Anders created dool.system.specific just to import the correct version (linux, darwin or windows - windows not yet ported from phobos) changed all "import dool.system.linux;" to "import dool.system.specific;" regenerated the Makefile.dool it's on the svn on dsource - anyone wants to try it on the Mac? works fine on linux. http://svn.dsource.org/svn/projects/dool/ Ant
Dec 06 2004
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Ant wrote:

 So I did it:
 
 defined on top of each dool module (where necessary):
 version(linux)
 {
 	version=CommonUnix;
 }
 version(darwin) // I'm not sure; should it be Unix instead of darwin?
 {
 	version=CommonUnix;
 }
It should be darwin. Could be "Unix" instead of "CommonUnix"...
 it's on the svn on dsource - anyone wants to try it on the Mac?
 works fine on linux.
Is that "with DMD", or "with both DMD and GDC" ? (on Linux)
 http://svn.dsource.org/svn/projects/dool/
The makefile failed to create the obj/* folders, but that is minor... Still has hard-coded paths, and SVN has both Makefile + Makefile.dool? Compiling gives:
 dool/io/FileStream.d:55: cannot implicitly convert expression neg1 of type int
to HANDLE
Since you added that to linux.d and forgot to add it to darwin.d ? Besides that, and the Makefile problems above, it passed the tests. (further development of "dool" taken to email, instead of forum) --anders
Dec 06 2004