FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Massive Update
Goto page 1, 2  Next
 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Tue Feb 13, 2007 11:02 pm    Post subject: Massive Update Reply with quote

I've just uploaded a ton of modifications to the trunk. Most of them will not affect most users. Unless you want to use Tango with Derelict on Linux, there's no need to update right now. In fact, I advise you not to unless you explicitly want to try out Tango and Derelict on Linux (not Windows -- see below).

The Build Script

First, before getting into the Tango stuff, I want to talk about the build script. It has always been a sort of hacked together bit of code. The changes I made to it a couple of weeks ago were no different. But given the problems I was having with the new changes (i.e. supporting DMD and GDC in addition to Bud) and with the growing number of build tools available, I decided to overhaul the script yet again.

The new version of the script is much easier to maintain. The biggest change is that it's more organized so that it's easier to read. I also went from 100% free-functions to a mixed approach, using a Builder class for compilation. I temporarily removed support for building without Bud, but with the new design it will be easy to add support for other tools. I intend to do so eventually: rebuild, DMD, and GDC will all be supported at some point.

As part of this build script overhaul, I renamed all of the text files that are used to pass options to Bud. Where before you say build_*.txt in the top-level directory, and a forbuild.txt in each package directory, you will now see bud_*.txt and fobud.txt. This doesn't directly affect anyone, really, unless you are developing a new Derelict package. So when you want to change config options, those are the files to look for now. I am considering whether or not to take compiler-specific options out and put those into different files.

Additionally, I've added a new command line option to the build script (which I forgot to document in the commit log). When building the libraries with Bud, the script creates a temporary Build Response File. Upon successful compilation, it deletes the file. If you want to keep it around even when compilation was successful, just pass 'noDelBRF' somewhere on the command line and the temporary file will not be deleted.

Since bud is once again the only build tool supported by the build script, you don't need to pass 'bud' on the command line. The script will default to 'bud' right now. This behavior will change in the future, when support for direct compilation is added back in. If you still use 'build' as the name of the executable, pass that on the command line and it will be used in place of 'bud'.

Tango Support

This has been a bitch to implement. Actually, implementing it in the packages was easy. Only three packages required changes (DerelictUtil, DerelictGL and DerelictSDLMixer). The changes to DerelictGL were extensive, since every extension module made use of std.string from Phobos. I updated them all automatically, though, with a simple script I wrote with Tango Smile

To facilitate compatibility with both Phobos and Tango, I added a new module to DerelictUtil -- wrapper.d. It provides wrappers for Phobos/Tango functions used by Derelict. Anywhere in Derelict that a Phobos call was made, it was replaced by a call to a new wrapper method. In the future, when adding packages to Derelict, these functions should be used rather than Phobos or Tango functions. If something you need is not wrapped, it should be added.

Additionally, because of issues with Tango's Win32 modules (i.e. they were removed before the beta release), I decided to make Derelict completely independent from any external Win32 modules. To do so, I added a new wintypes.d module to DerelictUtil. Both the loader in DerelictUtil and the modules in DerelictGL use this module now. Again, when adding new packages this module should be used in place of any other when Win32 types and declarations are needed. If something is missing from the module that your package needs, just add it.

Now, for the caveats. Tango support is broken on Windows. It's unfortunate, but I kept encountering some inexplicable errors when trying to build the new packages into an app with Bud. I encountered similar errors when attempting to add Tango support to the build script. So, for now, you can only use Derelict with Tango on Linux. Additionally, Tango support in the build script is incomplete. So, to use Tango with Derelict on Linux, you need to build your applications with a build tool such as Bud, Rebuild, or DSSS. Without any means to test a Tango-ized build script, I decided to put it off for a bit. Once the Windows errors get resolved, so that I can actually test the script, I'll implement it fully.

I was able to test the new build script with bud on Windows without Tango. Compilation is fine and the sdl_ex1 example executes fine as well. I did not test anything else. Because of the Tango errors, Tango support is 100% untested. I don't even know if it compiles. So, if you are trying this out on Linux, please, please, please let me know if you encounter any problems.

Documentation

The docs have not yet been updated. So that means that both the documentation for compiling with the build script and the docs for Derelictifying a package are out of date. It also means that there is no documentation at all for the new Tango support.

Consider the Trunk Unstable

For the near future, you can consider the trunk unstable. I didn't think a branch or a tag was warranted, as things still work fine when not using Tango. Still, unless you want to play with Derelict and Tango on Linux, just don't bother updating until I get all of the kinks worked out.

As always, let me know if you have any problems.
_________________
The One With D | The One With Aldacron | D Bits


