X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2Fblog-0009.html-inc;h=4c366da9655f0706e833bbc242ab0e3902d77a9f;hb=a3de848879a5553418ed11fb193c4bf286ca7120;hp=76d8474e568c2f8d462605ecd53c7a5bf5cfccae;hpb=d502f71f4cb7e6073e2629cdba69f20e7001b721;p=sdlgit%2FSDL-Site.git diff --git a/pages/blog-0009.html-inc b/pages/blog-0009.html-inc index 76d8474..4c366da 100644 --- a/pages/blog-0009.html-inc +++ b/pages/blog-0009.html-inc @@ -1,6 +1,26 @@

-The Future and Beyond! +The Build Process of SDL Perl

-
I do not think about awesomeness...
I just am awesomeness
n.n
--KatrinaTheLamia


Updates

Since the last post SDL Perl has seen an increase of interest to both use and contribute to SDL Perl. Before I dig into the updates, I would like to acknowledge them.

Core Development

Acme (Leon Brocard): Has started to work on the Redesign Effort with me. The help is much appreciated! Enjoy your vacation.

Website and Windows Testing

FROGGS (Tobias Leich): Came in as a new user to SDL Perl. And after breaking the redesigned SDL Perl in as many ways possible he has decided to help out on the new site.


Last Legacy Release


Ok! Now this weekend hopefully we will release our last legacy release, after this we move on! This release will focus on showing of SDL + Perl possibilities.

Pong + SDL::Game::Rect

garu has been working on making SDL object extensions that provide a more perly way to use and play with the SDL bindings. To demonstrate the benefits of this SDL::Tutorial::Pong is done and being polished up. SDL::Game::Rect is a peek in to the design and vision we have for SDL down the road.

Design

The design we have settled on for future release for SDL Perl can be broken in to two layers, SDL::* and SDL::Game::*. Previously the SDL Perl library tried to provide C bindings and provide Perl Idiomatic access. This was messy in regards to the single responsibility principle (do one thing and do it well).

We have decided to separate these two focuses into the two name spaces SDL::* and SDL::Game::*. SDL::* will provide straight access to SDL's C API, nothing less and nothing more. SDL::Game::* will extend and make pretty unicorns for Perl.

This design has already begin to pay of. One major benefit been in the XS readability. Moreover since structs are treated as objects, Perl manages their destruction, and deliver less memory leaks.
\ No newline at end of file +

A while ago I had a long chat with mst on why SDL uses Module::Build rather then Make. I told him it is a simple matter of code inertia. The existing Module::Build system has worked well for us so far. Never the less, he convinced me that switching to Make will improve debugging the Build system. But to be able to switch we will need to completely replace the Build system. I am not prepared to do that so I will just present the requirements so mst or someone else can at least attempt to switch.


+
+

The Build Process


+ Alien::SDL
+
+

SDL Perl depends on a few C libraries for a complete install. This is handled by Alien::SDL. First we look for existing SDL libraries and dependencies by doing a File::Find for headers. If these headers are found we present and option for the user to use those. We then store these locations in Alien::SDL->config options 'cflags', 'prefix' and 'libs'. If we do not have libraries available even for a minimum SDL installed ( SDL.h is not found). We provide several platform specific options.


+

For windows we have a simpler process. We download prebuilt binaries ( and checksum ) based on the user's selection and just copy them in to the right location. Again the 'prefix', 'cflags', and 'libs' is saved in Alien::SDL->config.


+

For *nix/MacOSX we download sources and attempt to compile them. To be able to do this we download several other dependencies like libpng, jpeg and pango. You can see how we do this using hashes here. During the compile process we also apply patches as needed for the sources. Once this is done we can head to SDL Build.PL


+ SDL Perl dependency resolution
+
+SDL's Build is responsible for linking the right libraries to the correct XS. If libraries are missing it will disable the component (not put it in SDL->config).
+
+

For example to build Image.xs we require libsdl, libsdl_image and lib[jpg|png|tiff]. So we would check for these headers in the prefix provided by Alien::SDL->config. If they are not provided we will disable the SDL::Image module.


+

More over the availability of each library is specified as a -DMACRO to the gcc compiler. This way we can prevent XS failures due to missing libraries using #DEFINES. Here the SDL_image macro is defined and used. The availability of the module is then available from SDL::Config->has()
+
+
+ Conclusion
+

This is a high level overview of our Build process, because frankly I hate traumatizing my brain with this again. Credits have to go to FROGGS and kmx for helping with this Build scheme. Hopefully my post have helped people at the very least appreciate the problem scope of this Build system. That said I believe a fresh written build system, with these requirements in mind, will be more then welcome.
+

+


+

\ No newline at end of file