<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>lighty's life: Tag scons</title>
    <link>http://blog.lighttpd.net/articles/tag/scons</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>1.5.0 goes cmake</title>
      <description>&lt;p&gt;It is a tradition now to change the build-system from lighttpd on each &lt;a href="http://blog.lighttpd.net/articles/2005/09/27/lighttpd-goes-scons"&gt;major release&lt;/a&gt;
For now we have the autotools as the user-visible build-system and &lt;a href="http://www.scons.org/"&gt;scons&lt;/a&gt; as the system for the developers.&lt;/p&gt;


	&lt;p&gt;Currently we are testing &lt;a href="http://www.cmake.org/"&gt;cmake&lt;/a&gt; as a replacement for the scons part.&lt;/p&gt;
&lt;h3&gt;Build Systems&lt;/h3&gt;
Before you can build a C-program you first have to find out which functions the system you compile on supports. Not only that &lt;span class="caps"&gt;UNIX&lt;/span&gt; has various flavours, no, there is also Windows.

	&lt;p&gt;The natural way on &lt;span class="caps"&gt;UNIX&lt;/span&gt; is using autotools (autoconf, automake, ...) which creates a shell script (configure) which generates the Makefiles which are process by make to build the application.&lt;/p&gt;


	&lt;p&gt;Using automake reduced the pain of autoconf when it was released, but it none the less is still enough pain to look for something else. Not to forget that win32 and shell-scripts aren&amp;#8217;t real friends.&lt;/p&gt;


&lt;h3&gt;scons&lt;/h3&gt;
SCons going another route. It replaces make and the autotools by a python based build-system. You can do everything with just a few lines of python code. Very neat.

	&lt;p&gt;The bad side: its development is more or less sleeping. The unstable 0.96.9x branch which fixes various nasty bugs is unstable since 2004-08-22, the release of 0.96.1.&lt;/p&gt;


&lt;h3&gt;cmake&lt;/h3&gt;
cmake is more relaxed and doesn&amp;#8217;t want to solve the whole problem. It does the configure checks and leaves the building to the native build-system. On Unix it is either make or kdevelop3, on MacOSX it is XCode and on windows it is nmake.

	&lt;p&gt;As extra cmake supports basic packaging and has very nice integration with test-tools like Dart.&lt;/p&gt;


&lt;h3&gt;Cross-Compiling&lt;/h3&gt;
As a proof-of-concept I&amp;#8217;ve added cmake support to trunk used the &lt;a href="http://openwrt.org/"&gt;openwrt&lt;/a&gt; SDK to build lighttpd with openwrt.

&lt;pre&gt;
$ cmake .
$ rm CMakeCache.txt
$ OPENWRT=.../OpenWrt-SDK-Linux-x86_64-1/staging_dir_mipsel/ \
CC=$OPENWRT/bin/mipsel-linux-gcc \
LD=$OPENWRT/bin/mipsel-linux-uclibc-ld make
&lt;/pre&gt;

&lt;h3&gt;Command Line Options&lt;/h3&gt;
&lt;pre&gt;
$ cmake -L .
...
CMAKE_INSTALL_PREFIX:PATH=
...
WITH_BZIP:BOOL=OFF
WITH_MYSQL:BOOL=OFF
WITH_OPENSSL:BOOL=OFF
WITH_PCRE:BOOL=ON
WITH_SQLITE3:BOOL=OFF
WITH_WEBPAV_PROPS:BOOL=OFF
WITH_XATTR:BOOL=OFF
WITH_ZLIB:BOOL=ON
$ cmake -DWITH_BZIP:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/home/jan/l-1.5.0-cmake/
&lt;/pre&gt;

&lt;h3&gt;Static Linking&lt;/h3&gt;

	&lt;p&gt;To make it easier for embedded systems which don&amp;#8217;t have support for dlopen() I added the option:&lt;/p&gt;