Last edited by aldacron on Mon Mar 12, 2007 11:09 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
proj



Joined: 14 Feb 2007
Posts: 5
Location: austin,tx

PostPosted: Wed Feb 14, 2007 12:29 am    Post subject: On support for multiple build systems Reply with quote

Hi this is my first post and I have really just been into D and derelict for a short time now. I am using OSX 10.3 so had to make some changes to the buildme.d script in TRUNK to support the differences in mac object tools. Also I added similar functionality to your noDelBRF option but to also support leaving object files between compilations and putting them in a seperate compilation path depending on release or debug.

I have one fix for endian.d in SDL to fix a compile error on mac ppc:

Code:

Index: DerelictSDL/derelict/sdl/endian.d
===================================================================
--- DerelictSDL/derelict/sdl/endian.d   (revision 223)
+++ DerelictSDL/derelict/sdl/endian.d   (working copy)
@@ -101,7 +101,7 @@
 {
     Uint16 SDL_SwapLE16(Uint16 val)
     {
-        return ((val<<8)|(val>>8));
+        return cast(Uint16)((val<<8)|(val>>8));
     }
 
     Uint32 SDL_SwapLE32(Uint32 val)


Looking at the multiple compilation support in buildme I don't understand the rationale. It seems that you should choose the option that fits the project and your tastes best and keep that. There is an overhead in supporting multiple build flavors and complications in testing the subtle differences. Also as new features are added to a wrapped build tool be it bud, rebuild or dsss, buildme will require duplicatated features in the compile() code path.

Thanks for your excellent work I hope to contribute to this project and hopefully provide some polish on the OS X side of things.
Back to top
View user's profile Send private message MSN Messenger
odeamus



Joined: 21 Feb 2006
Posts: 78
Location: Helsinki, Finland

PostPosted: Wed Feb 14, 2007 2:46 am    Post subject: Reply with quote

I got a simple SDL window in OpenGL mode working on windows, with Tango of course.

I had to edit four files in derelict and had to copy the std.c.windows.windows module from phobos to my project.

Here are the changes I made.

Code:

Index: DerelictUtil/derelict/util/wrapper.d
===================================================================
--- DerelictUtil/derelict/util/wrapper.d        (revision 226)
+++ DerelictUtil/derelict/util/wrapper.d        (working copy)
@@ -51,14 +51,14 @@

 char* toCString(char[] str)
 {
-       version(Tango)
+       version(Tango)
        {
-               toUtf8z(str);
+               return toUtf8z(str);
        }
        else
        {
                return toStringz(str);
-       }
+       }
 }

 char[] toDString(char* cstr)


Code:

Index: DerelictSDL/derelict/sdl/rwops.d
===================================================================
--- DerelictSDL/derelict/sdl/rwops.d    (revision 226)
+++ DerelictSDL/derelict/sdl/rwops.d    (working copy)
@@ -32,7 +32,14 @@
 module derelict.sdl.rwops;

 private import derelict.sdl.types;
-private import std.c.stdio;
+version(Tango)
+{
+    import tango.stdc.stdio;
+}
+else
+{
+    import std.c.stdio;
+}


Here I had to change the import to point to the file I copied from phobos.
Code:

Index: DerelictSDL/derelict/sdl/syswm.d
===================================================================
--- DerelictSDL/derelict/sdl/syswm.d    (revision 226)
+++ DerelictSDL/derelict/sdl/syswm.d    (working copy)
@@ -47,7 +47,7 @@
 //=============================================================================
=
 version(Windows)
 {
-    import std.c.windows.windows;
+    import windows;


This was an unused import.
Code:

Index: DerelictGLU/derelict/opengl/glu.d
===================================================================
--- DerelictGLU/derelict/opengl/glu.d   (revision 226)
+++ DerelictGLU/derelict/opengl/glu.d   (working copy)
@@ -37,9 +37,6 @@
     import derelict.util.loader;
 }

-version(Windows)
-    private import std.c.windows.windows;
-


I used rebuild to build the executable, if that is relevant. The missing windows stuff in Tango is not good obviously, but with little hacking derelict can be used with Tango on windows.

I'll start converting the rest of my NeHe tutorials to Tango now and I'll post here if I encounter any problems.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Feb 14, 2007 4:22 am    Post subject: Re: On support for multiple build systems Reply with quote

proj wrote:
Looking at the multiple compilation support in buildme I don't understand the rationale.


The recommended way of using Derelict is to build it into your application with a build tool, like DSSS, Bud, or Rebuild, and just skip the build script altogether. Before Bud came along, we used to provide make files and shell scripts to build the libraries. After Bud, I was tempted to do away with the build scripts altogether. But since it was so easy to write one up to run with DMD's -run option to build the libs with Bud, that's what I did. Had I known then that more build tools would pop up in the future, I would have left it alone.

