How to create a git repo with the SQLite amalgamation source

Suppose you use GIT for your source control and would like to include SQLite as a third-party component via `git submodule` or `git subtree`. How does one go about getting access to the SQLite amalgamation as a GIT repo? When I tried this I found one on github.com, but it wasn’t being maintained any longer. It occurred to me that I didn’t need to depend on anyone else — I could do this myself. These steps use the bash command line shell. I’ve tried it on Mac OS, but should also work on Linux or using a bash shell on Windows. SQLite source is kept in a source control management tool called Fossil (http://fossil-scm.org). (It’s written by the authors of SQLite and uses SQLite internally, naturally.) The authors courteously tag each major of release in Fossil. So it’s simply a matter of cloning the SQLite source, checking out each tag, running the makefile to produce the amalgamation and checking in the amalgamated code into a new git repo.

Setup:

  1. Install Fossil from http://www.fossil-scm.org/download.html
  2. Install dev tools necessary for building fossil’s amalgamation (make, etc..)
  3. Install git
  4. Clone the SQLite source repo using fossil:

    mkdir sqlite-fossil
    cd sqlite-fossil
    fossil clone http://www.sqlite.org/cgi/src sqlite.fossil
    fossil open sqlite.fossil
    cd ..
  5. Create a new git repo to hold the amalgamation:

    mkdir sqlite-amalgamation
    cd sqlite-amalgamation
    git init
  6. Optional: Create a README.md file with a copy of these instructions or a link to this page and commit it.

In the future you won’t need to clone from fossil fresh, nor create a new repo — you’ll still have them. To add new SQLite releases to your repo you will use `fossil update` and `git pull` to update the two repos.

Adding one release:

  1. Perform these steps, replacing $1 with the release name — OR just copy this into a file called build-sqlite.sh next to your two repos, make it executable using `chmod +x build-sqlite.sh` and invoke it with the name of the release.
    cd sqlite-fossil
    fossil update $1
    rm -rf ../sqlite_build
    mkdir ../sqlite-build
    cd ../sqlite-build/
    ../sqlite-fossil/configure
    make sqlite3.c
    cd ../sqlite-amalgamation/
    mv ../sqlite-build/sqlite3.c .
    mv ../sqlite-fossil/src/shell.c .
    mv ../sqlite-build/sqlite3.h .
    mv ../sqlite-fossil/src/sqlite3ext.h .
    git commit -a -m $1
    cd ..
  2. For example:


    ./build-sqlite.sh version-3.8.11.1

    Not sure what all the tags are? Use `fossil tags` to display all the tags. Search for the ones that start with 3. as the major releases. Warning: The releases do not sort in alphabetical order (e.g. 3.8.11 sorts before 3.8.9 but is a later release) so use care when picking which tags to build, otherwise your git repo could end up with the commits not in the correct order.

Monitor Progress of dd Command

If you ever use the “dd” command do duplicate a drive, you’re probably familiar with the unnerving wait that accompanies its use. The command generally takes on the order of *minutes* to complete, and gives no feedback.

If you read the MAN page, you’ll see you can monitor the progress by sending a SIGINFO signal.

Open another terminal window, and do

kill -SIGINFO <dd pid>

Where <dd pid> is the process id of your dd command. For example, when I was formatting the SD card for use in my Raspberry Pi via dd on the command line, I was able to monitor progress this way:

sudo dd if=~/Downloads/2013-02-09-wheezy-raspbian.img of=/dev/disk2 bs=2048k
193+0 records in
192+0 records out
402653184 bytes transferred in 314.132226 secs (1281795 bytes/sec)

UPDATE: OMG! I just realized that the moment in time when I sampled my software installation on my Raspberry Pi was 100π to 4 digits of precision. What a wonderful omen!

Server All Furbished Up with Ubuntu 12 LTS

This weekend I installed the latest “long term support” (LTS) version of the Linux operating system “Ubuntu” on my server in the cloud. With any luck, this won’t affect the sites hosted here (Becka’s and my blogs, the band, my pa-in-law’s architecture website, my family mailing list…) But if you notice something awry, please let me know.

I *heart* Naomi Novik

I just finished reading a fun novel, “His Majesty’s Dragon”. Sort of like Napoleonic historical fiction, but with Dragons acting like the RAF.
Ok the real cool part for a geek like me is the fact that the author is a former Computer Scientist. Kind of like I’m a former Molecular Biologist.
And she worked on Neverwinter Nights : Shadows of Undrendtide. Ok, maybe I’ll finish playing that game now.
Scott, can you believe it? Someone who worked for BioWare! And she finished writing a cool book! Maybe you can stop being immersed in Dungeons and Dragons computer games and finish your dissertation! If she can do it, so can you! lol