Guideline of developing Drizzle

After reading Jay Pipes "Getting a Working C/C++ Development Environment for Developing Drizzle", I follow his guide and success getting a Development Workspace for myself. I think this experience is important for us setting our open source project in the futrue:

 

This article is as an example in Drizzle server project, but the vast majority of the content applies equally well to developers wishing to contribute to the MySQL server or any other open source project written in C/C++. And I run these cmd in Unbuntu.

 

1. Installing Bazaar and Some Bzr Goodies

So, what is this Bazaar thing and why do you need it? Good question! Bazaar is the revision control system that the Drizzle development team (as well as the MySQL engineering team) uses for source code control. The good folks over at Canonical maintain and enhance the excellent Bazaar-NG system and have an online platform called Launchpad.net which is tightly integrated with Bazaar. Launchpad.net is kind of like SourceForge.net, only focused around Bazaar as the revision control system, and includes a number of nifty little features that make it easier to manage and maintain teams of developers working on the code base. The Drizzle Server project is hosted on Launchpad.net at http://launchpad.net/drizzle.

To install Bazaar, issue the following:

 

 

Once installed, you might want to install a few more things that will make your bzr life easier. The bzrtools package is a collection of command-line and graphical utilities for bzr. meld is a graphical merge conflict resolution utility that I have found invaluable at times. PoEdit is an easy way to work with the GetText translation utilities. To install these tools, do:

 

 

OK, that's it for Bazaar for now. Let's move on to getting your development toolchain installed.

 

2. The Required Toolchain Packages and Library Dependencies

In order to compile the Drizzle server, you will need a working GNU Toolchain with the following development tools. I've noted recommended minimum versions for each.

  • binutils (includes ld and as)
  • gcc/g++ (4.2+)
  • autoconf (2.59+)
  • automake (1.10+)
  • libtool (1.5.24+)
  • m4 (1.4.8+)
  • bison/yacc (2.3)
  • pkg-config (0.22+)

To install the above toolchain, do the following:

 

 

Once apt-get finishes installing the above, you'll have a system capable of compiling C/C++ programs, for the most part. The Drizzle server needs some additional libraries and header files in order to compile. I list them here along with a brief description of the library or file.

  • libpcre3 - A standard PCRE regular expression library
  • libpam0g - A pluggable authentication modules library (a horrible package name, no?...)
  • libncurses - A library for displays of terminal applications (used by the drizzle client)
  • libprotobuf - Google Proto Buffers library, used by the server in message communication
  • gettext - i10n and l10n services
  • libevent - socket event handling
  • libz - compression
  • libreadline - Command-line editing utilities
  • uuid-dev - UUID headers

The following command should install the required libraries with the exception of Google Proto Buffers, which is described in the following section.

 

  

 ps: some of these tools may be changed or updated, so please take care of the infomation while install them.

 

3. Installing Google Proto Buffers

After installing the libraries and toolchain, you'll need to install the Google Proto Buffers library. Unfortunately, there are not currently distribution packages for this library, so we'll install it manually. Here are the steps to do this.

Grab the tarball from the following location: http://code.google.com/p/protobuf/downloads/list. Once downloaded, untar the package. You can do all of it like so:

 

 

Next, let's go ahead and compile the sources:

 

 

Once this is done, Google Proto Buffers library (libprotobuf.so.0) will be installed, likely in /usr/local/lib unless you specified a different default directory. In addition, the program protoc, which is the .proto file compiler, will be installed.

IMPORTANT: As developers on a Linux distribution, we tend to forget that when installing a new shared library object, we need to run ldconfig after installation. Why do we forget this? Well, generally, our package manager runs ldconfig automatically after installing a package, so we tend to forget about it. :-) To reconfigure the linker's configuration, run this now:

OK, the proto buffers library and protoc should be installed correctly at this point. To verify, run the following:

It should produce something like the following:

  

 

 

4. Setting Up a Local Bazaar Repository for Drizzle and libdrizzle

Now that you've installed all the required toolchain and dependencies, it's time to use Bazaar to pull the development branch of Drizzle and compile the Drizzle server. The first step to do is to set up that local bzr repository. Myself, I have all my bzr repositories in a directory called ~/repos, and that is what the below examples show, but you are of course welcome to put your repos wherever you prefer. To set up a directory and a drizzle repo under your home directory, do the following:

 

 

At this point, you have a local bzr repository. Let's now create a local branch of the development source code trunk that we can play with. To do so, we use the bzr branch command to get libdrizzle and drizzle, like so:

 

1. Get libdrizzle and install it (I install libdrizzle and drizzle in my user dir, not root dir)

 

2. Get drizzle

 

 

This tells bzr to go grab the main development branch of the "drizzle" project that resides on the Launchpad.net servers (thus, the lp: prefix), and create a local branch called "trunk". The branch operation may take a little while to complete when you do it for the first time. Subsequent branch and merge operations are much, much quicker than the first branch into a repository. When the branch succeeds, go ahead and look at the files that have been downloaded into your "trunk" branch:

 

 

You should see something like the following:

 

 

5. Compiling Drizzle

OK, you are now ready to compile the server and client tools contained in your branch. The way to do so is the following:


If all goes well, drizzle will compile and build, get installed, and output the (hopefully!) passing test results. The output at the end should be similar to the following:

發佈了17 篇原創文章 · 獲贊 0 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章