So, with the build script in place, no matter how much I insisted on the 'recommended' approach, people automatically build the libs. I was (and am) hesitant to remove it because I know that not everyone uses Bud to build their applications and needed the libraries anyway. In some cases, when using some IDEs, it's the most convenient option. So now with the additional build tools, I just don't feel right requiring Bud to build the libs. If someone prefers Rebuild and doesn't want to use Bud, they'll have to install it anyway if they want to build the libs. And what about people who don't want to install any of the build tools and prefer to use the compilers directly?

So that's the rationale. Derelict is middleware and, as such, I think that if I'm going to provide a build script then I ought to support as many options as possible. Though I'm mighty tempted to do away with the build script altogether, there are enough people who use it that I won't.

BTW, nice work on the Mac stuff.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Feb 14, 2007 4:28 am    Post subject: Reply with quote

Thanks for the corrections. Just to point out something, though:

odeamus wrote:
I had to edit four files in derelict and had to copy the std.c.windows.windows module from phobos to my project.


In the future, if you need any win32 declarations to support a Derelict module, they should go into the new derelict.util.wintypes module. I'm trying to do away with reliance on the dependence upon std.c.windows.windows.

Of course, I'm now wondering why you needed that at all. Aren't you on Linux?
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
odeamus



Joined: 21 Feb 2006
Posts: 78
Location: Helsinki, Finland

PostPosted: Wed Feb 14, 2007 4:32 am    Post subject: Reply with quote

aldacron wrote:
Thanks for the corrections. Just to point out something, though:

odeamus wrote:
I had to edit four files in derelict and had to copy the std.c.windows.windows module from phobos to my project.


In the future, if you need any win32 declarations to support a Derelict module, they should go into the new derelict.util.wintypes module. I'm trying to do away with reliance on the dependence upon std.c.windows.windows.


I was lazy and I just wanted to see if I could get it to work.

Quote:

Of course, I'm now wondering why you needed that at all. Aren't you on Linux?


No, I'm on windows. :)
Always have been.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Feb 14, 2007 7:49 am    Post subject: Reply with quote

Okay, I've confirmed that things do compile with Rebuild on Windows. I compiled and executed sdl_ex1 without a problem with Rebuild, but still get an error when using Bud.

So, to revise what I said above, if you are on Windows and want to try out Derelict with Tango, you can do so as long as you use Rebuild (or, I assume, DSSS). I won't be adding support to the build script for this just yet.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
proj



Joined: 14 Feb 2007
Posts: 5
Location: austin,tx

PostPosted: Wed Feb 14, 2007 9:00 am    Post subject: Re: On support for multiple build systems Reply with quote

aldacron wrote:

proj wrote:
Looking at the multiple compilation support in buildme I don't understand the rationale.


The recommended way of using Derelict is to build it into your application with a build tool, like DSSS, Bud, or Rebuild, and just skip the build script altogether. Before Bud came along, we used to provide make files and shell scripts to build the libraries. After Bud, I was tempted to do away with the build scripts altogether. But since it was so easy to write one up to run with DMD's -run option to build the libs with Bud, that's what I did. Had I known then that more build tools would pop up in the future, I would have left it alone.


Okay it's good to understand the history. I'm guess I need to be clear to on the scope of what I'm talking about which is just buildme.d. I'm think it's great to have support for multiple build types but buildme should at least have a consistent set of requirements and way to build the libraries. Perhaps introducing a build/ subdir and allowing people to put in specific IDE/build tool helpers to ease integrating derelict into their build system would be a good direction. Then you can keep buildme as the canonical, stand-alone, cross platform build target.

aldacron wrote:

So, with the build script in place, no matter how much I insisted on the 'recommended' approach, people automatically build the libs. I was (and am) hesitant to remove it because I know that not everyone uses Bud to build their applications and needed the libraries anyway. In some cases, when using some IDEs, it's the most convenient option. So now with the additional build tools, I just don't feel right requiring Bud to build the libs. If someone prefers Rebuild and doesn't want to use Bud, they'll have to install it anyway if they want to build the libs. And what about people who don't want to install any of the build tools and prefer to use the compilers directly?

So that's the rationale. Derelict is middleware and, as such, I think that if I'm going to provide a build script then I ought to support as many options as possible. Though I'm mighty tempted to do away with the build script altogether, there are enough people who use it that I won't.


I actually support the idea of having a D based stand alone build system for derelict. There are already so many dependencies in derelict due to the nature of the system that removing the question of 'how the heck do I build this?' is actually a big win.

