Category: debian

  • GTK+ OpenGL work

    There’s an opening at Canonical that I’d like to take after the current contract is up. It’s an opening for a OpenGL dev on the Ubuntu desktop team.

    Don’t get me wrong; I enjoy working with my current group quite a bit. We’re building a pretty neat tool. However, building OpenGL into the GNOME desktop has been a personal goal of mine for quite a while now.

    I bought a Voodoo II in 1999, just after I graduated from high school with the hopes of building a video game. The tools for Linux were sparse. There was Blender, but the learning curve is very high, the source was not then open, and I knew I wouldn’t be able to build the whole game by myself. So I started building a 3d modeler myself.

    I got as far as building a quake .mdl loader with rotation, scaling and primitive animation. I was pretty proud of myself.

    I haven’t gotten too far along the path since then, however. Time required by work has increased, and I haven’t been able to find a way to make the two projects (food on the table, continuing work on the modeler) mesh.

    In 2006, I was able to take over maintaining gtkglarea and fix a couple of minor problems. I wrote a c# wrapper around the widget library using Mike‘s excellent gapi tool. I was able to help Rob, Dave and Dylan with Tao.OpenGL (which led to a bit of work on Prebuild). I helped Sam a bit to make gtkglarea-sharp production-ready. But I haven’t had a chance to get that modeler finished…

    I’m nothing if not persistent, though :)

  • IronRuby stuff

    I’ve been doing some work with the DLR team at Microsoft and the community of F/OSS developers they’ve inspired on IRC & the mailing lists. I’m providing a virtual host that is being used to perform continuous integration on Debian sid.

    The current status is here:

    http://twitter.com/IronRubyCI

    Maybe we’ll make an IronPerl one of these days :)

  • Writing Free Sofware index

    So, I’ve been meaning to write an index for this series. I haxx0red my web server and made this easy-to-remember url work.

    http://wp.colliertech.org/cj/writing-free-software/

  • Next article in the “Writing Free Software” series

    Hey all,

    I’m not certain what the next topic should be. I’ve got a few ideas. Could the interested parties let me know what they’re curious most about?

    • documentation
    • distributing .exe.config and .dll.config files
    • inter-package dependencies using pkg-config
    • creating sub packages
    • test harnesses and the “check” target
    • the debian/ directory and .deb packages
    • … something completely different

    I’m looking for comments on this one!

  • Writing Free Software – Part 10: Subdirectories

    In this installment, I’ll cover creating different subdirectories for different parts of the code. We’ll move NDesk.Options.cs into an ndesk directory and Greeting.cs into a src directory. Some modifications need to be made to various pieces of the distribution in order for this to work out correctly. We’ll do the minimum required now and cover the pieces that will make it more extensible but complex in future entries.

    Return to the workplace

    $ cd ~/src/greeting

    Move the source to their new directories

    $ mkdir src ndesk
    $ mv NDesk.Options.cs ndesk
    $ mv Greeting.cs src
    $ mv Makefile.am src

    Create a new root Makefile.am file

    $ cat > Makefile.am
    SUBDIRS = src ndesk

    bin_SCRIPTS = greeting
    ^D

    Create ndesk/Makefile.am

    $ cat > ndesk/Makefile.am
    EXTRA_DIST = NDesk.Options.cs

    Alter src/Makefile.am to cope with new layout

    $ patch src/Makefile.am

    10,11c10,11
    < Greeting.exe: Greeting.cs NDesk.Options.cs
    < # the same as $(CSC) -out:Greeting.exe Greeting.cs
    ---
    > Greeting.exe: Greeting.cs $(top_srcdir)/ndesk/NDesk.Options.cs
    > # the same as $(CSC) -out:Greeting.exe Greeting.cs ...
    14,15c14
    < EXTRA_DIST = Greeting.cs NDesk.Options.cs
    <
    ---
    > EXTRA_DIST = Greeting.cs
    18,19d16
    <
    < bin_SCRIPTS = greeting
    ^D^D
    patching file src/Makefile.am

    Alter configure.ac to cope with new layout

    $ patch configure.ac

    @@ -13,6 +13,8 @@
     
     AC_CONFIG_FILES([
     Makefile
    +ndesk/Makefile
    +src/Makefile
     greeting
     ])
     AC_OUTPUT
    missing header for unified diff at line 1 of patch
    patching file configure.ac
    

    Prove that we didn’t break anything

    $$ automake && autoconf && ./configure
    ...
    $ make
    ...
    $ sudo make install
    ...
    $ greeting
    Greetings, World!

    Conclusion

    In this lesson, I gave an example of re-factoring the build system to use subdirectories. This method can be used to separate portions of one’s codebase. In addition, we saw the use of the $srcdir variable, which stores the location of the root of the source distribution.

    In future posts, we will use the work done in this lesson as a basis for some more re-factoring. We will also learn how to do things such as

    • creating sub projects
    • inter-package dependencies using pkg-config
  • Writing Free Software – Part 9: Creating the wrapper script

    A previous post covered altering the install target so that it places the .exe assembly into the filesystem of the installer’s computer. In this part, we will cover creating the so-called “wrapper” script, which is the way recommended by the mono project’s application deployment guidelines to make the assembly executable on the system outside of the source distribution.

    Return to the workplace

    $ cd ~/src/greeting/

    Create the wrapper script template

    $ cat > greeting.in
    #!/bin/bash
     
    exec @RUNTIME@ @prefix@/lib/mono/@PACKAGE_NAME@/Greeting.exe "$@"
    ^D

    Alter the configure.ac file to process the wrapper template

    $ patch configure.ac

    @@ -13,6 +13,7 @@
     
     AC_CONFIG_FILES([
     Makefile
    +greeting
     ])
     AC_OUTPUT

    ^D^D

    Alter the Makefile.am file to distribute the wrapper template

    $ cat >> Makefile.am
     
    bin_SCRIPTS = greeting
     
    ^D

    Re-build the Makefile and wrapper script

    $ autoconf && automake && ./configure

    Test the install target

    $ make && sudo make install
    $ which greeting
    /usr/local/bin/greeting
    $ greeting ––number 8
    Greetings, Neptune!

    Conclusion

    In this post, I gave an example of creating a simple wrapper shell script and using the autotools infrastructure to locate and use the system C# compiler and CLI runtime. This may not seem like much of a feat, but many systems have their binaries installed in weird locations and other quirks. The autotools system is able to detect and take care of these details without having the maintainer of the software create system-specific tweaks that would undoubtedly reduce the number of platforms on which the software would work.

  • Writing Free Software – Part 8: Exploring configure.ac variables

    Introduction

    One of autotools’ primary purposes is to allow software to be built and installed on a wide range of platforms. The configure script is responsible for a great deal of this flexibility. When it is run, it interrogates the system on which it is being run to determine the features available. If required features are missing, the script can do any number of things, including but not limited to:

    • reporting a problem and bailing out
    • trying an alternate approach
    • attempting to fetch the missing software and continuing/aborting depending on the outcome
    • recommending that the person running the configure script install the required bits
    • mocking the user

    In this post, I will note a few of the variables that can be used to determine the configuration of the system.

    Return to the workplace

    $ cd ~/src/greeting

    Modify configure.ac to report some findings

    $ patch configure.ac

    --- configure.ac.orig	2009-03-20 14:49:16.000000000 -0700
    +++ configure.ac	2009-03-20 14:46:16.000000000 -0700
    @@ -1,5 +1,11 @@
     AC_INIT([greeting],[0.0.1])
     AM_INIT_AUTOMAKE([1.9 tar-ustar])
    +
    +AC_PATH_PROG(RUNTIME, mono, no)
    +if test "x$RUNTIME" = "x" ; then
    +  AC_MSG_ERROR([Can't find "mono" in your PATH])
    +fi
    +
     AC_PATH_PROG(CSC, gmcs, no)
     if test "x$CSC" = "x" ; then
       AC_MSG_ERROR([Can't find "gmcs" in your PATH])
    @@ -8,3 +14,12 @@
     Makefile
     ])
     AC_OUTPUT
    +
    +echo "================="
    +echo ""
    +echo "Thank you for configuring '$PACKAGE_NAME' version '$PACKAGE_VERSION'"
    +echo "Runtime:             $RUNTIME"
    +echo "C# compiler:         $CSC"
    +echo "installation prefix: $prefix"
    +echo ""
    +echo "================="
    ^D^D
    

    Re-run configure to see results

    $ autoconf && ./configure
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... no
    checking for mawk... mawk
    checking whether make sets $(MAKE)... yes
    checking how to create a ustar tar archive... gnutar
    checking for mono... /usr/bin/mono
    checking for gmcs... /usr/bin/gmcs
    configure: creating ./config.status
    config.status: creating Makefile
    =================
     
    Thank you for configuring 'greeting' version '0.0.1'
    Runtime: /usr/bin/mono
    C# compiler: /usr/bin/gmcs
    installation prefix: /usr/local
     
    =================

    Conclusion

    One of the primary reasons that autotools is so powerful is that it can figure out what’s on your system and use it to build the software in the package. In following posts, we will make use of some of these system configuration variables.

  • Writing Free Software – Part 7: Creating a working install target

    Introduction

    This entry will show how to add the bits required for an install target. There are two pieces that need to be added to the Makefile.am:

    • target_DATA, which is a list of files associated with the target
    • targetdir, which is the location where the above files will be installed

    Return to the workplace

    $ cd ~/src/greeting

    Add the required variables to Makefile.am

    $ cat >> Makefile.am
    Greeting.exedir = $(prefix)/lib/mono/greeting
    Greeting.exe_DATA = Greeting.exe
    ^D
    $ sudo make install
    ...
    $ ls /usr/local/lib/mono/greeting/
    Greeting.exe

    Conclusion

    We now have the bits in place to put Greeting.exe in the correct directory, but no way to execute it. We’ll address that in a future post. Until then, you might be interested in reading through the application deployment guidelines

  • Writing Free Software – Part 6: Making a simple distribution

    You might remember from a previous post that we’ve already got a “dist” target which creates a tarball of the source. However, the source doesn’t include any of the code we wrote, only the files generated by autotools. In this article, we’ll make the modifications to the Makefile.am file required to include our source in the dist tarball.

    Return to our workspace

    $ cd ~/src/greeting

    Add an EXTRA_DIST automake variable

    $ echo "EXTRA_DIST = Greeting.cs NDesk.Options.cs" >> Makefile.am

    Re-build our Makefile

    $ ./configure

    Test the distdir target

    $ make distdir
    ...
    $ ls greeting-0.0.1
    AUTHORS Greeting.cs Makefile.in README configure.ac
    COPYING INSTALL NDesk.Options.cs aclocal.m4 install-sh
    ChangeLog Makefile.am NEWS configure missing
    $ make dist
    ...

    Conclusion

    Another short one. Sorry for the brevity. But as you can see, a little bit goes a long way.

  • Writing Free Software – Part 5: Consuming configure.ac variables

    This one has to be quick folks. The family needs my support this evening ;)

    In the last episode, we created a simple configure.ac and defined a variable, CSC. We didn’t change the Makefile other than re-naming it to Makefile.am. In this article, we’ll simply show how to consume the variable which was defined in configure.ac.

    Return to our workplace

    $ cd ~/src/greeting

    Alter Makefile.am to use the C# compiler defined in configure.ac

    $ sed -e 's/gmcs/\$\(CSC\)/' Makefile.am
    $ cat Makefile.am
    # the first target is the one executed when no target is named
    all: Greeting.exe
    #don't do anything
     
    # running 'make clean' will execute this target
    clean:
    rm Greeting.exe
     
    # running 'make Greeting.exe' will execute this target
    Greeting.exe: Greeting.cs NDesk.Options.cs
    # the same as $(CSC) -out:Greeting.exe Greeting.cs
    $(CSC) -out:$@ $^

    Prove that it didn’t break things


    $ automake && ./configure
    $ make clean
    cd . && /bin/sh /home/cjac/src/greeting/missing --run automake-1.10 --gnu Makefile
    cd . && /bin/sh ./config.status Makefile
    config.status: creating Makefile
    rm Greeting.exe
    $ make
    /usr/bin/gmcs -out:Greeting.exe Greeting.cs NDesk.Options.cs

    $ ./Greeting.exe ––number 9
    Greetings, Pluto!

    Conclusion

    That’s all I’ve got time for right now. Zelda’s crying for daddy!