&lt;pre&gt;
$ cmake -DBUILD_STATIC:BOOL=ON .
&lt;/pre&gt;

	&lt;p&gt;It will build all the modules as static libraries which are linked into the server at build-time. server.modules is used to initialized the modules as before.&lt;/p&gt;</description>
      <pubDate>Mon, 25 Dec 2006 20:37:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5263ca7e-783a-4a52-9b31-4f4ff998b171</guid>
      <author>jan</author>
      <link>http://blog.lighttpd.net/articles/2006/12/25/1-5-0-goes-cmake</link>
      <category>lighttpd</category>
      <category>scons</category>
      <category>cmake</category>
      <trackback:ping>http://blog.lighttpd.net/articles/trackback/2603</trackback:ping>
    </item>
    <item>
      <title>lighttpd goes scons</title>
      <description>&lt;p&gt;In my daily work at MySQL I added &lt;a href="http://www.scons.org/"&gt;scons&lt;/a&gt; as the build-system for a cross-platform, multi-language project and am very satisfied with the results. We have Unix, Windows and MacOS X as build-platforms and  Java, C, &lt;span class="caps"&gt;PHP&lt;/span&gt; and Perl as programming languages and all works nicely together in a Python written build-system.&lt;/p&gt;


	&lt;p&gt;lighttpd goes now the same way, solving the nasty autotools dependencies.&lt;/p&gt;
&lt;p&gt;Autotools are a pain for two reasons:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;version incompatibilities&lt;/li&gt;
		&lt;li&gt;it takes ages to rebuild the Makefiles and configure script&lt;/li&gt;
		&lt;li&gt;the installation of modules via libtool takes ages too&lt;/li&gt;
		&lt;li&gt;using m4 and sh as the lowest dominator&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;and waiting for a installation process to finish is lost time.&lt;/p&gt;


What is good at autotools ?
	&lt;ol&gt;
	&lt;li&gt;make distcheck is great&lt;/li&gt;
		&lt;li&gt;perfect integration into rpm building&lt;/li&gt;
		&lt;li&gt;cross-compiling&lt;/li&gt;
		&lt;li&gt;self-contained for a non-devs&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;As long as we don&amp;#8217;t have a replacement for the &amp;#8216;pro&amp;#8217; arguments in scons we will not drop autotools. They do there job in packaging and testing very well. But for building and developing lighttpd I&amp;#8217;ll use scons.&lt;/p&gt;


	&lt;p&gt;The scons build-system is already in the &lt;span class="caps"&gt;SVN&lt;/span&gt; tree. It replaced autotools (automake, autoconf, libtool) and (g)make by one central tool.&lt;/p&gt;


	&lt;p&gt;You need&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;python 2.2.x or higher&lt;/li&gt;
		&lt;li&gt;scons 0.96.1 or higher&lt;/li&gt;
	&lt;/ol&gt;


&lt;pre&gt;
$ cp config.py config.py-sample
(adjust the features and paths)
$ scons install
&lt;/pre&gt;

	&lt;ol&gt;
	&lt;li&gt;the checks for libraries, headers and functions are executed as ./configure did before&lt;/li&gt;
		&lt;li&gt;the main binary is built&lt;/li&gt;
		&lt;li&gt;the modules are created&lt;/li&gt;
		&lt;li&gt;everything is installed&lt;/li&gt;
	&lt;/ol&gt;


What else should you know about scons ?
&lt;pre&gt;
$ scons -c  [for a 'make clean']
$ scons check  [for a 'make check']
$ cd src; scons -u [for a 'make' in the 'src/' directory]
&lt;/pre&gt;

	&lt;p&gt;In the near future autotools won&amp;#8217;t be dropped in lighttpd. Up to now it was only tested with gcc and linux. It will need some time until everything is ported to scons, but it is worth it. Especially for the new devs struggling with autotools and there syntax and the old-devs who spend days just with waiting.&lt;/p&gt;</description>
      <pubDate>Tue, 27 Sep 2005 10:31:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6264917200bb5c2185f102f2ab1f8429</guid>
      <author>jan</author>
      <link>http://blog.lighttpd.net/articles/2005/09/27/lighttpd-goes-scons</link>
      <category>autoconf</category>
      <category>scons</category>
      <trackback:ping>http://blog.lighttpd.net/articles/trackback/22</trackback:ping>
    </item>
  </channel>
</rss>