I think it's possible at this point it may either be possible to move bud/rebuild support outside of buildme.d with a seperate build/ packages directory. buildme.d is pretty much stripped down version of bud specialized for derelict ;)

aldacron wrote:
BTW, nice work on the Mac stuff.


Thanks! Once you're done stabalizing trunk I will resolve my changes and submit a mac patch.

Great work on derelict!
Back to top
View user's profile Send private message MSN Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Feb 20, 2007 8:55 pm    Post subject: Reply with quote

aldacron wrote:
Okay, I've confirmed that things do compile with Rebuild on Windows. I compiled and executed sdl_ex1 without a problem with Rebuild, but still get an error when using Bud.

So, to revise what I said above, if you are on Windows and want to try out Derelict with Tango, you can do so as long as you use Rebuild (or, I assume, DSSS). I won't be adding support to the build script for this just yet.

What kinds of errors were you running into? Would be good to get that sorted out, since you're not the first to resolve them in this manner.

Also, I'd like to note that we've been trying to get Tango into a lib for ages. Doing so would help Tango avoid these kinds of issues also, and reduce the number of tools needed in the process. Unfortunately the DM toolchain doesn't support us doing that on Win32. Best we can do is maintain some pressure regarding template+lib problems?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Tue Feb 20, 2007 10:51 pm    Post subject: Reply with quote

kris wrote:
What kinds of errors were you running into? Would be good to get that sorted out, since you're not the first to resolve them in this manner.


Undefined Symbol Errors. I've seen them from a handful of different sources when trying to compile Tango apps on Windows. While initially toying around with Tango support for the build script, I got quite a few of them when running it with DMD's -run option.

Anyway, as an example of what I've been seeing, take a gander at this post I made in the Tango forums.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Feb 20, 2007 10:57 pm    Post subject: Reply with quote

Ahhh ... I've seen Build do all kinds of strange things when presented with multiple version statements like that example has Confused

In many cases, I would move version(UnitTest) {} code up to the top of a module to get them to 'take'. That's perhaps got something to do with the issue here, and would explain why rebuild works instead (it used the compiler front-end).
Back to top
View user's profile Send private message
Deltafire



Joined: 21 Feb 2007
Posts: 4

PostPosted: Sat Feb 24, 2007 6:41 pm    Post subject: Reply with quote

For Tango:

Code:

--- derelict.orig/util/loader.d 2007-02-24 23:18:46.000000000 +0000
+++ derelict/util/loader.d      2007-02-25 00:41:14.000000000 +0000
@@ -279,9 +279,16 @@
     {
         version(linux)
         {
-            private import std.c.linux.linux;
+           version(Tango)
+           {
+               private import tango.sys.linux.linux;
+            }
+           else
+            {
+               private import std.c.linux.linux;
+            }
         }
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Feb 24, 2007 10:05 pm    Post subject: Reply with quote

I assume that's for the libdl declarations. I had intended to remove the std.c.linux.linux bit and just use the local declarations that were already there. That's done now, so there should be no dependence on the linux modules from Tango or Phobos. Let me know if it doesn't work.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
volcore



Joined: 22 Jan 2007
Posts: 19

PostPosted: Sun Feb 25, 2007 5:21 am    Post subject: Reply with quote

Doesn't work. I'm getting a multiple definitions error in the linker stage. I've patched my local version much like Deltafire proposed, and that works very well.

Also, there is another issue, with recent tango svn versions, is that demarcate has been deprecated and replaced by split, much like the phobos split function. This leads to the following patch:

Code:

Index: derelict/DerelictUtil/derelict/util/wrapper.d
===================================================================
--- derelict/DerelictUtil/derelict/util/wrapper.d       (revision 229)
+++ derelict/DerelictUtil/derelict/util/wrapper.d       (working copy)
@@ -88,14 +88,7 @@

 char[][] splitStr(char[] str, char[] delim)
 {
-       version(Tango)
-       {
-               return demarcate(str, delim);
-       }
-       else
-       {
-               return split(str, delim);
-       }
+       return split(str, delim);
 }
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Feb 25, 2007 9:11 am    Post subject: Reply with quote

volcore wrote:
Doesn't work. I'm getting a multiple definitions error in the linker stage. I've patched my local version much like Deltafire proposed, and that works very well.


Any idea where the other definitions coming from?

Quote:
Also, there is another issue, with recent tango svn versions, is that demarcate has been deprecated and replaced by split, much like the phobos split function.


Yes, I'm aware of this. But I'm not going to change it until the next official release of Tango. It's not a good idea to require the latest trunk when there's an official beta release for download.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group